ReactOS  0.4.15-dev-3733-g974a0f0
GetPeekMessage.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: GPL - See COPYING in the top level directory
4  * PURPOSE: Test for GetMessage/PeekMessage
5  * PROGRAMMERS: Thomas Faber <thomas.faber@reactos.org>
6  */
7 
8 #include "precomp.h"
9 
11 {
12  MSG msg;
13 
15 
16  ok(GetMessage(&msg, hWnd, 0, 0) == -1, "\n");
17  ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "GetLastError() = %lu\n", GetLastError());
18 }
19 
21 {
22  MSG msg;
23 
25 
26  ok(PeekMessage(&msg, hWnd, 0, 0, PM_NOREMOVE) == 0, "\n");
27  ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "GetLastError() = %lu\n", GetLastError());
28 }
29 
30 START_TEST(GetPeekMessage)
31 {
32  HWND hWnd = CreateWindowExW(0, L"EDIT", L"miau", 0, CW_USEDEFAULT, CW_USEDEFAULT,
34  ok(hWnd != INVALID_HANDLE_VALUE, "\n");
35  /* make sure we pass an invalid handle to GetMessage/PeekMessage */
36  ok(DestroyWindow(hWnd), "\n");
37 
40 }
#define PeekMessage
Definition: winuser.h:5810
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
void Test_GetMessage(HWND hWnd)
HWND hWnd
Definition: settings.c:17
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PM_NOREMOVE
Definition: winuser.h:1185
#define L(x)
Definition: ntvdm.h:50
#define CW_USEDEFAULT
Definition: winuser.h:225
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define SetLastError(x)
Definition: compat.h:611
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define DNS_ERROR_RCODE_NXRRSET
Definition: winerror.h:1855
#define GetModuleHandle
Definition: winbase.h:3685
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define GetMessage
Definition: winuser.h:5770
START_TEST(GetPeekMessage)
void Test_PeekMessage(HWND hWnd)
#define msg(x)
Definition: auth_time.c:54