Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dialog in exe format, do something when mouse position...
#1
If I have the below code compiled to .exe, what (and how) do I need to add if I want activate notepad when the mousepointer within a certain position.

In other words the hotspot (black rectangle is screen, red mark is against the top of screen and outside qm dialog area):
[Image: hotspot_example.jpg]

I want to add code in the below dialog, so that when the mouspointer is within 300-900 it will activate notepad.

Function hotspot_example
Code:
Copy      Help
;\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x80000840 0x90 0 0 385 11 "DlgMenu"
;3 Button 0x54032000 0x0 0 0 48 11 "Button1"
;4 Button 0x54032000 0x0 48 0 48 11 "Button2"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Regarding:WM_MOUSEMOVE
I read here:
When the mouse is over something on the dialog

For most controls, WM_MOUSEMOVE is sent to the control, not to the dialog.

Does this mean that WM_MOUSEMOVE can only be used within dialog area?
(triggering code on mousemove when pointer moves within dialog/control)

Regarding: TrackMouseEvent
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
Code:
Copy      Help
BOOL WINAPI TrackMouseEvent(
  _Inout_  LPTRACKMOUSEEVENT lpEventTrack
);


Quote:The mouse pointer is considered to be hovering when it stays within a specified rectangle
for a specified period of time. Call SystemParametersInfo. and use the values
SPI_GETMOUSEHOVERWIDTH, SPI_GETMOUSEHOVERHEIGHT, and SPI_GETMOUSEHOVERTIME to
retrieve the size of the rectangle and the time.

I have no idea how to approach this, an example (if possible) would be really appreciated.
#2
WM_MOUSEMOVE - within dialog client area, not including controls.

Use timer or hook.

Function hotspot_example
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x80000840 0x90 0 0 385 11 "DlgMenu"
;3 Button 0x54032000 0x0 0 0 48 11 "Button1"
;4 Button 0x54032000 0x0 48 0 48 11 "Button2"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,RECT- t_r; SetRect &t_r 300 0 900 10
,int- t_inRect
,SetTimer hDlg 1 50 0
,
,case WM_TIMER
,sel wParam
,,case 1
,,POINT p; xm p
,,int inRect=PtInRect(&t_r p.x p.y)
,,if(inRect=t_inRect) ret
,,t_inRect=inRect
,,if(inRect) out "run notepad"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#3
Thank you this works!!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)