How to Launch a DirectDraw game with ShellExecuteEx?  
Author Message
visitorq





PostPosted: Visual C++ Language, How to Launch a DirectDraw game with ShellExecuteEx? Top

Hi I am trying to launch Age of Empires 2 from within a quick launcher app (VC++ 2005 Express with SDK) using the following code:

SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = "open"
ShExecInfo.lpFile = "path to empires2.exe";
ShExecInfo.lpParameters = NULL;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOWNORMAL;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);

The code runs, and the empires2.exe starts, but then it says "cannot initialize graphics system. Make sure your video card and driver are compatible with DirectDraw."

Please help me correct this problem so the game will run with graphics properly initialized. Thanks a lot!



Visual C++8  
 
 
Alex Farber





PostPosted: Visual C++ Language, How to Launch a DirectDraw game with ShellExecuteEx? Top

How do you run this game without this program Open shortcut which starts the game - maybe you need to add some command line parameters or specify current directory.
 
 
visitorq





PostPosted: Visual C++ Language, How to Launch a DirectDraw game with ShellExecuteEx? Top

You'd just double click empires2.exe without this program. But, when I call empires2.exe with ShellExecuteEx, it won't initialize graphics properly.
 
 
visitorq





PostPosted: Visual C++ Language, How to Launch a DirectDraw game with ShellExecuteEx? Top

Oh, specifying directory did it!! thanks!