[VB.NET 2005]form from service

S

Szafranr

Hi everyone,

I have NT service from which I try to display window form.
This form is created in sub New.
In servise I implemented OnCustomCommand handle, when I wait for command 129
and for this command I try to do form.Show() but I can't see this window :-(
I checked by filelog - form_load is running after send command.

Is possible to display window by that way?
If yes please tell me how.
Or maybe somebody has another idea for this problem

Regards
Szafranr
 
A

Alex Clark

Hi,

I feel I should point out that it's very bad practice to do this anyway, and
in future versions of Windows (or potentially even service packs) Microsoft
may well prevent this behaviour. Having a service with any kind of GUI is a
big security hole, as that form essentially has all the privileges of the
user account the service is configured to run as - potentially SYSTEM, which
has more powers than even the Administrator.

My advice would be to partition your solution into two projects - one
service, one forms app. Have the forms app interact with the service using
remoting. Much safer :)

Regards,
Alex
 
R

Ray Cassick \(Home\)

Agreed.

Alex Clark said:
Hi,

I feel I should point out that it's very bad practice to do this anyway,
and in future versions of Windows (or potentially even service packs)
Microsoft may well prevent this behaviour. Having a service with any kind
of GUI is a big security hole, as that form essentially has all the
privileges of the user account the service is configured to run as -
potentially SYSTEM, which has more powers than even the Administrator.

My advice would be to partition your solution into two projects - one
service, one forms app. Have the forms app interact with the service
using remoting. Much safer :)

Regards,
Alex
 
S

Szafranr

My advice would be to partition your solution into two projects - one
service, one forms app. Have the forms app interact with the service
using remoting. Much safer :)

I want to have access to event of my service this is why I think about form
from service.
How can I get access to service event by external form with use of remoting
technic?
(I don't use this never before)

Regards
Szafranr
 
R

Ray Cassick \(Home\)

Do you mean that you want to be able to show service state somehow? Like
running, or stopping?

Try building a separate application that sits in the system tray and
monitors the service state using the local SCM interface.

Something like the service control manager form SQL server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top