🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.python
Article #52

Re: win32ui.GetActiveWindow() problem

#52
From: Michal Bozon
Date: Wed, 15 Mar 2000 00:00
61 lines
2485 bytes
 On Tue, 14 Mar 2000, Robin Becker wrote:
 
 > 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
 > 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
 > 
 > 
 
 I have tried exactly this also, but win32ui returns NameError. There is no
 method named GetForegroundWindow. There is only SteForegroundWindow (maybe
 even only in win32gui module.) 
 I use Pythonwin build 125 that I think is newest.
 
 Michal Bozon
 
 
Technical Details
Message-ID: <Pine.OSF.4.10.10003151652400.19621-100000@prfdec.natur.cuni.cz>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <Pine.OSF.4.10.10003151635520.23337-100000@prfdec.natur.cuni.cz>

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: Michal Bozon <bozon@natur.cuni.cz>
Subject: Re: win32ui.GetActiveWindow() problem
Date: 2000/03/15
Message-ID: <Pine.OSF.4.10.10003151652400.19621-100000@prfdec.natur.cuni.cz>
X-Deja-AN: 597846167
X-NNTP-Posting-Host: prfdec.natur.cuni.cz
References: <Pine.OSF.4.10.10003151635520.23337-100000@prfdec.natur.cuni.cz>
Content-Type: text/plain; charset=us-ascii
X-Trace: 15 Mar 2000 16:54:51 +0100, prfdec.natur.cuni.cz
Organization: Ceske Vysoke Uceni Technicke, Praha
MIME-Version: 1.0
Newsgroups: comp.lang.python,cz.comp.lang.python