Page 2 of 2

Posted: Sat Mar 22, 2008 11:57 pm
by Sickboy
I can compile and install the service without problems but i'm not sure where to place my methods.

I tried it in line 41:

Code: Select all

...
// INIT THE REAL SERVICE HERE AND LET THE MAIN LOOP RUN
while(true)
{
  wxSleep(2);
  ::wxBell();
}
...
But if i start the service, the "Service Startup Dialog" doesn't disappear and the startup timed out after a while with the error 1053.

The same happen if i put the while loop into the int MainApp::OnRun().

I've also removed the SERVICE_INTERACTIVE_PROCESS in the MainApp::Install(void) method, reinstalled the service, without success.

Any idea what i'm doing wrong ?

thx,
Stefan

Posted: Mon Apr 19, 2010 5:33 pm
by evstevemd
priyank_bolia wrote:http://priyank.co.in/downloads/wxWin32Service.7z
Added unicode support...
Disclamatory warning: I had just compiled the above code, haven't tested whether it works on not.
Link is broken, can you fix it?

Re: Running wxWidgets app as a windows service

Posted: Mon Oct 19, 2015 11:22 am
by Gnawer
Great Code!
I was able to create a service that handles socket events.
A last problem I have to solve: an administrator launches Service Control Manager and stops the service.
This event can be catched by "WaitForSingleObject" method, so I read in MSDN.
But I want to catch it by a wx Event handler, same way as socket events.
wxEVT_END_SESSION etc. does not work.
Did anybody make it already?

Re: Running wxWidgets app as a windows service

Posted: Mon Oct 19, 2015 1:36 pm
by evstevemd
If you know how to do it in MSDN way then catch it and create new custom event which you can dispatch it using wxPostEvent

Re: Running wxWidgets app as a windows service

Posted: Mon Oct 19, 2015 2:02 pm
by doublemax
BTW: There was a more recent post about creating a Windows service with wxWidgets.

Maybe it helps: viewtopic.php?f=10&t=41497