Originally Posted by
CornedBee
If your entire program uses narrow strings, trying to convert them to wchar_t for the WinAPI's sake is nonsense. Just use ShellExecuteA instead of ShellExecute, and drop the Unicode string stuff.
I am now using ShellExecuteA.
Code:
HINSTANCE hRet = ShellExecuteA(
HWND_DESKTOP, //Parent window
"open", //Operation to perform
"path", //Path to program
NULL, //Parameters
NULL, //Default directory
SW_SHOW); //How to open
if((LONG)hRet <= 32)
{
MessageBox(HWND_DESKTOP,TEXT("Unable to start the Movie"),TEXT(""),MB_OK);
}
IN SHORT THE ABOVE DOESNT WORK BUT THE CODE BELOW WORKS
Code:
HINSTANCE hRet = ShellExecuteA(
HWND_DESKTOP, //Parent window
"open", //Operation to perform
"C:\\Movies\\IceAge.avi", //Path to program
NULL, //Parameters
NULL, //Default directory
SW_SHOW); //How to open
if((LONG)hRet <= 32)
{
MessageBox(HWND_DESKTOP,TEXT("Unable to start the Movie"),TEXT(""),MB_OK);
}
I even printed the char array "path" through cout on the display to see if it really has got the right path in it.Then i even debugged the entire thing.All seems fine
The problem is that ShellExecuteA is failing at opening anything through a variable.Giving it the direct path i.e "C:\\Movies\\Ice Age.avi" works fine but giving the path as a variable doesnt.I am sick and tired of getting the MessageBox "Unable to start the Movie"
*weeps* *weeps* No compiler errors..no linker errors..but the movie wont open.*weeeeps*
Any advice including "go commit suicide" are welcome..just anything