Using Win32 functions in Visual FoxPro Image Gallery
Cursor
..msdn
ClipCursor
GetClipCursor
GetCursorInfo
GetCursorPos
ShowCursor
Code examples:
Clipping mouse cursor area
Creating a clipping region from the path selected into the device context of a form
Form Magnifier
Shortcut Menu Class
Tracking mouse movement to detect when to start dragging
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
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
 
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: 2004-07-15 09:38:12  
Visits in 7 days: 150  
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-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.224.75.101)
9.1 hrs.Function: 'WinExec'
Function group: 'Process and Thread'
 Example: 'Round FoxPro form'
9.11 hrs.Function: 'TextOut'
15.57 hrs.Example: 'Creating a console window for Visual FoxPro application'
 Function: 'AVIStreamRelease'
23.26 hrs.Example: 'How to release and renew a lease on an IP address previously obtained through Dynamic Host Configuration Protocol (DHCP)'
 Example: 'Extensible Storage Engine class library'
1 day(s)Function: 'SQLGetDiagRec'
2 day(s)Example: 'System Image List Viewer'
 Example: 'Copying picture of the active form to the Clipboard using Enhanced Metafile API functions'
Google
Advertise here!