1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#include <Windows.h>
#include <tchar.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hInstancePrev, LPSTR lpCmdShow, int nCmdLine)
{
WNDCLASSEX wcex;
HWND window;
int width = 640, height = 480;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_OWNDC;
wcex.lpfnWndProc = WndProc;
wcex.cbWndExtra = 0;
wcex.cbClsExtra = 0;
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(wcex.hInstance, IDI_APPLICATION);
wcex.hCursor = LoadCursor(hInstance, IDC_ARROW);
wcex.hIconSm = LoadIcon(wcex.hInstance, IDI_APPLICATION);
wcex.lpszClassName = _T("OpenGL");
wcex.lpszMenuName = NULL;
if (!RegisterClassEx(&wcex))
return 1;
window = CreateWindow(_T("OpenGL"), _T("OpenGL Test"),
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
width, height, NULL, NULL, hInstance, NULL);
if (!window)
{
MessageBox(NULL,
_T("Call to CreateWindow failed!"),
_T("Win32 Guided Tour"),
NULL);
return 1;
}
return 0;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return LRESULT();
}
|