CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2005
    Posts
    59

    DirectX Application Dependencies

    Hi, I have an application that I wrote to convert .X files into a format needed for another application. In it I use various DirectX functions such as

    Code:
    LPDIRECT3D9 d3d = NULL;
    HWND hD3DWnd = NULL;
    LPDIRECT3DDEVICE9 device = NULL;
    
    bool CreateD3D9()
    {
    	d3d = Direct3DCreate9( D3D_SDK_VERSION );
    	if (NULL == d3d)
    		return false;
    
    	WNDCLASSEX wcex = {sizeof(WNDCLASSEX)};
    	wcex.lpszClassName	= "dxwind";
    	wcex.lpfnWndProc = DefWindowProc;
    	RegisterClassEx(&wcex);
    
    	HWND hWnd = CreateWindow("dxwind", "", 0, -1,-1,-1,-1, NULL, NULL, 0, 0);
    
    	if (NULL == hWnd)
    		return false;
    
    	D3DPRESENT_PARAMETERS d3dpp = {};
    	d3dpp.hDeviceWindow = hWnd;
    	d3dpp.Windowed = TRUE;
    	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    	d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
    	d3dpp.EnableAutoDepthStencil = TRUE;
    	d3dpp.AutoDepthStencilFormat = D3DFMT_D24X8;
    	d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
    
    	HRESULT hr = d3d->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &device);
    
    	if (FAILED(hr))
    		return false;
    
    	return true;
    }
    The resulting application runs fine on any computer that has the DirectX SDK installed, but failed to initialize the object on an pc without it.

    I am wondering if anyone can point me in the right direction as to what I need to include with the app to enable it to work without people having to install the whole DirectX SDK

    Thanks Andrew

  2. #2
    Join Date
    Dec 2008
    Posts
    49

    Re: DirectX Application Dependencies

    Distribute a release build, which should be linked to the release D3D libraries.

  3. #3
    Join Date
    Aug 2005
    Posts
    59

    Re: DirectX Application Dependencies

    I did. It is linked via the Project properties include and lib directories and I have added the seperate lib files d3dx9.lib and d3d9.lib

    It did not work.

  4. #4
    Join Date
    Dec 2008
    Posts
    29

    Re: DirectX Application Dependencies

    The previous post said compile a "release" build and not "debug" one.

    And also these:

    1- you must install the same version of directX or newest one on the target system.

    2- Depend on your compiler you must install visual C++ runtime library(vcredist_x86),
    for VC++2005 located in :
    Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86

    OR use a installer /VC++ setup
    OR download it from internet
    OR copy those dlls from redist folder of VC

  5. #5
    Join Date
    Aug 2005
    Posts
    59

    Re: DirectX Application Dependencies

    if by release build you mean that the active build is set to release and C++ Config to Multithreaded DLL (/MD) I did that....

    I am using VS 2008

    I had the users do a DirectX update to make sure they had latest build that did no good, if I asked them to install the DirectX SDK then the app works fine.
    Last edited by Mogulbasher; January 4th, 2009 at 03:36 PM.

  6. #6
    Join Date
    Dec 2008
    Posts
    49

    Re: DirectX Application Dependencies

    use D3DDEVTYPE_HAL, not D3DDEVTYPE_REF

  7. #7
    Join Date
    Apr 1999
    Posts
    3,585

    Re: DirectX Application Dependencies

    FYI...you can use the dependency walker to determine what other dlls are required to be distributed with your application.
    Gort...Klaatu, Barada Nikto!

  8. #8
    Join Date
    Aug 2005
    Posts
    59

    Re: DirectX Application Dependencies

    Quote Originally Posted by Retarded View Post
    use D3DDEVTYPE_HAL, not D3DDEVTYPE_REF
    That did the trick... Thanks you very much... Andrew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured