CreateProcess LPCWSTR^^
-
hiho hab dan problem, welches bei anderen wohl nicht auftritt komischerweise.
STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); if(!CreateProcess("C:\\Windows\\system32\\cmd.exe", "pro2.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) ) { cout<<"CreateProcess failed "<<GetLastError()<<endl; return 1; }
und kommt folgendes vom visualstudio2005:
error C2664: 'CreateProcessW' : cannot convert parameter 1 from 'const char [28]' to 'LPCWSTR'
wäre über schnelle hilfe dankbar. muss morgen praktikum abgeben und kriegs net hin*g
-
Schließ mal die beiden String-Literale in '_T(...)' ein (und lies dir in der MSDN das Kapitel über 'UNICODE' durch, um zu verstehen, was das soll).
-
oki danke habs verstanden
-
Zum Parameter 'lpCommandLine':
The Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.
-
Dieser Thread wurde von Moderator/in HumeSikkins aus dem Forum C++ in das Forum WinAPI verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.