Platform SDK: DLLs, Processes, and Threads |
The CommandLineToArgvW function parses a Unicode command-line string. It returns a pointer to a set of Unicode argument strings and a count of arguments, similar to the standard C run-time argv and argc values. The function provides a way to obtain a Unicode set of argv and argc values from a Unicode command-line string.
LPWSTR * CommandLineToArgvW( LPCWSTR lpCmdLine, // pointer to a command-line string int *pNumArgs // receives the argument count );
If this parameter is the empty string, "", the function returns the path to the current executable file.
If the function succeeds, the return value is a non-NULL pointer to the constructed argument list, which is an array of Unicode strings.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
It is the caller's responsibility to free the memory used by the argument list when it is no longer needed. To free the memory, use a single call to the GlobalFree function.
Windows NT/2000: Requires Windows NT 3.5 or later.
Windows 95/98: Unsupported.
Header: Declared in Shellapi.h; include Windows.h.
Library: Use Shell32.lib.
Unicode: Implemented only as Unicode.
Processes and Threads Overview, Process and Thread Functions, GetCommandLine, GlobalFree