注册 登录
编程论坛 VFP论坛

请问吹版主,ScreenToClient如何使用

kmyz_yyl 发布于 2025-01-02 08:56, 155 次点击
    POINTAPI=REPLICATE(CHR(0),8)
    GetCursorPos(@POINTAPI)

res = ScreenToClient(hwnd, POINTAPI)   
x = POINTAPI.x * 15    &&  ? 如何获取X,Y值
y = POINTAPI.y * 15      &&  ?

WindowFromPoint(X,Y)
2 回复
#2
sych2025-01-02 09:33
Public Type POINTAPI
x As Long
y As Long
End Type

DECLARE SHORT GetCursorPos IN win32api STRING @
DECLARE INTEGER ScreenToClient IN win32api INTEGER hWnd, STRING  @ lpPoint
DECLARE INTEGER WindowFromPoint IN win32api INTEGER,INTEGER
POINTAPI=REPLICATE(CHR(0),8)
GetCursorPos(@POINTAPI)
x=ctobin(SUBSTR(POINTAPI,1,4),'4rs')
y=ctobin(SUBSTR(POINTAPI,5,4),'4rs')
szshwnd = WindowFromPoint(x,y)
ScreenToClient(szshwnd,@pointapi)
x=ctobin(SUBSTR(POINTAPI,1,4),'4rs')
y=ctobin(SUBSTR(POINTAPI,5,4),'4rs')
网上抄的

[此贴子已经被作者于2025-1-2 10:39编辑过]

#3
kmyz_yyl2025-01-02 15:22
改了一下 X,Y的定义就OK
1