[python-win32] (again) get Window Title encoding

Creative iNFiNiTY roche.maxime at creativeinfinity.fr
Tue Mar 1 12:38:53 CET 2011


Hello,
i wan't to decode the title to utf-8
'mbcs' encoding doesn't help me
sometimes the browser surf on russian, japanese, chinese language
and i couldn't decode if i don't know the encoding.....
thanks for your help

Roche Maxime

Le 28 févr. 2011 à 22:57, Mark Hammond a écrit :

> You might find the 'mbcs' encoding is what you are after?
> 
> Cheers,
> 
> Mark
> 
> On 28/02/2011 11:22 PM, Creative iNFiNiTY wrote:
>> here is some code to get the window title:
>> 
>> hwnd = win32gui.GetForegroundWindow()
>> # we want the desktop window
>> objid = pyAA.Constants.OBJID_WINDOW
>> # get the object
>> ao = pyAA.AccessibleObjectFromWindow(hwnd, objid)
>> pr= ao.GetProcessAndThreadID()
>> processes = win32process.EnumProcesses()
>> for pid in processes:
>> if pid in pr:
>> handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS,False, pid)
>> processactif=win32process.GetModuleFileNameEx(handle, 0)
>> 
>> WindowTitle=ao.Name
>> another code:
>> importwin32gui
>> w=win32gui
>> w.GetWindowText (w.GetForegroundWindow())
>> 
>> *
>> *
>> and i need to get the encoding of the title for internalisation purpose,
>> does anyone know how to get it ?
>> the automatic charset recognition in python ," chardet" don't work for
>> every charset,
>> if i can take it by the process that will be great.
>> Thanks
>> 
>> Roche Maxime
>> Creative iNFiNiTY
>> 
>> 
>> 
>> _______________________________________________
>> python-win32 mailing list
>> python-win32 at python.org
>> http://mail.python.org/mailman/listinfo/python-win32
> 




More information about the python-win32 mailing list