Lazarus

Programming => Operating Systems => Windows CE => Topic started by: BlueWings on July 09, 2010, 03:22:07 pm

Title: How to get window handle from .exe name on WinCE ?
Post by: BlueWings on July 09, 2010, 03:22:07 pm
Hello Anybody,

I wonder the smartest way to get the window handle number for another app created in MS Visual Studio 2008. I know the .exe name, the window title that has nonstandard ASC characters ('Kártyaolvasó'), but not sure about the classname.
FindWindow(nil,'Form1'); returns a number a bit below 2^31, assumably for my own app, but FindWindow(nil,'OtherAppTitle'); gives zero.
Surprisingly, FindWindow(nil,'Power'); also gives a handle, when Control Panel -> Power is open, and this window looks exactly the same as MyOtherApp's window. I'm afraid the Power window which is a builtin Windows component was created neither in Lazarus nor using FreePascal.

Any ideas why I don't get the handle for MSVS2008 App ?

Cheers, Peter
Title: Re: How to get window handle from .exe name on WinCE ?
Post by: theo on July 09, 2010, 03:47:13 pm
I don't know much about it, I'm on Linux.
But since it's a Windows API call, it won't accept UTF-8.

so try either
Findwindow(nil, UTF8Decode(WindowName)) or
Findwindow(nil, UTF8ToSys(WindowName)).

Maybe there are also
FindWindowW (Unicode) and FindWindowA (ANSI) versions
Title: Re: How to get window handle from .exe name on WinCE ?
Post by: mas steindorff on July 09, 2010, 08:22:21 pm
I do not know the answar to your question by I can recomend process explorer from Sysinternals as a tool for this kind of stuff
TinyPortal © 2005-2018