Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetCursorPos() - a simple question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01067213
Message ID:
01067260
Vues:
13
I tried this 2 ways:
procedure getCoord
parameters xcoord,ycoord

Local lcPOINT

DECLARE INTEGER GetCursorPos IN Win32API ;
	STRING@

lcPOINT = SPACE(8)

IF GetCursorPos(@lcPOINT) == 0
	XCoord	= MCOL(3)
	YCoord	= MROW(3)
ELSE
	XCoord	= ASC(LEFT(m.lcPOINT,1))+256*ASC(SUBSTR(m.lcPOINT,2,1))
	YCoord	= ASC(SUBSTR(m.lcPOINT,5,1))+256*ASC(SUBSTR(m.lcPOINT,6,1))
ENDIF
and this one:
procedure getCoord
LPARAmeters XCoord, YCoord

Local lcPOINT

DECLARE INTEGER GetCursorPos IN Win32API STRING@

=getMousePos(@xcoord,@ycoord)

PROCEDURE getMousePos (x, y) 
    LOCAL lcBuffer 
    lcBuffer = Repli(Chr(0), 8) 
    = GetCursorPos (@lcBuffer) 
    x = buf2dword(SUBSTR(lcBuffer, 1,4)) 
    y = buf2dword(SUBSTR(lcBuffer, 5,4))

?x
?y
 

FUNCTION buf2dword (lcBuffer) 
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ; 
       Asc(SUBSTR(lcBuffer, 2,1)) * 256 +; 
       Asc(SUBSTR(lcBuffer, 3,1)) * 65536 +; 
       Asc(SUBSTR(lcBuffer, 4,1)) * 16777216 
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform