Problem with FindWindow in A Service (Vista SP1)
Posted on 2009-05-03
Here is my Delphi code:
procedure SendMessageToWindow(msg: LongWord;value:longword=0);
var Wnd: THandle;
Wnd := FindWindow('myClass', NIL);
if Wnd > 0 then
if IsWindowResponding(Wnd,100) then
It searches for the handle of a window and sends a message to that window.
The code works when used in an normal application (both in xp and vista).
The code works when used in a service application running windows xp.
The code does NOT work when used in a service application running vista (handle is always = 0).
Apparently Vista restricts Services so they cannot use the FindWindow api function anymore.
Is there a way around this? If not, which other (simple) way to send messages to an application from a service (so the app can go to front etc).
Thanks in advance.