Starting program from Service in VB.net

  • Thread starter Thread starter kemp100
  • Start date Start date
K

kemp100

guys..i am having a hard time with this one..

i have created a service which works fine..except when i want to
execute another program (notepad.exe)...i know how to execute itusing
PROCESS.start()

but the problem is ..i dont see it on the desktop..it is not
interacting with the desktop...i know how to change it in the admin
options but i need to know how to do it in the CODE...to have it run
the service and run notepad.exe on the desktop...or any other .exe
file.


please help
 
i have created a service which works fine..except when i want to
execute another program (notepad.exe)...i know how to execute itusing
PROCESS.start()

OK, this is a longshot, and off the top of my head, but if you are in
control of the code for both the service and the application that you want
to launch, you could write the application to get a reference to the running
service and pass it a reference to itself: (but I don't remember if VB.NET
still has GetObject)

Dim serviceObject As Whatever = GetObject("MyService.SomeClass")

serviceObject.AppToLaunch = Me

And then let the service not *launch the app*, but have the app launch
silently, and the service can do something like this:

Private _appToLaunch As Object

....

' in some code that decides to launch it
CType(_appToLaunch, SomeSpecificType).Visible = True

There are some other notes on why you experience this problem in my response
to the "Shell Problems" thread. I mentioned ASP.NET and COM+, but I think
it's fair to guess that services behave the same way.
 
Back
Top