From: Vincent T. <vt...@un...> - 2007-05-25 06:06:07
|
On Fri, 25 May 2007, Tor Lillqvist wrote: > Vincent Torri writes: > > I've tried to use CommandLineToArgvW in a simple program : > > > int argc = 0; > > LPWSTR *argv; > > > > argv = CommandLineToArgvW ((LPCWSTR )lpCmdLine, &argc); > > printf ("%d **%s**\n", argc, (char *)argv[0]); > > That is not a complete program. If you want us to ponder what might be > your problem, please provide a *complete* sample program, Here it is: #include <stdio.h> #include <windows.h> int APIENTRY WinMain (HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int argc = 0; LPWSTR *argv; argv = CommandLineToArgvW ((LPCWSTR )lpCmdLine, &argc); printf ("%d **%s**\n", argc, (char *)argv[0]); return 0; } > including > the command line you use to compile it. gcc -g -Wall -o test3 test3.c -lshell32 Is the problem being the fact that I use the lpCmdLine parameter which is not a LPCWSTR ? The fact that argc is not 2 (it seems that in that case, the name of the prog is not included in argv, see: http://msdn2.microsoft.com/en-us/library/ms683156.aspx) Actually, I would use the standard C main function, which would solve all my problems, but I create a window and I would need an HINSTANCE for it. I don't know how to create such variable. Vincent Torri |