Harry123

I am following a Direct3D example which comes with the Windows Mobile 5 SDK. It is written for Win32 and I wish to use it on a MFC application.

The following:

LPDIRECT3DMOBILE g_pD3DM = NULL; // Used to create the D3DMDevice

if( FAILED( g_pD3DM->CreateDevice( uAdapter, D3DMDEVTYPE_DEFAULT,hWnd,0,&d3dmpp, &g_pd3dmDevice )))

{

blah blah

}

will not compile under MFC as it says:

error C2065: 'hWnd' : undeclared identifier

How do I use this function with MFC

Thanks

Harry



Re: Smart Devices Native C++ Development Direct3D sample and MFC

Guang-Ming Bian - MSFT

Hi Harry,

Your error seem that you don't declare hWnd object. You should declare it before invoke CreateDevice method. I have tried the sample, see below, it works fine:

Code Snippet

D3DMPRESENT_PARAMETERS d3dmpp;
UINT uAdapter = D3DMADAPTER_DEFAULT;
LPDIRECT3DMOBILEDEVICE g_pd3dmDevice = NULL; // Our rendering device
HWND hWnd;

if( FAILED( g_pD3DM->CreateDevice( uAdapter, D3DMDEVTYPE_DEFAULT,hWnd,0,&d3dmpp, &g_pd3dmDevice )))
{
//To do

}

Best regards,

Guang-Ming Bian - MSFT