Re: Console-based exe COM server




"Leo" <Leo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C0A15F4F-6F2B-4DED-8E49-91D62DB15278@xxxxxxxxxxxxxxxx

Is it possible to create a console-based exe COM server, as opposed
to a window-based one? Using ATL, if you use the "module" attribute
with a type of "exe" it generates the entry-point for WinMain, not main.

So? That is perfectly fine. Just because a project has a WinMain() entry
point does not mean it has to create any GUI windows. A console project is
still a normal Win32 process, just with a different type of GUI attached to
it.

Is there anything that I can do to ensure that my exe COM server is
console-based with a main entry point, and accepts input parameters
and prints messages to the console (and still registers via /regserver)?

A project with a WinMain() entry point can still receive command-line
parameters, and thus support the "/regserver" parameter. You would simply
have to call GetCommandLine(), and then either parse the string manually or
pass it to CommandLineToArgvW(). As for output, use MessageBox(), or
AllocConsole(), GetStdHandle(), and WriteConsole().

--
Remy Lebeau (TeamB)


.



Relevant Pages

  • Re: Executable enty points incorrectly documented
    ... You wrote that WinMain is not a starting function in CRT, but an user-defined entry point for a Windows application. ... I believe that the fact that this function is called by the C/C++ runtime clearly backs my opinion that WinMain has nothing to do with the operating system. ... Even if WinMain documentation remains in Windows SDK it would be wise to explicitly state that support for this entry point is provided by the C/C++ runtime rather than Windows itself. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Executable enty points incorrectly documented
    ... you are absolutely correct in that main / WinMain have nothing to do ... They are, however, the entry points used by most ... they are found under the Windows Management ... My bigger problem however is that the real entry point signature is not ...
    (microsoft.public.win32.programmer.kernel)
  • Re: active entries in TCL/Tk
    ... > % entry .e1 ... > % pack .e1 ... (at least on Windows), as the "console" window must have focus in ... Since the console has focus, ...
    (comp.lang.tcl)
  • Re: Create a console app under EmbeddedVC4, and debug it
    ... > I compared the settings of this project with that of the console project ... I think there's documentation of the right entry ... >>> and then installed the SDK which has a console and now I can connect to ... So I replaced the WinMain with main, ...
    (microsoft.public.windowsce.embedded)
  • Re: run application
    ... >> Since it's a GUI application, try WinMain() rather than main. ... >> will build it as a Windows application rather than a Console app. ... If they are ActiveX control buttons, ...
    (microsoft.public.vc.language)