Thanks for all the responses; here's a couple things I came up with as a result:
1) Link as a GUI program but try and use an existing console:
if (AttachConsole(ATTACH_PARENT_PROCESS))
{
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
Caveats: The output doesn't look normal since you're sharing the console with
the command interpreter (like if you had started your program in UNIX as a
background process). Also requires Windows XP.
2) Link as a console program but destroy the console if you're the only one
using it (ie., no command interpreter):
DWORD process_list [2];
if (1 == GetConsoleProcessList(process_list, 2))
{
FreeConsole();
}
Caveats: The console is still created and momentarily flashes on the screen.
This might not be as objectionable if the console is set to be hidden as
default?
3) Link both a GUI and console version. Rename the console version to use a
.com suffix instead of an .exe suffix. When the program is invoked from the
command line, the .com version is executed first according to the interpreter
search rules.
Caveats: User confusion over multiple programs?
They all seem a bit ill... I'm thinking of going with either #1 or #3.
Darby
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk