Recent

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

BlueWings

  • Newbie
  • 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: 1927
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

  • Hero Member
  • *****
  • Posts: 532
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 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

 

TinyPortal © 2005-2018