Users cannot execute my game if they don't have DirectX SDK installed!

Started by
2 comments, last by Benoit Vimont 19 years, 2 months ago
Please help, I'm not new to programming but I am to DirectX. Here is my problem: My program runs fine on any computer that has the directX9.0c SDK installed, but others (that has the standart DX9 installed) cannot run my release. "Could not find required Media. Ensure that DirectX is correctly installed." What are the minimum required files I need to redistribute in order to make my application running on any computer that has DX9.0c isntalled (and *NOT* the SDK) ? Help or link would be grealy appreciated :) thanks.
Advertisement
I'm assuming you're using part of the SDK framework to load textures and/or other resources. Part of the code uses a search path which it retrieves from the registry. While this is great for the SDK samples, it's not something you want in your code. You'll have to hunt that bit of code down and get rid of it.
Stay Casual,KenDrunken Hyena
Thanks for your help DrunkenHyena, I'll try to do that.

I found:

HRESULT DXUTGetDXSDKMediaPathCch( WCHAR* strDest, int cchDest );
HRESULT DXUTFindDXSDKMediaFileCch( WCHAR* strDestPath, int cchDest, LPCWSTR strFilename );

Do you mean I should delete any reference to that fonctions? and send "./" instead?

or only change that part of the code?

HRESULT DXUTGetDXSDKMediaPathCch( WCHAR* strDest, int cchDest )
{
if( strDest == NULL || cchDest < 1 )
return E_INVALIDARG;

lstrcpy( strDest, TEXT("") );

// Open the appropriate registry key
HKEY hKey;
LONG lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
L"Software\\Microsoft\\DirectX SDK",
0, KEY_READ, &hKey );
if( ERROR_SUCCESS != lResult )
return E_FAIL;

DWORD dwType;
DWORD dwSize = cchDest * sizeof(WCHAR);
lResult = RegQueryValueEx( hKey, L"DX9S4SDK Samples Path", NULL,
&dwType, (BYTE*)strDest, &dwSize );
strDest[cchDest-1] = 0; // RegQueryValueEx doesn't NULL term if buffer too small
RegCloseKey( hKey );

if( ERROR_SUCCESS != lResult )
return E_FAIL;

const WCHAR* strMedia = L"\\Media\\";
if( lstrlen(strDest) + lstrlen(strMedia) < cchDest )
wcscat( strDest, strMedia );
else
return E_INVALIDARG;

return S_OK;
}

by

HRESULT DXUTGetDXSDKMediaPathCch( WCHAR* strDest, int cchDest )
{
lstrcpy( strDest, TEXT("") );
return S_OK;
}

Has anyone succesfully made redistribuable version of an .exe from the samples form the dx9.0c SDK? Could you post it or send it to me?

[Edited by - Benoit Vimont on February 15, 2005 12:38:22 PM]
It seems to work now.
Thanks for your help.

(What a reactive forum! You answered me a few minutes after I posted the subject ;)

You can download and test it at :
http://benoit.vimont.club.fr/Projets/Bombersoccer/bin/BomberSoccer_FULL_NOSDK.zip

[Edited by - Benoit Vimont on February 15, 2005 3:34:52 PM]

This topic is closed to new replies.

Advertisement