3 LRESULT WINAPI
BasicWindowProc (HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
14 return DefWindowProc (hwnd
, message
, wParam
, lParam
);
17 HWND
CreateBasicWindow (VOID
)
19 WNDCLASS wndclass
= {0};
20 wndclass
.lpfnWndProc
= BasicWindowProc
;
21 wndclass
.hInstance
= GetModuleHandle(NULL
);
22 wndclass
.lpszClassName
= "DDrawTest";
23 RegisterClass(&wndclass
);
25 return CreateWindow("DDrawTest", "ReactOS DirectDraw Test", WS_POPUP
, 0, 0, 10, 10, NULL
, NULL
, GetModuleHandle(NULL
), NULL
);
28 BOOL
CreateSurface(LPDIRECTDRAWSURFACE7
* pSurface
)
30 LPDIRECTDRAW7 DirectDraw
;
31 LPDIRECTDRAWSURFACE7 Surface
;
34 // Create DDraw Object
35 if (DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw7
, NULL
) != DD_OK
)
37 printf("ERROR: Failed to set up ddraw\n");
41 if(!( hwnd
= CreateBasicWindow() ))
43 printf("ERROR: Failed to create window\n");
44 DirectDraw
->Release();
48 if (DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_NORMAL
) != DD_OK
)
50 printf("ERROR: Could not set cooperative level\n");
51 DirectDraw
->Release();
56 DDSURFACEDESC2 Desc
= { 0 };
59 Desc
.dwSize
= sizeof (DDSURFACEDESC2
);
60 Desc
.ddsCaps
.dwCaps
= DDSCAPS_OFFSCREENPLAIN
;
61 Desc
.dwFlags
= DDSD_CAPS
| DDSD_HEIGHT
| DDSD_WIDTH
;
63 if(DirectDraw
->CreateSurface(&Desc
, &Surface
, NULL
) != DD_OK
)
65 printf("ERROR: Faild to create Surface\n");
69 DirectDraw
->Release();