Rickey, Kyle W wrote:
>
> 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
> <http://msdn.microsoft.com/en-us/library/ms645607%28VS.85%29.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.
>

Two ways.  This works as long as both coordinates are positive:
    lParam = (y << 16) | x

The more robust way is like this:
    lParam = struct.unpack( 'L', struct.unpack( 'hh', x, y ) )[0]

However, it would be much better to talk to the tab control directly. 
Are you doing this from inside the owning wx application?  If so, you
should be able to get the tab control object and call the methods
directly.  Even if you can only get the handle, you can use TCM_SETCURSEL.

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to