Rodrigo Farias Rezino
Rodrigo Farias Rezino

Reputation: 2799

How to use FindWindow() from a service application?

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

Upvotes: 4

Views: 2721

Answers (3)

David Heffernan
David Heffernan

Reputation: 612794

You can't fix it. Services now run in a different session and without access to the user's desktop. The solution is a named pipe.

Upvotes: 1

nullforce
nullforce

Reputation: 1151

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

Upvotes: 1

Ken White
Ken White

Reputation: 125620

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.

Upvotes: 9

Related Questions