Re: Question on project type to use (VS2005)
"Ronald Raygun" wrote:
I want to create a C++ windows executable (exe file). However,
it will have the following attributes:
1). Run as a 'daemon', - i.e. it will have no window (or atleast
the window will not be visible)
2). It will instantiate and use an ATL COM object
You can create a regular Windows application (with `WinMain') and
do what you need, just don't show any window. That's all. However,
you should think out how to exit this windowless program. Usually
I do following:
1. Make regular Windows application with message-only main window.
Look for `HWND_MESSAGE' in MSDN.
2. Assign unique title to the main window. GUID string will do,
for example.
3. Run the application and do whatever it is designed to do. You
may start an additional worker thread in order to perform main
tasks, while checking from time to time close requests.
4. If the application is strated with special command switch (say,
/quit), then try to find your special window (with
`FindWindowEx'). If found, then post it `WM_CLOSE' message, then
exit.
5. In window procedure in response to `WM_CLOSE' message rise an
exit flag (or indicate close request by other means), so worker
thread will exit, too.
That's the simplest scheme to make an invisible application with
possibility of exit on user request.
If you don't need that possibility, then just create Windows
executable (i.e, with `WinMain' and subsystem: Windows) and
proceed as usual for console application.
HTH
Alex