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

Mark Hammond skippy.hammond at gmail.com
Mon Feb 28 22:57:56 CET 2011


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