Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Thu, 11 May 2006 15:16:03 -0700,    group: microsoft.public.win32.programmer.directx.sdk        back       


Create Device Problem in MFC application   
Hi!

I am developing a MFC based DirectX application. In the initialization, the 
code cannot create device.
I do not know what the problem is. I am enclosing the part of the code 
below. Any help is highly 
appreciated.

Regards.

[SDI MFC CLASS CChildView MEMBER METHOD START]

HRESULT CChildView::InitializeDirectX()
{
 HWND hWnd = GetSafeHwnd();

 if(NULL == (_pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
 {
  return E_FAIL;
 }
 
 D3DPRESENT_PARAMETERS d3dpp; 
 ZeroMemory(&d3dpp, sizeof(d3dpp));
 d3dpp.Windowed = TRUE;
 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
 d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;

 if(FAILED(_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
                               D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                               &d3dpp, &_pDXDevice)))
 {
  return E_FAIL;
 }

 return S_OK;
}

[SDI MFC CLASS CChildView MEMBER METHOD END]

Debug tells that DirectX object is created. However, the code fails at the 
CreateDevice statement.

[DEBUG ERROR MESSAGE START]

Direct3D9: (INFO) :HalDevice Driver Style 9

Direct3D9: (ERROR) :Failed to create driver surface
Unhandled exception at 0x7c901230 in Visualizer.exe: User breakpoint.
The program '[1316] Visualizer.exe: Native' has exited with code -2147483645 
(0x80000003).

Disassembly Code : 7C901230 int 3

[DEBUG ERROR MESSAGE END]


System Information : DELL Dimension 4600, Intel Pentium 4, 512 MB RAM, XP 
Professional, 128MB DDR ATI Radeon 9800 Pro.

Thank you very much for your attention.
date: Thu, 11 May 2006 15:16:03 -0700   author:   Millennium Falcon

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us