2 Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
13 #include "testnative.h"
15 #ifdef TEST_NATIVE_WINDOWS
17 static void *CreateWindowNative(int w, int h);
18 static void DestroyWindowNative(void *window);
20 NativeWindowFactory WindowsWindowFactory = {
27 WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
37 return DefWindowProc(hwnd, msg, wParam, lParam);
43 CreateWindowNative(int w, int h)
49 wc.lpfnWndProc = WndProc;
52 wc.hInstance = GetModuleHandle(NULL);
53 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
54 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
55 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
56 wc.lpszMenuName = NULL;
57 wc.lpszClassName = "SDL Test";
59 if (!RegisterClass(&wc)) {
60 MessageBox(NULL, "Window Registration Failed!", "Error!",
61 MB_ICONEXCLAMATION | MB_OK);
66 CreateWindow("SDL Test", "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
67 CW_USEDEFAULT, w, h, NULL, NULL, GetModuleHandle(NULL),
70 MessageBox(NULL, "Window Creation Failed!", "Error!",
71 MB_ICONEXCLAMATION | MB_OK);
75 ShowWindow(hwnd, SW_SHOW);
81 DestroyWindowNative(void *window)
83 DestroyWindow((HWND) window);