[python-win32] Simulating a mouse click - lParam

Rickey, Kyle W Kyle.Rickey at bakerhughes.com
Mon Dec 8 18:28:07 CET 2008


I tried using the InvalidateRect but it had not effect. Below is the
code I used.

TCM_SETCURSEL = 0x130C
win32gui.SendMessage(hwnd, TCM_SETCURSEL, 3, 0)
win32gui.InvalidateRect(hwnd, None, True)

I'm thinking I need to send the TCN_SELCHANGE message to the window, but
I don't know how to do that. From googling I find out I need to use
WM_NOTIFY and here's what I've got so far:

win32gui.SendMessage(hwnd, win32con.WM_NOTIFY, 

I'm having trouble finding the value for TCN_SELCHANGE as it's not
wrapped in win32con nor is it defined on the msdn website. How
frustrating...
http://msdn.microsoft.com/en-us/library/bb760569(VS.85).aspx

I also don't understand how to construct the final parameter for
TCN_SELCHANGE. Thanks again for the help.

-Kyle Rickey

-----Original Message-----
From: python-win32-bounces+kyle.rickey=bakerhughes.com at python.org
[mailto:python-win32-bounces+kyle.rickey=bakerhughes.com at python.org] On
Behalf Of Tim Roberts
Sent: Friday, December 05, 2008 6:34 PM
To: Python-Win32 List
Subject: Re: [python-win32] Simulating a mouse click - lParam

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.

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


More information about the python-win32 mailing list