K
Ken Innes
I am trying to write a little program that can be run as a Windows
program or as a command line program. I'm really not sure the best way
to do this, so what I came up with so far was to check for command
line parameters (code shown below). This works, except that printf()'s
don't display anything. Is there a better way to do this?
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int pszCmdLine)
{
if(ParamStr(5)!="") {
main1(); //command line mode
return(0);
}
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
program or as a command line program. I'm really not sure the best way
to do this, so what I came up with so far was to check for command
line parameters (code shown below). This works, except that printf()'s
don't display anything. Is there a better way to do this?
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int pszCmdLine)
{
if(ParamStr(5)!="") {
main1(); //command line mode
return(0);
}
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}