Hello,
How is it possible to know when a WM_LBUTTONDOWN occurs, what control has been hit by the mouse cursor ?
My main window (builded with ressources) have a Radasm Image control. I want to know if (when the user press the left mouse button) the mouse cursor have hit the image control.
At that point I don't know what to do next... I've done some try with GetClientRect and GetWindowRect and some other APIs, but it's very confusing for me, between screen/window coordinates and Rect/point structures.
I'm lost :cry:
Thank you very much.
Regards, Neitsa.
How is it possible to know when a WM_LBUTTONDOWN occurs, what control has been hit by the mouse cursor ?
My main window (builded with ressources) have a Radasm Image control. I want to know if (when the user press the left mouse button) the mouse cursor have hit the image control.
.elseif eax==WM_LBUTTONDOWN
; Left button mouse is down
; test to see if cursor is inside the image control
movzx esi,word ptr [lParam]
movzx edi,word ptr [lParam+2]
At that point I don't know what to do next... I've done some try with GetClientRect and GetWindowRect and some other APIs, but it's very confusing for me, between screen/window coordinates and Rect/point structures.
I'm lost :cry:
Thank you very much.
Regards, Neitsa.
hi Neitsa
you can set a new window proc for the Radasm Image control with the SetWindowLong Api call like this :
and handle those messages sended to the control with a new proc like this :
hope this help
regards,
gr33d
you can set a new window proc for the Radasm Image control with the SetWindowLong Api call like this :
OldImageProc dd ?
.....
.elseif eax==WM_CREATE
invoke SetWindowLong,hControl,GWL_WNDPROC,offset ImageProc
mov OldImageProc,eax
.endif
....
and handle those messages sended to the control with a new proc like this :
ImageProc proc hWin:HWND,uMsg:DWORD,wParam:DWORD,lParam:DWORD
mov eax,uMsg
.if eax == WM_LBUTTONDOWN
...... stuff to do
.endif
invoke WindowProc,offset OldImageProc,hWin,uMsg,wParam,lParam
ret
ImageProc endp
hope this help
regards,
gr33d
Damn !
I haven't think about that ! I'm sure it will work, I must say a big thank you Gr33d :D
Btw, I'm also curious, and if someone have an idea about that question, without a new window proc... I'll be glad to ear it !
Anyway, thank you very much Gr33d :)
Regards, Neitsa.
I haven't think about that ! I'm sure it will work, I must say a big thank you Gr33d :D
Btw, I'm also curious, and if someone have an idea about that question, without a new window proc... I'll be glad to ear it !
Anyway, thank you very much Gr33d :)
Regards, Neitsa.
How about this!
local pt:POINT
local rect:RECT
......
.elseif eax==WM_LBUTTONDOWN
invoke GetCursorPos,addr pt
invoke GetWindowRect,hControl,addr rect
invoke PtInRect,addr rect,pt.x,pt.y
.if eax
ur code...
.endif
.endif
humm...
im not shore but the WM_LBUTTONDOWN message is sent to the own window...
if i click on the control, the control will receive the message .... so its gunna be necessary to use the SetWindowLong stuff...
i guess is like that
:)
im not shore but the WM_LBUTTONDOWN message is sent to the own window...
if i click on the control, the control will receive the message .... so its gunna be necessary to use the SetWindowLong stuff...
i guess is like that
:)
Haven't tested yet both of your codes (overload of work :( ) but I'll test it as sooner as I can.
Once it will be tested I'll tell you if it works.
Thank you.
Regards, Neitsa.
Once it will be tested I'll tell you if it works.
Thank you.
Regards, Neitsa.
Hello,
finally I have tried both of your code (reading again the Iczelion tutorial #31) but wasn't able to have a working cursor hit test... :oops: (I think this is my fault, not yours).
Anyway, asking a friend about that problem, is gave me a simple answer :
- just add SS_NOTIFY style to the control
- use STN_CLICKED
Damn it works !
Btw, thanks a lot for your help !
Regards, Neitsa.
finally I have tried both of your code (reading again the Iczelion tutorial #31) but wasn't able to have a working cursor hit test... :oops: (I think this is my fault, not yours).
Anyway, asking a friend about that problem, is gave me a simple answer :
- just add SS_NOTIFY style to the control
- use STN_CLICKED
Damn it works !
.elseif eax==WM_COMMAND
mov eax,wParam
shr eax,16
.if eax==STN_CLICKED
mov eax,wParam
.if ax==IDC_IMG1
;code when the image control is clicked
.endif
.endif
Btw, thanks a lot for your help !
Regards, Neitsa.