> From: Sergey <sh0...@gmail.com>

>Hello, all
>
>I'm developing windows web service using QtService.
>To debug it, I launch program in VS2005 debugger with -e argument.
>It starts in console mode and handles requests.
>How can I emulate stopping the service, so that all code, which is 
>working usually when windows stops the service?
>
>I want to make web service method, requesing which I would tell service 
>to stop.
>
>void RequestMapper::service(HttpRequest& request, HttpResponse& response) {
>     QByteArray path=request.getPath();
>
>#ifdef _DEBUG
>     if (path.startsWith("/stop")) {
>         //QCoreApplication::instance()->exit(); // this leads to error 
>in  HttpConnectionHandler::run() in line: 
>moveToThread(QCoreApplication::instance()->thread());
>
>How to emulate stopping the service here, so that program, running with 
>-e argument would stop normally, as it stops when running as windows 
>service?
>
>     }
>#endif
>}
>

You'll have to look up the Windows headers you'll need, but you want to use the 
Debug() Win32 function.
It triggers the Debugger to run.
The best way to use it is to call it early in the life of the service so you 
can connect the service with VS in a controlled manner, and then set the break 
point where you want it and continue to run it.


Ben

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to