// WindowTest.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "stdio.h"
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
WNDCLASS wc = {0};
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hInstance = hInstance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = "lj";
wc.style = CS_HREDRAW | CS_VREDRAW;
//Register class
if(!RegisterClass(&wc))
{
MessageBox(NULL, "Register class fail!", "error", MB_OK);
return -1;
}
//Create Window
HWND hMainWnd = CreateWindow( "lj",
"Test",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
createwindow创建窗口时返回值为null但getlasterror为0
最新推荐文章于 2021-06-03 14:30:04 发布