Skip to main content

 none
CreateProcessW - lpCommandLine RRS feed

  • Question

  • Hi:

     

    using the win32 api ... I notice that in the unicode version of CreateProcess, CreateProcessW the function call can overwrite the second argument, LPWSTR lpCommandLine

     

    I'm using Visual Studio 2008

     

    I'm told that there is one data type, using VS C++, that lpCommandLine can be declared as that will let the routine dynamically overwrite this string and that the string's length would be dynamically adapted to?

     

    Any hints?

     

    --D'Arcy

    Sunday, May 25, 2008 4:35 PM

Answers

  • LPWSTR means: pointer to a wide-null terminated string of wide-chars.

    LPCWSTR means: (const) pointer to a wide-null terminated string of wide-chars.

     

    The function spec is telling you that you're not allowed to pass a string literal or other const argument to this function (e.g. CreateProcess(NULL, L"foo.exe /b /c /d",...).

    You can copy a string literal or const string into a a non-const WCHAR buffer, and that will work just fine.

    Monday, May 26, 2008 8:18 AM