OK, I copied the Shellexecute() version and I get this error:
fatal error C1010: unexpected end of file while looking for precompiled header directive
# include <windows.h> //You need shell32.lib for this one
char szPath = "C:\\WINDOWS\\system32\\Calc.exe";
HINSTANCE hRet = ShellExecute(
HWND_DESKTOP, //Parent window
"open", //Operation to perform
szPath, //Path to program
NULL, //Default directory
SW_SHOW); //How to open
The function returns a HINSTANCE (not really useful in this case)
So therefore, to test its result, we cast it to a LONG.
Any value over 32 represents success!
if((LONG)hRet <= 32)
MessageBox(HWND_DESKTOP,"Unable to start program","",MB_OK);