[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...> - 2013-01-01 23:00:17
|
Bugs item #3598993, was opened at 2012-12-31 01:38 Message generated for change (Comment added) made by mhammond 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: Closed >Resolution: Invalid 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 ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2013-01-01 15:00 Message: This is a thin wrapper around the win32 function, so I doubt the failure has anything to do specifically with pywin32. Try emailing the python-win32 list to see if any others have an idea. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2013-01-01 15:00 Message: Thanks for your report, but this tracker is for reporting bugs in pywin32 rather than a support forum. Please email support requests to the python-win32 mailing list where many more people will see your request and be able to help. You need to be subscribed to the list before you can post to it - see http://mail.python.org/mailman/listinfo/python-win32 for subscription options. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3598993&group_id=78018 |