[python-win32] Simulating a mouse click - lParam

Rickey, Kyle W Kyle.Rickey at bakerhughes.com
Fri Dec 5 21:43:14 CET 2008


Let's say I've got a window for which I want to simulate a mouse click
at a specific x, y coordinate. I already have the hwnd but I'm not sure
how to construct the lParam. I've used SendMessage in the past to click
on buttons, etc., but I knew their hwnds. How do I construct the lParam.
Per the MSDN docs:

 

http://msdn.microsoft.com/en-us/library/ms645607(VS.85).aspx

lParam

The low-order word specifies the x-coordinate of the cursor. The
coordinate is relative to the upper-left corner of the client area. 

The high-order word specifies the y-coordinate of the cursor. The
coordinate is relative to the upper-left corner of the client area. 

 

 

 

lParam = ???

win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, 0, lParam)

win32gui.SendMessage(hwnd, win32con.WM_LBUTTONUP, 0, lParam)

 

 

Any help would be greatly appreciated. I also can't help but wonder if
I'm going about this the wrong way. My end goal is clicking on a certain
Tab in a TabCtrl (in this case _wx_SysTabCtl32). I used EnumChildWindows
to find all the main window's children, but couldn't find the tabs. So
figured I would try to 'click' on the tab.

 

-Kyle Rickey 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20081205/2f58bba5/attachment-0001.htm>


More information about the python-win32 mailing list