Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Reading VFP settings from the Windows Registry
URL: converting unsafe characters and spaces into escape sequences
Using GetSysColor
Drawing icons associated with the VFP main window
Finding parameters for the region specified
How to generate GUID values
List of addresses in the AutoDial mapping database
Retrieving graphic capabilities of default printer
Retrieving information about the specified icon
Animating a transition of the VFP form (a wire-frame rectangle)
How to perform Base64 encoding/decoding using Cryptography API Functions
How to read email messages using Simple MAPI
Playing WAV sounds simultaneously
Smart Card Database Query Functions
Clipping mouse cursor area
Converting path to original case
Enumerating print processors and supporting data types installed on the specified server
How to release and renew a lease on an IP address previously obtained through Dynamic Host Configuration Protocol (DHCP)
How to run FoxPro application under different user name (impersonating user)
Retrieving graphic capabilities of your display
Retrieving the command line for the VFP session
Using the Semaphore object to allow only one instance of VFP application running
Writing to INI file
FindText -- the hopeless and useless Common Dialog
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: 151  
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 (72.44.48.122)
1.85 hrs.Function: 'RegisterHotKey'
Function group: 'Keyboard Input'
1.86 hrs.Function: 'DrawDibOpen'
Function group: 'Windows Multimedia'
 Example: 'Reading data from INI files'
3.25 hrs.Function: 'SendMessage'
 Function: 'ShellExecuteEx'
18.45 hrs.Function: 'Process32Next'
Function group: 'Performance Monitoring'
 Example: 'How to create a desktop shortcut (shell link)'
19.29 hrs.Function: 'NetApiBufferFree'
 Example: 'Retrieving the rectangle area where the mouse cursor is confined'
 Function: 'IsMenu'
Function group: 'Menu'
Google
Advertise here!