[python-win32] The program passes on Win7 but fails on Win8

Tim Roberts timr at probo.com
Wed Jan 2 18:33:07 CET 2013


震坤 蔡 wrote:
>
> I wrote the following program. It could not pass on Win8, but it can
> pass on Win7.
> It will try to simulate the action to click the Next button on an
> existing dialog (I use JDK installation dialog).
> I believe the issue comes from the statement
> 'win32gui.SendMessage(win32gui.GetParent(hButton),
> win32con.WM_COMMAND, win32con.BN_CLICKED, hButton)'.

Your call is incorrect.  The WPARAM for BN_CLICKED is supposed to have
the button's control ID in the low word, and the notification code in
the high word.  So, you should have:

    win32gui.SendMessage( win32gui.GetParent(hButton, win32con.WM_COMMAND,
        (win32con.BN_CLICKED << 16) | win32gui.GetDlgCtrlID(hButton),
hButton );

What DOES happen on Win 8?  Does it simply do nothing?  Does the app
crash?  Do you see valid handles for both the hWindow and the hButton? 
Are you sure the dialog has the same structure in Win 8 that it did in
Win 7?

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



More information about the python-win32 mailing list