Project

General

Profile

Does a Windows Wt app HAVE to be console mode?

Added by Dave Soane about 7 years ago

Hi,

I've been going a few weeks with Wt, and making steady progress, but now I've hit a problem with not getting destructors called after pressing Shf F5 in VS. SetConsoleCtrlHandler() doesn't work for me, whether I close the app from VS, or from the console window with Ctrl-C or clicking the 'X'.

And it then occurred to me - does the Wt program itself HAVE to be a console application? If it could be a GUI app then not only would I be able to trap the window close event easily, but it could also show useful stats about the program as it's running, and still show the console output in a smaller sub-window.

So is that possible?

Thanks,

Dave.


Replies (1)

RE: Does a Windows Wt app HAVE to be console mode? - Added by Wim Dumon about 7 years ago

Dave,

I don't think there's a reason for Wt not to work in console or GUI mode.

Wt's default implementation grabs termination through ctr-C, see int WServer::waitForShutdown() in src/Wt/WServer.C.

In case you want to use a different mechanism of shutting down a Wt application, your best option is to re-implement the WRun() method, which is not very hard to do. WRun() is a convenience method because the default behaviour should be what most users expect. Its default implementation is in src/http/WServer.C.

Best regards,

Wim.

    (1-1/1)