ReactOS 0.4.16-dev-306-g647d351
helper.cpp
Go to the documentation of this file.
1#include "ddrawtest.h"
2
4{
5 switch (message)
6 {
7 case WM_DESTROY:
8 {
10 return 0;
11 } break;
12 }
13
15}
16
18{
19 WNDCLASS wndclass = {0};
21 wndclass.hInstance = GetModuleHandle(NULL);
22 wndclass.lpszClassName = "DDrawTest";
23 RegisterClass(&wndclass);
24
25 return CreateWindow("DDrawTest", "ReactOS DirectDraw Test", WS_POPUP, 0, 0, 10, 10, NULL, NULL, GetModuleHandle(NULL), NULL);
26}
27
29{
32 HWND hwnd;
33
34 // Create DDraw Object
35 if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
36 {
37 printf("ERROR: Failed to set up ddraw\n");
38 return FALSE;
39 }
40
41 if(!( hwnd = CreateBasicWindow() ))
42 {
43 printf("ERROR: Failed to create window\n");
44 DirectDraw->Release();
45 return FALSE;
46 }
47
48 if (DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) != DD_OK)
49 {
50 printf("ERROR: Could not set cooperative level\n");
51 DirectDraw->Release();
52 return 0;
53 }
54
55 // Creat Surface
56 DDSURFACEDESC2 Desc = { 0 };
57 Desc.dwHeight = 200;
58 Desc.dwWidth = 200;
59 Desc.dwSize = sizeof (DDSURFACEDESC2);
62
63 if(DirectDraw->CreateSurface(&Desc, &Surface, NULL) != DD_OK)
64 {
65 printf("ERROR: Faild to create Surface\n");
66 return FALSE;
67 }
68
69 DirectDraw->Release();
70
71 *pSurface = Surface;
72 return TRUE;
73}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID *lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
Definition: main.c:139
DWORD * LPDIRECTDRAW7
Definition: vmrender.idl:6
DWORD * LPDIRECTDRAWSURFACE7
Definition: vmrender.idl:7
unsigned int BOOL
Definition: ntddk_ex.h:94
#define printf
Definition: freeldr.h:97
BOOL CreateSurface(LPDIRECTDRAWSURFACE7 *pSurface)
Definition: helper.cpp:28
HWND CreateBasicWindow(VOID)
Definition: helper.cpp:17
LRESULT WINAPI BasicWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: helper.cpp:3
unsigned int UINT
Definition: ndis.h:50
#define WS_POPUP
Definition: pedump.c:616
#define DefWindowProc
Definition: ros2win.h:31
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSCL_NORMAL
Definition: ddraw.h:535
struct _DDSURFACEDESC2 DDSURFACEDESC2
#define DDSD_HEIGHT
Definition: ddraw.h:209
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:255
#define DD_OK
Definition: ddraw.h:186
#define DDSD_CAPS
Definition: ddraw.h:208
DWORD dwCaps
Definition: ddraw.h:732
DWORD dwWidth
Definition: ddraw.h:1155
DWORD dwHeight
Definition: ddraw.h:1154
DDSCAPS2 ddsCaps
Definition: ddraw.h:1188
DWORD dwFlags
Definition: ddraw.h:1153
DWORD dwSize
Definition: ddraw.h:1152
HINSTANCE hInstance
Definition: winuser.h:3170
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
Definition: tftpd.h:60
#define GetModuleHandle
Definition: winbase.h:3852
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define CreateWindow
Definition: winuser.h:5766
#define RegisterClass
Definition: winuser.h:5848
#define WM_DESTROY
Definition: winuser.h:1612