Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62285 > unrolled thread
| Started by | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| First post | 2013-12-18 09:05 +0000 |
| Last post | 2013-12-18 09:05 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Windows+Python: Why is the first opened window not shown active? Tim Golden <mail@timgolden.me.uk> - 2013-12-18 09:05 +0000
| From | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| Date | 2013-12-18 09:05 +0000 |
| Subject | Re: Windows+Python: Why is the first opened window not shown active? |
| Message-ID | <mailman.4340.1387357552.18130.python-list@python.org> |
On 18/12/2013 06:35, asmwarrior wrote: > 1. start a Python command line prompt(this is usually to hit the Start > Menu->Python 2.7->Python(command line). > 2. > > type the following text, and hit Enter key. > > |import ctypes| > > 3. > > type the following text, and hit Enter key. > > |ctypes.windll.user32.MessageBoxA(0, "Your text", "Your title", 1)| > > 4. You will see a message box opened, but this message box window is > not activated. > 5. Use the mouse to click on the icon of the message box in task bar to > activate the message box > 6. Close the message box > 7. > > type the text again in the Python prompt shell > > |ctypes.windll.user32.MessageBoxA(0, "Your text", "Your title", 1)| > > 8. Now, the message box is showed activated (the expected behavior) This isn't related to Python specifically: ctypes is just handing the values you pass straight on to the underlying DLL (here: user32.dll). If you check the MSDN page for the MessageBox function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx you can see there's a MB_SETFOREGROUND flag with value 0x00010000L which seems to do what you want. Why the Message box is activated the second time when it isn't the first, I have no idea. But it's Windows which is deciding what to do there, not Python. TJG
Back to top | Article view | comp.lang.python
csiph-web