|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A Service in VB.NET 2005 using a form ?I have created a Service with vb.NET 2005 and I want to show a form. How can I do this? Can I do it like this? Or should'nt I use a form in a service at all? Private oMain As Main Protected Overrides Sub OnStart(ByVal args() As String) ' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge ' ausführen, damit der Dienst gestartet werden kann. Try oMain = New Main oMain.Show() Catch ex As Exception MsgBox(ex.ToString) End Try End Sub If I do so then the form is shown but it say "No response". Thanks in advance Kind regards Stefan Hi
>From what I understand you shouldn't have any UI elements in your service as a service can run irrespective of whether a user is loggedon or not and runs under a system process etc. (could be wrong though). If you just want the user to be able to interact with your service (changing settings, start/stop the service etc) then take a look at the following article that should help. http://www.devcity.net/Articles/74/1/servicecontroller.aspx Thanks Martin hex40 wrote: Show quoteHide quote > Hi, > > I have created a Service with vb.NET 2005 and I want to show a form. How can > I do this? Can I do it like this? Or should'nt I use a form in a service at > all? > > Private oMain As Main > > Protected Overrides Sub OnStart(ByVal args() As String) > ' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte > Vorgänge > ' ausführen, damit der Dienst gestartet werden kann. > > Try > oMain = New Main > oMain.Show() > Catch ex As Exception > MsgBox(ex.ToString) > End Try > End Sub > > If I do so then the form is shown but it say "No response". > > Thanks in advance > > Kind regards > > Stefan IN VB6 I wrote an exe having several forms. You could run this Program as a
service If you used a ntsvc.ocx. In the property page of the service you had to say that the service runs under the local system account and that it interacts with the desktop. My Service in VB.NET logs on an ftp Server and processes documents. And I want to show the ftp communication in a form and also what the actual batch is that is uploaded etc. If I have to write a service without UI then I should write another program that interacts with my service. How can I manage this? .NET Remoting? I can't find a simple exmaple for that technique! Thanks in advance Stefan "Pritcham" schrieb: Show quoteHide quote > Hi > > >From what I understand you shouldn't have any UI elements in your > service as a service can run irrespective of whether a user is logged > on or not and runs under a system process etc. (could be wrong though). > If you just want the user to be able to interact with your service > (changing settings, start/stop the service etc) then take a look at the > following article that should help. > > http://www.devcity.net/Articles/74/1/servicecontroller.aspx > > > Thanks > Martin > hex40 wrote: > > Hi, > > > > I have created a Service with vb.NET 2005 and I want to show a form. How can > > I do this? Can I do it like this? Or should'nt I use a form in a service at > > all? > > > > Private oMain As Main > > > > Protected Overrides Sub OnStart(ByVal args() As String) > > ' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte > > Vorgänge > > ' ausführen, damit der Dienst gestartet werden kann. > > > > Try > > oMain = New Main > > oMain.Show() > > Catch ex As Exception > > MsgBox(ex.ToString) > > End Try > > End Sub > > > > If I do so then the form is shown but it say "No response". > > > > Thanks in advance > > > > Kind regards > > > > Stefan > > Hi
>From what I understand you can mark a service as interacting with the desktop from the Services control panel - not sure how you would dothis via code. As for how you could/would have another program to interact with your service, this is detailed in the link I suggested (which uses IIS as its example service). Again, I'm not overly familiar with service programming so all of this is info I've gleaned recently while looking at whether creating a service was the right thing for me (which it wasn't in the end) but if you need to interact with your service then you can issue custom commands to your service for it to perform whatever actions you need it to. Sorry I can't be of more help Martin hex40 wrote: Show quoteHide quote > IN VB6 I wrote an exe having several forms. You could run this Program as a > service If you used a ntsvc.ocx. In the property page of the service you had > to say that the service runs under the local system account and that it > interacts with the desktop. > My Service in VB.NET logs on an ftp Server and processes documents. And I > want to show the ftp communication in a form and also what the actual batch > is that is uploaded etc. If I have to write a service without UI then I > should write another program that interacts with my service. How can I manage > this? .NET Remoting? I can't find a simple exmaple for that technique! > > Thanks in advance > > Stefan > > "Pritcham" schrieb: > > > Hi > > > > >From what I understand you shouldn't have any UI elements in your > > service as a service can run irrespective of whether a user is logged > > on or not and runs under a system process etc. (could be wrong though). > > If you just want the user to be able to interact with your service > > (changing settings, start/stop the service etc) then take a look at the > > following article that should help. > > > > http://www.devcity.net/Articles/74/1/servicecontroller.aspx > > > > > > Thanks > > Martin > > hex40 wrote: > > > Hi, > > > > > > I have created a Service with vb.NET 2005 and I want to show a form. How can > > > I do this? Can I do it like this? Or should'nt I use a form in a service at > > > all? > > > > > > Private oMain As Main > > > > > > Protected Overrides Sub OnStart(ByVal args() As String) > > > ' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte > > > Vorgänge > > > ' ausführen, damit der Dienst gestartet werden kann. > > > > > > Try > > > oMain = New Main > > > oMain.Show() > > > Catch ex As Exception > > > MsgBox(ex.ToString) > > > End Try > > > End Sub > > > > > > If I do so then the form is shown but it say "No response". > > > > > > Thanks in advance > > > > > > Kind regards > > > > > > Stefan > > > > hex40 wrote:
> IN VB6 I wrote an exe having several forms. You could run this Program as a You can do the same with a service created in VB.Net. But it is not> service If you used a ntsvc.ocx. In the property page of the service you had > to say that the service runs under the local system account and that it > interacts with the desktop. recommended. I also read that in Windows Vista, coming out Q1 next year, that services will no longer be able to interact with the desktop. If you will be upgrading to Vista any time soon, you might have troubles with your service. I'm not 100% sure on this last point, however. > My Service in VB.NET logs on an ftp Server and processes documents. And I I believe that is the recommended approach. You might also be able to> want to show the ftp communication in a form and also what the actual batch > is that is uploaded etc. If I have to write a service without UI then I > should write another program that interacts with my service. How can I manage > this? .NET Remoting? I can't find a simple exmaple for that technique! use named pipes to have your UI program communicate with your service. I don't have an example handy, but you should be able to Google one up, though.
Concurrency violation at update
How to use this service ??? WSDL available Writing text to file How to dynamically instantiate a base calss (w/ args to constructor?) Listview deselect all Date/Time problem do event VB6 to VB.Net ActiveX Document DLL (VBD) Inquiry... No equivalent control rgb colors in vb.net |
|||||||||||||||||||||||