[python-win32] Simulating a mouse click - lParam

Tim Roberts timr at probo.com
Sat Dec 6 01:33:44 CET 2008


Rickey, Kyle W wrote:
> Thanks Tim. I used the following to select my tab of interest:
>
> TCM_SETCURSEL = 0x130C
> win32gui.SendMessage(hwnd, TCM_SETCURSEL, 3, 0)
>
> However, according to MSDN:
> http://msdn.microsoft.com/en-us/library/bb760612(VS.85).aspx
> "Remarks
>
>     A tab control does not send a TCN_SELCHANGING or TCN_SELCHANGE
> notification message when a tab is selected using this message."
>
> So of course nothing happens after the tab is selected. Ie, the window
> is not updated to show the different controls etc. And unfortunately,
> the window of interest is a 3rd party app, so I don't have direct access
> to the controls and their methods :(
>   

Assuming you have the top-most window of the app, you should be able to
use FindWindowEx to find the tab control by class name; you shouldn't
have to enumerate for it.  After you send TCM_SETCURSEL, you should be
able to call InvalidateRect to force the window to redraw.

Do you have the Windows SDK installed?  You can use the "spyxx" tool to
explore the window configuration of the app you're examining.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list