If I have a number of random applications open, move the mouse cursor
to a given position and do a click, the application gets the focus.
That is what this simple code should illustrate:
Dim pt As Point
Dim wnd As IntPtr
Const WM_LBUTTONUP = &H202 '//LButton up
Const WM_LBUTTONDOWN = &H201 '//LButton down
pt.X = 450
pt.Y = 200
Windows.Forms.C ursor.Position = pt
wnd = WindowFromPoint (pt.X, pt.Y)
Call SendMessage(wnd , WM_LBUTTONDOWN, 0, 0&)
Call SendMessage(wnd , WM_LBUTTONUP, 0, 0&)
It moves the cursor, but the application beneith doesn't get focus, as
it would had i clicked on that position manually. What am I missing
out on?
Regards /Snedker
to a given position and do a click, the application gets the focus.
That is what this simple code should illustrate:
Dim pt As Point
Dim wnd As IntPtr
Const WM_LBUTTONUP = &H202 '//LButton up
Const WM_LBUTTONDOWN = &H201 '//LButton down
pt.X = 450
pt.Y = 200
Windows.Forms.C ursor.Position = pt
wnd = WindowFromPoint (pt.X, pt.Y)
Call SendMessage(wnd , WM_LBUTTONDOWN, 0, 0&)
Call SendMessage(wnd , WM_LBUTTONUP, 0, 0&)
It moves the cursor, but the application beneith doesn't get focus, as
it would had i clicked on that position manually. What am I missing
out on?
Regards /Snedker
Comment