Archived

This topic is now archived and is closed to further replies.

Deathscythe

Question about DXversion checking

Recommended Posts

Deathscythe    139
2 Questions: 1)When I create a DX application, I want it to check the current verision of DX is installed on the machine. Is there someway I could do somethink like:
  
if(DXversion < 8.1)
{
MessageBox(NULL, "Older version of Direct X detected, Exiting...", "Warning:", MB_OK | MB_ICONEXCLEMATION);
ExitCode...;
}
else
continue...;
  
2) Also, is there some way to check if another copy of the same application is running so I can say:
  
if(/*Another copy of same program is running*/)
{
MessageBox(NULL, "You already have this program running. Exiting...", "Warning:", MB_OK | MB_ICONEXCLEMATION);
ExitCode...;
}
else
continue...;
  
Thanks in advance!

Share this post


Link to post
Share on other sites
Laurent    100
You have the source code of GetDXVersion in the SDK.

For the single instance :

static inline bool InstanceRunning ( )
{
HANDLE hMutex = CreateMutex(NULL, false, "My_Unique_Mutex_Name");

if ( hMutex)
{
DWORD dwWait = WaitForSingleObject( hMutex, 10 ) ;

switch ( dwWait )
{
case WAIT_OBJECT_0:
break;
case WAIT_TIMEOUT:
return true;
case WAIT_FAILED:
break;
}
}

return false;
}



Laurent - http://www.lafaqmfc.com/
My little game: http://www.lafaqmfc.com/home/play_starshooter.htm

Share this post


Link to post
Share on other sites