vérifie que tu initialises correctement : moi j´utilise encore DirectX7 :
HRESULT InitDDRAW(HINSTANCE hInstance,int nCmdShow,LPDIRECTDRAWSURFACE7 &,int x,int y)
{
HWND hWnd;
WNDCLASS wc;
DDSURFACEDESC2 ddsd;
DDSCAPS2 ddscaps;
HRESULT hRet;
// Set up and register window class
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN_ICON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = ( HBRUSH ) GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NAME;
wc.lpszClassName = NAME;
RegisterClass(&);
// Create a window
hWnd = CreateWindowEx(WS_EX_TOPMOST,
NAME,
TITLE,
WS_POPUP,
0,
0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL,
NULL,
hInstance,
NULL);
if ( !hWnd)
return FALSE;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
SetFocus(hWnd);
//////////////////////////////////////////////////
/////////////////////////
// Create the main DirectDraw object
//////////////////////////////////////////////////
/////////////////////////
hRet = DirectDrawCreateEx(NULL, ( VOID**)&_pDD, IID_IDirectDraw7, NULL);
if ( hRet ! = DD_OK)
return InitFail(hWnd, hRet, "DirectDrawCreateEx a Echoué");
// Get exclusive mode
hRet = g_pDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if ( hRet ! = DD_OK)
return InitFail(hWnd, hRet, "SetCooperativeLevel a Echoué");
// Set the video mode to 640x480x8
hRet = g_pDD->SetDisplayMode(x, y, deep, 0, 0);
if ( hRet ! = DD_OK)
return InitFail(hWnd, hRet, "Votre carte ne supporte pas cette résolution");
// Create the primary surface with 1 back buffer
ZeroMemory(&, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
hRet = g_pDD->CreateSurface(&, &_pDDSPrimary, NULL);
if ( hRet ! = DD_OK)
return InitFail(hWnd, hRet, "Création de surface principale a échoué");
// Get a pointer to the back buffer
ZeroMemory(&, sizeof(ddscaps));
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
hRet = g_pDDSPrimary->GetAttachedSurface(&, &_pDDSBack);
bk=g_pDDSBack;
if ( hRet ! = DD_OK)
return InitFail(hWnd, hRet, "Surface attachée a échoué");
return DD_OK;
}