I'm trying to develop a simple application that will read some files, targeted for Windows CE. For this I'm using Microsoft eMbedded Visual C++ 3. This program(that is for console) will be called like this:
/Storage Card/Test> coms file.cmss
As you can see, file.cmss
is the first argument, but on my main
I have a condition to show the help(the normal, how to use the program) if the arguments are smaller than 2:
int WinMain(int argc,char **argv) {
if(argc < 2) {
showhelp();
return 0;
}
}
But when I execute the program on the command-line of Windows CE(using all the necessary arguments) I got the showHelp()
content. Then I've checked all the code, but it's entirelly correct. But I think that eVC++ don't use argc
and argv[]
for arguments, then I want some help on how to determine the arguments on it.
The 'main' function of a Windows application can take one of a few different forms. There's
WinMain
, there'smain
andwmain
. In your case, you've written a WinMain function that takes classicmain
parameters (i.e.argc
andargv
).I'd recommend that you switch the name of your function to
main
and confirm that your Visual Studio project is correctly configured for the "correct" application entry point.