我試圖使用CreateProcess
爲了運行位於用戶的Program Files目錄中的文件,所以我試圖使用CSIDL_PROGRAM_FILESX86
,因爲該特定的程序將始終在(x86)文件夾。程序文件中的文件的C++創建過程
我的問題是,我不能讓它開始工作,由於某種原因,我無法找到如何使用createprocess
和CSIDL_PROGRAM_FILESX86
你能告訴我這樣的例子任何的例子嗎?也許我應該使用不同的功能?
編輯:
這是我當前的代碼:
wchar_t* localAppData = 0;
SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, 0, NULL, &localAppData);
wstringstream ss;
ss << localAppData << L"/MyApp/MyExe.exe";
CreateProcess(static_cast<void*>(localAppData));
我得到這個爲德SHGetFolderPath
:
cannot convert parameter 5 from wchar_t ** to LPWSTR
而且,即使我包括sstream在標題中,我得到這些錯誤:
'wstringstream' : undeclared identifier
注:我使用的SHGetFolderPath,因爲我需要這在XP和工作Vista/7的
任何想法?
C++並不那麼複雜。 #include並且不推薦使用std :: wstringstream –
nurettin
2012-07-12 13:09:12