Archived

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

Question about DXversion checking

This topic is 5748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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