William
Mon Apr 26 10:43:20 CDT 2004
"peter walker" <peter@papwalker.com.au.nospam> wrote in message
news:e0Ab1i5KEHA.3472@TK2MSFTNGP09.phx.gbl...
> yes I realise what you say is true..however it's not relevant to what I'm
> asking. I understand about services as I write my own using Delphi (not
C++)
> I can't offer him any worthwhile advise..
>
> I am talking about writing to the console during the installation I know
> some services that use
> servicename /i
If your friend can't write to the console from a service application which
is implemented as a console application and which runs on the interactive
desktop then he needs to find out what _he_ did wrong. :-)
Think about it, until he installs it, it is _not_ a service. If his
application is a console application and if he has not redirected the output
device it should work. Otherwise there would be a hue and cry about broken
consoles.
On the other hand, if your friend has a windowed application (i.e. one that
starts at WinMain() and pumps messages) then his expectations are misplaced.
Windowed applications do not have consoles to serve as sinks for printf().
Unless of course, one creates one with AllocConsole(). If he does this
AllocConsole();
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
then he can replace the handle returned from CreateFile() in my sample with
the handle to the console. At that point printf() will work.
The procedure to do that is documented from on high, here
http://support.microsoft.com/?id=105305
Regards,
Will