Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to drag a Form not using its Titlebar or Caption
Tracking mouse movement to detect when to start dragging
Using the Semaphore object
Winsock: retrieving information about available transport protocols
GDI+: how to make VFP controls visually shake and shudder
How to read email messages using Simple MAPI
How to retrieve network parameters for the local computer (including Host name, Domain name, and DNS Server)
Retrieving the IP-to-physical address mapping table
Saving local machine ODBC Registry Entries to XML file
Testing Clipboard functions: emptying the clipboard
Using MessageBeep
Winsock: initializing the service in the VFP application
Creating a mailslot
Deleting files into the Recycle Bin
GDI+: Drawing a Pie Chart
How to delete file on FTP server
Minimizing all running applications
Obtaining MAC address through Address Resolution Protocol (ARP) request
Retrieving the rectangle area where the mouse cursor is confined
Starting a dialog box for connecting to network resources (mapping network drive)
Disk in drive A:
GetFocus returns a HWND value
How to save registry key including its subkeys and values to a file
Number of clipboard formats available
How to drag a Form not using its Titlebar or Caption

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
Drag the form with a mouse holding at any point in the client area of the form, not just the title of the form. The form can be dragged using its client area even if the Movable property set to False.

See also:
  • Round FoxPro form
  • Tracking mouse movement to detect when to start dragging
  • Dragging files from Explorer window and dropping them on FoxPro control
  • LOCAL oForm
    oForm = CREATEOBJECT("Tform")
    DEFINE CLASS Tform As Form
        Caption="Left-click inside the form and drag"
    PROCEDURE Destroy
    PROCEDURE MouseDown
    LPARAMETERS nButton, nShift, nXCoord, nYCoord
        IF nButton = 1
            LOCAL hWindow
            hWindow = THIS.HWnd && GetFocus()
            = ReleaseCapture()
            = SendMessage(hWindow, WM_SYSCOMMAND,;
                MOUSE_MOVE, WM_NULL)
            = SendMessage(hWindow, WM_LBUTTONUP, 0, 0)
    PROCEDURE declare
        DECLARE INTEGER ReleaseCapture IN user32
        DECLARE INTEGER GetFocus IN user32
        DECLARE INTEGER SendMessage IN user32;
            INTEGER hWindow, INTEGER Msg,;
            INTEGER wParam, INTEGER lParam

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    860 bytes  
    Created: 2001-11-22 20:10:49  
    Modified: 2013-09-04 19:45:41  
    Visits in 7 days: 88  
    Listed functions:
    Printer friendly API declarations
    My comment:
    Read MSDN article How to Move a Form that Has No Titlebar or Caption.

    * * *
    This behaviour can also be implemented by intercepting and processing WM_NCHITTEST windows messages sent to the form. If the cursor is inside the client area, return HTCAPTION (2) instead of HTCLIENT (1).

    Note that for top-level forms (ShowWindow=2), the first parameter in WM_NCHITTEST handling BINDEVENT call should not be ThisForm.HWnd, but the window handle of the inner window.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.

    Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (
    11 sec.
    21 sec.Function: 'CeGetSpecialFolderPath'
    Function group: 'Remote Application Programming (RAPI)'
    33 sec.Project
    43 sec.Articles
    55 sec.Function: 'GetStartupInfo'
    Function group: 'Process and Thread'
    1.15 min.Links
    1.32 min.Example: 'Placing On-screen Alert on top of all windows'
    1.52 min.Function: 'LoadResource'
    1.7 min.Function: 'CharUpper'
    Function group: 'String'
    1.93 min.Function: 'gethostname'
    Function group: 'Windows Sockets 2 (Winsock)'
    Advertise here!