win32ui.GetActiveWindow() problem

Michal Bozon bozon at natur.cuni.cz
Wed Mar 15 16:54:41 CET 2000


 On Tue, 14 Mar 2000, Robin Becker wrote:
 
 > In article <Gkdz4.9356$vW.26052 at news-server.bigpond.net.au>, Mark Hammond
 > <mhammond at skippinet.com.au> writes
 > >
 > >"Michal Bozon" <bozon at natur.cuni.cz> wrote in message
 > >news:Pine.OSF.4.10.10003131737550.6506-100000 at 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
 
 




More information about the Python-list mailing list