I’m trying to launch capture.exe that takes a picture with my mobile device’s camera when the user presses a button. When running capture.exe from the file explorer, it works as intended, leaving capture.log and default.jpg in the folder it was run from. When launching the exe through my app, however, the exe doesn’t create default.jpg and capture.log contains:
pPropertyBag->Load( &PropBag, NULL) failed, hr = 80070037
The code I’m using to launch the exe is:
CreateProcess(L"\\MyPath\\capture.exe", NULL, NULL, NULL, FALSE, NULL, NULL, NULL, NULL, NULL)
I have also tried passing the path as the 1st command line parameter, as well as an empty string, but for whatever reason capture.exe fails to run correctly when called programmatically.
I doubt that Explorer is using CreateProcess, it’s probably using ShellExecuteEx, which can sometimes give different behaviors. It’s definitely worth trying, as it’s the only difference I can think of offhand.