The CommandLineToArgvW function parses a wide-character Unicode command-line string. It returns a pointer to a set of wide-character 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 |
// pointer to a variable that receives the argument count |
); |
If the function succeeds, the return value is a non-NULL pointer to the constructed argument list, which is a set of Unicode wide-character argument 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 either the GlobalFree or LocalFree function.