[pywin32-bugs] [ pywin32-Bugs-3598993 ] The program passes on Win7 but fails on Win8
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2012-12-31 09:38:14
|
Bugs item #3598993, was opened at 2012-12-31 01:38 Message generated for change (Tracker Item Submitted) made by caizhenkun You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3598993&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: pythonwin Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: caizhenkun (caizhenkun) Assigned to: Nobody/Anonymous (nobody) Summary: The program passes on Win7 but fails on Win8 Initial Comment: Hi, Sir. 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 a 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)'. import win32gui import win32con import win32api 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" However, I wrote another program to validate the SendMessage function. It will try to add some texts into an existing notepad program. But it can get passed on both Win7 and Win8. print "abc" hWindow2 = win32gui.FindWindow('Notepad', None) if hWindow2 <> 0: print hWindow2 hEdit = win32gui.FindWindowEx(hWindow2, 0, 'Edit', None) if hEdit <> 0: print hEdit win32gui.SendMessage(hEdit, win32con.WM_SETTEXT, None, 'hello, czk') else: print "ghi" else: print "def" So I wonder whether it is caused by the reason that win32gui.SendMessage only partially supports Win8? As in my examples, you can see win32gui.SendMessage with parameter win32con.WM_SETTEXT is OK while with parameters win32con.WM_COMMAND and win32con.BN_CLICKED are not supporting win8. It's only my guessing. If you found I had typed some code wrong, please help to point out. Thanks ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3598993&group_id=78018 |