Command Line Parameters

1
2
3
4
void main(int argc, int** argv)
{
   /* ... */
}


argv is an array of agrc pointers of type char* , each representing a character sequence.

1
2
3
4
5
6
int WINAPI WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
);


Now lpCmdLine contains the whole command line...(without the program name itself). Two questions:
1. Why can't WinMain() get an array like main() ?
2. Does lpCmdLine contain the argv[] sequences together with spaces between parameters? In other words, how do I get the parameters from lpCmdLine?
Because Windows works differently than Unix.

Use CommandLineToArgvW()
http://www.google.com/search?btnI=1&q=msdn+CommandLineToArgvW

Good luck!
But I'm not using wide characters... Anyway, I'll just write my own parsing function. Thanks for the help :)
Topic archived. No new replies allowed.