win32ui.GetActiveWindow() problem

Robin Becker robin at jessikat.demon.co.uk
Mon Mar 13 19:04:33 EST 2000


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
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



More information about the Python-list mailing list