| |
|
|
|
$U thread.pcu =thread.
Declare gmx%,gmy%,gmp#,dlg&
windowstyle ( 512 | 8 )
cls
dlg&=createdialog(%hwnd,,100,100,300,300)
Dim gmp#,8
whilenot %key=2
thread.start 1,1
waitinput
thread.stop 1
wend
dispose gmp#
destroywindow (dlg&)
end
proc thread.do
parameters n&
if n&=1
clear gmp#
external(user32,ClientToScreen,dlg&,gmp#)
gmx%=long(gmp#,0)
gmy%=long(gmp#,4)
external(user32,GetCursorPos,gmp#)
gmx%=long(gmp#,0)-gmx%
gmy%=long(gmp#,4)-gmy%
locate 1,1
print gmx%,gmy%,
endif
endproc
Salve. |
|
|
| |
|
|
|
| Frank Abbing (Nachtrag): Eine andere Lösung ist diese. Es wird ganz einfach die Message WM_MOUSEMOVE ausgewertet:
Declare rect#,mousex&,mousey&,fenster&
Dim rect#,16
DEF ScreenToClient(2) ! user32,ScreenToClient
DEF GetCursorPos(1) !USER32,GetCursorPos
Cls
fenster&=@Create(Window,%hwnd,Dialog,100,100,240,480)
Usermessages $200
While 1
WaitInput
Case ((%key=2) or (%key=4)):BREAK
If fenster&=%MWnd
GetCursorPos(rect#)
ScreenToClient(fenster&,rect#)
mousex&=Long(rect#,0)
mousey&=Long(rect#,4)
DrawText 20,20,Str$(Int(mousex&))+, +Str$(Int(mousey&))+
EndIf
EndWhile
Dispose rect#
End
|
|
|
| |
|
|