🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.python
Article #51

Re: win32ui.GetActiveWindow() problem

#51
From: Robin Becker
Date: Tue, 14 Mar 2000 00:00
56 lines
2310 bytes
In article <Gkdz4.9356$vW.26052@news-server.bigpond.net.au>, Mark Hammond
<mhammond@skippinet.com.au> writes
>
>"Michal Bozon" <bozon@natur.cuni.cz> wrote in message
>news:Pine.OSF.4.10.10003131737550.6506-100000@prfdec.natur.cuni.cz...
>> __Hi__ all.
>> If you are not Win9x/2000 user, this won't be probably something for
>you.
>...
>
>> from win32ui import *
>> from time import sleep
>>
>> while 1:
>
>Change this line from:
>>     s = GetActiveWindow().GetWindowName()
>To:
>       s = GetForegroundWindow().GetWindowText()
>
>and you will be right!
>
>Mark.
>
>
>

I tried exactly this and got an error while clicking on my email window

C:\>python \tmp\window.py
PYTHON
PYTHON
PYTHON
PYTHON
PYTHON
PYTHON
PYTHON
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
6.9 time -- Time access and conversions. - Netscape
Traceback (innermost last):
  File "\tmp\window.py", line 5, in ?
    s = GetForegroundWindow().GetWindowText()
win32ui: The window was created in a different thread and can not be mapped.

C:\>

-- 
Robin Becker
Technical Details
Message-ID: <Z8qn4GARIYz4EwB+@jessikat.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <Pine.OSF.4.10.10003131737550.6506-100000@prfdec.natur.cuni.cz> <Gkdz4.9356$vW.26052@news-server.bigpond.net.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fd557,1afca329daabaac3
X-Google-Attributes: gidfd557,public
X-Google-Thread: 10dd18,1afca329daabaac3
X-Google-Attributes: gid10dd18,public
From: Robin Becker <robin@jessikat.demon.co.uk>
Subject: Re: win32ui.GetActiveWindow() problem
Date: 2000/03/14
Message-ID: <Z8qn4GARIYz4EwB+@jessikat.demon.co.uk>
X-Deja-AN: 597246561
X-NNTP-Posting-Host: jessikat.demon.co.uk:194.222.4.163
References: <Pine.OSF.4.10.10003131737550.6506-100000@prfdec.natur.cuni.cz> <Gkdz4.9356$vW.26052@news-server.bigpond.net.au>
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 953019654 nnrp-09:8726 NO-IDENT jessikat.demon.co.uk:194.222.4.163
Organization: Web-Waders Inc
MIME-Version: 1.0
Newsgroups: comp.lang.python,cz.comp.lang.python