Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62285
| Path | csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mail@timgolden.me.uk> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subject:Windows': 0.02; 'subject:not': 0.03; 'subject:Python': 0.06; 'mouse': 0.07; 'url:msdn': 0.07; 'function:': 0.09; 'key.': 0.09; 'subject:Why': 0.09; 'python': 0.11; 'windows': 0.15; '"your': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'icon': 0.16; 'line).': 0.16; 'message- id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'text",': 0.16; 'tjg': 0.16; 'underlying': 0.16; 'url:85)': 0.16; 'url:windows': 0.16; 'wrote:': 0.18; 'seems': 0.21; '(the': 0.22; 'command': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'dll': 0.24; 'received:192.168.100': 0.24; 'text,': 0.24; 'first,': 0.26; 'task': 0.26; 'second': 0.26; 'pass': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'related': 0.29; 'usually': 0.31; 'ctypes': 0.31; 'text': 0.33; 'there,': 0.34; 'subject:the': 0.34; 'but': 0.35; 'activate': 0.36; 'subject:?': 0.36; 'url:microsoft': 0.37; 'expected': 0.38; 'url:library': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'close': 0.67; 'prompt': 0.68; 'url:en-us': 0.68; 'click': 0.77; 'from:addr:mail': 0.83; 'activated': 0.84; 'handing': 0.84; 'subject:+': 0.91 |
| Date | Wed, 18 Dec 2013 09:05:42 +0000 |
| From | Tim Golden <mail@timgolden.me.uk> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Windows+Python: Why is the first opened window not shown active? |
| References | <52B14248.2010303@gmail.com> |
| In-Reply-To | <52B14248.2010303@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4340.1387357552.18130.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1387357552 news.xs4all.nl 2845 [2001:888:2000:d::a6]:52504 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:62285 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Windows+Python: Why is the first opened window not shown active? Tim Golden <mail@timgolden.me.uk> - 2013-12-18 09:05 +0000
csiph-web