Recent

Author Topic: How to get window handle from .exe name on WinCE ?  (Read 9664 times)

BlueWings

  • New member
  • *
  • Posts: 5
How to get window handle from .exe name on WinCE ?
« 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

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1890
Re: How to get window handle from .exe name on WinCE ?
« Reply #1 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

mas steindorff

  • Sr. Member
  • ****
  • Posts: 428
Re: How to get window handle from .exe name on WinCE ?
« Reply #2 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
windows 7/10 - laz 2.0 / 1.2.6 general releases