Launch Windows form, from a Windows Service Application 
Author Message
 Launch Windows form, from a Windows Service Application

Hi, my project consists in a Windows Service application, I'd like to launch
a Windows Form from OnStart event, like this

Protected Overrides Sub OnStart(ByVal args() As String)

' Add code here to start your service. This method should set things

' in motion so your service can do its work.

Try

    Dim frm As New frmOption()

    System.Windows.Forms.Application.Run(frm)

Catch ex As Exception

    Write2Log(ex)

End Try

End Sub

The service starts correctly (I set "Allow service to interact with user",
too) but I don't see the form.

Anybody can help me?

TIA,

Diego



Sun, 20 Nov 2005 15:54:24 GMT  
 Launch Windows form, from a Windows Service Application
Windows services can not open interactive elements, such as forms, msgboxes,
and other elements.  If you want to control the service through a custom
interface you will need to look into Service Controller objects, or use some
type of network communication with sockets.


Quote:
> Hi, my project consists in a Windows Service application, I'd like to
launch
> a Windows Form from OnStart event, like this

> Protected Overrides Sub OnStart(ByVal args() As String)

> ' Add code here to start your service. This method should set things

> ' in motion so your service can do its work.

> Try

>     Dim frm As New frmOption()

>     System.Windows.Forms.Application.Run(frm)

> Catch ex As Exception

>     Write2Log(ex)

> End Try

> End Sub

> The service starts correctly (I set "Allow service to interact with user",
> too) but I don't see the form.

> Anybody can help me?

> TIA,

> Diego



Sun, 20 Nov 2005 23:56:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Launching and Monitoring a 16-bit Windows app from VB5 application running on Windows NT 4.0

2. Launching and Monitoring a 16-bit Windows app from VB5 application running on Windows NT 4.0

3. How to launch Internet Explorer from within VB.NET Windows Forms application

4. Launching Windows 95 applications from your VB application

5. Launching Windows Apps from Service

6. Error 429 launching Outlook in Windows Service

7. Launching windows application from Access 2.0 ?

8. Is it possible to launch a 16Bit Windows application

9. installing web app with windows service and windows aplication at same time

10. Installing windows service in Windows 98,ME

11. Windows scripting host - Checking a service in Windows NT 4

12. write to console from windows service application

 

 
Powered by phpBB® Forum Software