Game Development Community

ShellAPI.h

by Skylar Kelty · in Torque Game Engine · 12/09/2007 (6:19 am) · 1 replies

Hey,

I would like too use ShellExecute(); in consoleFunctions.cpp but when i go too include shellapi.h I get a few hundred errors ^^

Is there a function anywhere in TGE that allows execution of .exe's?

execlp works for Linux, now I need windows working,

Any ideas? Please? :P

Thanks
--James

#1
12/09/2007 (6:34 am)
Never mind, shoved this in winwindow.cpp:
bool Platform::shellExecute( const char* file, const char* args )
{
   UTF16 a[1024];
   convertUTF8toUTF16((UTF8 *)file, a, sizeof(a));
   UTF16 b[1024];
   convertUTF8toUTF16((UTF8 *)args, b, sizeof(b));

   HINSTANCE result = ShellExecute(0, L"open", a, b, NULL, SW_SHOWNORMAL);
   if ((int)result > 32)
	   return true;
   else
	   return false;
}

Works fine for Windows.

Seems whenever I post something I find the answer a few minutes later ^^