|
-
May 13th, 2011, 10:25 AM
#1
win32 CreateProcess cannot convert parameter 2 from 'char *__w64 ' to 'LPWSTR' error
hello all i have code from open source project that im integrating into my code . now my code settings in visual studio 2008 character set is Unicode . and the external code is Multi-Byte Character Set. when i change the character setting in my application after adding the new source im getting other errors in my code .
so reading from the net i guess i need to make some changes to the external code to support unicode. here is my code :
string FullPathToExe = c:\\foo\\boo.exe;
vector<char> str2(FullPathToExe.begin(), FullPathToExe.end());
str2.push_back('\0');
if (!CreateProcess(NULL,
&str2[0],
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&si,
&pi))
and the error is :
: error C2664: 'CreateProcessW' : cannot convert parameter 2 from 'char *__w64 ' to 'LPWSTR'
the second error is : the code:
CHAR szPrintBuffer[512];
wsprintf(szPrintBuffer,
"ERROR: API = %s.\n error code = %d.\n message = %s.\n",
pszAPI, GetLastError(), (char *)lpvMessageBuffer);
and the error is :
error C2664: 'wsprintfW' : cannot convert parameter 1 from 'CHAR [512]' to 'LPWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
im not win32 programmer and this is new to me. Thanks for helping
c++ winapi Unicode
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|