ReactOS  0.4.15-dev-3017-g1d9542d
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)
 
HWND CreateBasicWindow (VOID)
 
BOOL CreateSurface (LPDIRECTDRAWSURFACE7 *pSurface)
 

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  {
9  PostQuitMessage (0);
10  return 0;
11  } break;
12  }
13 
15 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Definition: tftpd.h:59
WPARAM wParam
Definition: combotst.c:138
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
LPARAM lParam
Definition: combotst.c:139
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by CreateBasicWindow().

◆ CreateBasicWindow()

HWND CreateBasicWindow ( VOID  )

Definition at line 17 of file helper.cpp.

18 {
19  WNDCLASS wndclass = {0};
20  wndclass.lpfnWndProc = BasicWindowProc;
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 }
#define CreateWindow
Definition: winuser.h:5729
LRESULT WINAPI BasicWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: helper.cpp:3
LPCSTR lpszClassName
Definition: winuser.h:3147
#define GetModuleHandle
Definition: winbase.h:3683
HINSTANCE hInstance
Definition: winuser.h:3142
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define RegisterClass
Definition: winuser.h:5811

Referenced by CreateSurface(), Test_CreateSurface(), and Test_SetCooperativeLevel().

◆ CreateSurface()

BOOL CreateSurface ( LPDIRECTDRAWSURFACE7 pSurface)

Definition at line 28 of file helper.cpp.

29 {
31  LPDIRECTDRAWSURFACE7 Surface;
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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD dwFlags
Definition: ddraw.h:1153
#define TRUE
Definition: types.h:120
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID *lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
Definition: main.c:139
DWORD dwWidth
Definition: ddraw.h:1155
#define DD_OK
Definition: ddraw.h:186
#define DDSD_CAPS
Definition: ddraw.h:208
#define FALSE
Definition: types.h:117
DDSCAPS2 ddsCaps
Definition: ddraw.h:1188
DWORD dwCaps
Definition: ddraw.h:732
#define DDSD_HEIGHT
Definition: ddraw.h:209
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
DWORD dwSize
Definition: ddraw.h:1152
DWORD dwHeight
Definition: ddraw.h:1154
#define DDSD_WIDTH
Definition: ddraw.h:210
LPDIRECTDRAW7 DirectDraw
Definition: create.cpp:3
#define NULL
Definition: types.h:112
DWORD * LPDIRECTDRAW7
Definition: vmrender.idl:4
HWND CreateBasicWindow(VOID)
Definition: helper.cpp:17
struct _DDSURFACEDESC2 DDSURFACEDESC2
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:255
#define DDSCL_NORMAL
Definition: ddraw.h:535
DWORD * LPDIRECTDRAWSURFACE7
Definition: vmrender.idl:7
#define printf
Definition: config.h:203

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