windows - C++ createprocess of file in program files -


I am trying to use CreateProcess to run the file located on the user Program file directory, so I am trying to use CSIDL_PROGRAM_FILESX86 , because that specific program will always be in the (x86) folder.

My problem is that I can not get it to work, for some reason I have createprocess and CSIDL PROGRAM_FILESX86

How can I find an example to use Can you direct me to such an example? Maybe I should use a different function?

Edit :

This is my current code:

  wchar_t * localAppData = 0; SHGetFolderPath (NULL, CSIDL_PROGRAM_FILESX86, 0, NULL, and localAppData); Wstringstream SS; SS & lt; & Lt; Local AppData & lt; & Lt; L "/MyApp/MyExe.exe"; CreateProcess (static_cast & lt; zero * & gt; (LOCALAPPDATA));   

I'm getting this for SHGetFolderPath :

wchar_t can not change parameter 5 ** to LPWSTR

In addition, although I have included sstream in the headers, I am getting these errors:

'wstringstream': unverified identifier

Note: I am using SHAgget Folder Path because I need to work on both XP and Vista / 7

Any thoughts? The problem is C style string handling that requires a Windows API:

 
wchar_t localAppData [MAX_PATH]; // array, not an indicator SHGetFolderPath (NULL, CSIDL_PROGRAM_FILES, 0, NULL, localAppData); Std :: wstringstream ss; SS & lt; & Lt; Local AppData & lt; & Lt; L "/MyApp/MyExe.exe"; Create Process (SSSR). C_str (), ...);

In addition, note that only CSIDL_PROGRAM_FILES SHGetFolderPath is supported with.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -