views:

154

answers:

2

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.

A: 

The 'main' function of a Windows application can take one of a few different forms. There's WinMain, there's main and wmain. In your case, you've written a WinMain function that takes classic main parameters (i.e. argc and argv).

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.

Reuben
Now I got this: `unresolved external symbol WinMain`.
Nathan Campos
Are you compiling a console application or a Windows GUI application?
Reuben
I've selected WCE Application.
Nathan Campos
I'm not familiar with this particular version of Visual C++, but Visual C++/Studio usually has an option to pick a 'GUI' (a.k.a. Win32) application vs. a 'console' application. Windows GUI applications usually use the WinMain function; if this is what you're required to have, then you'll need to change the parameters of your main function to match the documentation for `WinMain` (i.e. lpCmdLine and others instead of argc/argv).
Reuben
A: 

You need to supply more details about the embedded platform. Embedded platforms vary widely from desktop computers, especially about their resources such as file systems I/O, memory capacity and hardware layout (addressing).

For developing a WinCE application, you must confirm that the platform supports a file system. Many embedded systems don't.

Next, you should research on how WinCE is set up to execute a C function: does it use Windows (WinMain), tmain, wmain or main? Also, you need to research how parameters are passed to the program. Windowing programming is different than "console" programming.

Thomas Matthews