[python-win32] 回复: 回复: The program passes on Win7 but fails on Win8
震坤 蔡
caizhenkun19850809 at yahoo.com.cn
Fri Jan 4 06:43:06 CET 2013
I have changed the third parameter, but it still did not work on Win8.
print "abc"
hWindow = win32gui.FindWindow('MsiDialogCloseClass', None)
if hWindow <> 0:
print hWindow
hButton = win32gui.FindWindowEx(hWindow, 0, 'Button', '&Next >')
if hButton <> 0:
print hButton
win32gui.SendMessage(win32gui.GetParent(hButton), win32con.WM_COMMAND, (win32con.BN_CLICKED << 16) | win32gui.GetDlgCtrlID(hButton), hButton)
else:
print "ghi"
else:
print "def"
Output:
abc
131870
131888
(The tested dialog used is the installation file for JDK 1.6.0_37
jdk-6u37-windows-i586.exe from
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u37-oth-JPR.)
________________________________
发件人: Tim Roberts <timr at probo.com>
收件人: Python-Win32 List <python-win32 at python.org>
发送日期: 2013年1月4日, 星期五, 1:55 上午
主题: Re: [python-win32] 回复: The program passes on Win7 but fails on Win8
震坤 蔡 wrote:
> Thanks for your reply.
> For the program I have written:
> print "abc"
> hWindow = win32gui.FindWindow('MsiDialogCloseClass', None)
> if hWindow <> 0:
> print hWindow
> hButton = win32gui.FindWindowEx(hWindow, 0, 'Button', '&Next >')
> if hButton <> 0:
> print hButton
> win32gui.SendMessage(win32gui.GetParent(hButton), win32con.WM_COMMAND, win32con.BN_CLICKED, hButton)
> else:
> print "ghi"
> else:
> print "def"
> The hWindow and hButton can both be printed out and they are both not 0.
> The application does not crash but the Next button click action is not
> triggered.
No, of course not, because the SendMessage call is still wrong. Did you
even read my reply? The third parameter is wrong.
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20130104/fa2a1690/attachment-0001.html>
More information about the python-win32
mailing list