ReactOS 0.4.16-dev-297-gc569aee
helper.cpp File Reference
#include "ddrawtest.h"
Include dependency graph for helper.cpp:

Go to the source code of this file.

Functions

LRESULT WINAPI BasicWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
BOOL CreateSurface (LPDIRECTDRAWSURFACE7 *pSurface)
 

Variables

HWND CreateBasicWindow (VOID)
 

Function Documentation

◆ BasicWindowProc()

LRESULT WINAPI BasicWindowProc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 3 of file helper.cpp.

4{
5 switch (message)
6 {
7 case WM_DESTROY:
8 {
10 return 0;
11 } break;
12 }
13
15}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define DefWindowProc
Definition: ros2win.h:31
Definition: tftpd.h:60
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DESTROY
Definition: winuser.h:1612

◆ CreateSurface()

BOOL CreateSurface ( LPDIRECTDRAWSURFACE7 pSurface)

Definition at line 28 of file helper.cpp.

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}
#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
#define printf
Definition: freeldr.h:97
HWND CreateBasicWindow(VOID)
Definition: helper.cpp:17
#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
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481

Referenced by Blt_Test(), Test_Blt(), Test_Misc(), and Test_PrivateData().

Variable Documentation

◆ CreateBasicWindow

HWND CreateBasicWindow(VOID) ( VOID  )

Definition at line 17 of file helper.cpp.

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}
LRESULT WINAPI BasicWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: helper.cpp:3
#define WS_POPUP
Definition: pedump.c:616
HINSTANCE hInstance
Definition: winuser.h:3170
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
#define GetModuleHandle
Definition: winbase.h:3852
#define CreateWindow
Definition: winuser.h:5766
#define RegisterClass
Definition: winuser.h:5848

Referenced by CreateSurface().