Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use FindWindow() from a service application?

Tags:

winapi

delphi

I need to communicate a service application with vcl application. My old application was a console and console communicates without problems with the vcl app. Now I migrate the console app to a srv app. The old communication used FindWindow and SendMessage.

I know I can do the communication btw them using socket or named pipe, BUT, I don't want to change the structure now 'cause it will delay the migration.

Some one knows how I can "fix" it ?

tks

like image 650
Rodrigo Farias Rezino Avatar asked Sep 16 '25 03:09

Rodrigo Farias Rezino


2 Answers

FindWindow won't work from a service in Vista or Win7, because services run in a different desktop than user applications; neither will SendMessage, because you can't get the window handle. This means that you have to use a different means of communication between them if you'll be supporting these versions of the OS.

like image 106
Ken White Avatar answered Sep 17 '25 18:09

Ken White


Would ControlService work in place of SendMessage? I think you should be able to pass it your existing structure.

http://www.delphigroups.info/3/10/156645.html

like image 28
nullforce Avatar answered Sep 17 '25 20:09

nullforce