Using Win32 functions in Visual FoxPro Image Gallery
Mouse Input
..msdn
DragDetect
GetCapture
GetDoubleClickTime
GetMouseMovePointsEx
ReleaseCapture
SetCapture
SetDoubleClickTime
SwapMouseButton
Code examples:
Tracking mouse movement to detect when to start dragging
Tracking mouse movement to detect when to start dragging

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:
See also:
  • How to drag a Form not using its Titlebar or Caption
  • Dragging files from Explorer window and dropping them on FoxPro control

  • PUBLIC objForm
    objForm = CreateObject("TForm")
    objForm.Visible = .T.
    
    DEFINE CLASS TForm As Form
        Width=400
        Height=200
        Autocenter=.T.
    
    PROCEDURE  Load
        THIS.decl
    
    PROCEDURE  MouseDown
    LPARAMETERS nButton, nShift, nXCoord, nYCoord
    
        * testing the mouse key state
        IF nButton <> 1
            RETURN
        ENDIF
    
        LOCAL lcCursorPos, hWindow
    
        * window handle for this form
        hWindow = GetFocus()
    
        * reading cursor position
        lcCursorPos = Repli(Chr(0), 8)
        = GetCursorPos(lcCursorPos)
    
        * Attention: at the next line the execution is stopped until
        * the mouse button released or the cursor moved out 
        * the drag-free rectangle centered on the current cursor position
        * with sides defined by the system
    
        * the width and height of this rectangle returned by the GetSystemMetrics 
        * function called with the correspondent SM_CXDRAG or SM_CYDRAG parameters
    
        IF DragDetect(hWindow, @lcCursorPos) <> 0
        * user moved the mouse outside of the drag rectangle 
        * while holding down the left button 
            ACTI SCREEN
            ? "Drag detected"
        ELSE
            ACTI SCREEN
            ? "Mouse key released without dragging"
        ENDIF
    
    PROCEDURE  decl
        DECLARE INTEGER GetFocus IN user32
        DECLARE INTEGER GetCursorPos IN user32 STRING @lpPoint
    
        DECLARE INTEGER DragDetect IN user32;
            INTEGER hwnd, STRING @pt
    ENDDEFINE
    
    
    

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1329 bytes  
    Created: 2002-02-25 23:18:12  
    Modified: 2013-09-04 19:46:20  
    Visits in 7 days: 78  
    Listed functions:
    DragDetect
    GetCursorPos
    GetFocus
    GetSystemMetrics
    Printer friendly API declarations
    My comment:
    The DragDetect function captures the mouse and tracks its movement until the user releases the left mouse button, presses the ESC key, or moves the mouse outside the drag rectangle around the specified point.

    To obtain the width and height for this rectangle call the GetSystemMetrics function with the SM_CXDRAG and SM_CYDRAG values as a parameter.
    #DEFINE SM_CXDRAG 68
    #DEFINE SM_CYDRAG 69
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright 2001-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.226.33.117)
    22 sec.Function: 'FreePrinterNotifyInfo'
    Function group: 'Printing and Print Spooler'
    42 sec.Function: 'GetProcessTimes'
    Function group: 'Process and Thread'
    1.08 min.Banners
    1.42 min.Function: 'FindNextFile'
    Function group: 'File Management'
    1.75 min.Function: 'WSAEventSelect'
    2.05 min.Function: 'ntohs'
    Function group: 'Windows Sockets 2 (Winsock)'
    2.73 min.Function: 'VirtualFreeEx'
    3.08 min.Example: 'Pocket PC: custom RAPI class for operating with files and folders on mobile device'
    3.45 min.Function: 'CertFindCertificateInStore'
    Function group: 'Cryptography Reference'
    3.83 min.Function: 'MoveFile'
    Function group: 'File Management'
    Google
    Advertise here!