📄 winskel.cpp
字号:
//-------------------------------------------------------------------------
// File: winskel.cpp
//
// Desc: Example code showing how to create a minimal Windows skeleton
//
// Last modified: 28. Dezember 2000
//
// Copyright (c) 1999-2001 Wolfgang Engel wolf@direct3d.net
//--------------------------------------------------------------------------
#include <windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
char szWinName[] = "MyWin"; /* name of window class */
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst,
LPSTR lpszArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
/* Step 1: Define a window class. */
WNDCLASS wcl;
wcl.hInstance = hThisInst; /* handle to this instance */
wcl.lpszClassName = szWinName; /* window class name */
wcl.lpfnWndProc = WndProc; /* window function */
wcl.style = 0; /* default style */
wcl.hIcon = LoadIcon(NULL, MAKEINTRESOURCE( IDI_APPLICATION)); /* icon style */
wcl.hCursor = LoadCursor(NULL, IDC_ARROW); /* cursor style */
wcl.lpszMenuName = NULL; /* no menu */
wcl.cbClsExtra = 0; /* no extra */
wcl.cbWndExtra = 0; /* information needed */
/* Make the window background white. */
wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH) ;
/* Step 2: Register the window class. */
if(!RegisterClass (&wcl))
return 0;
/* Step 3: Now that a window class has been registered,
a window can be created. */
hwnd = CreateWindow(szWinName, /* name of window class */
"FAKE 3", /* title */
WS_OVERLAPPEDWINDOW, /* window style - normal */
CW_USEDEFAULT, /* X coordinate - let Windows decide */
CW_USEDEFAULT, /* y coordinate - let Windows decide */
CW_USEDEFAULT, /* width - let Windows decide */
CW_USEDEFAULT, /* height - let Windows decide */
HWND_DESKTOP, /* no parent window */
NULL, /* no menu */
hThisInst, /* handle of this instance of the program */
NULL /* no additional arguments */
);
/* Step 4: Display the window. */
ShowWindow(hwnd, nWinMode);
/* Step 5: Create the message loop. */
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg); /* allow use of keyboard */
DispatchMessage(&msg); /* return control to Windows */
}
return msg.wParam;
}
//-----------------------------------------------------------------------------
// Name: WndProc
// Desc: This function is called by Windows and is passed
// messages from the message queue
//-----------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY: /* terminate the program */
PostQuitMessage(WM_QUIT);
break;
default: /* Let Windows process any messages not
specified in the preceding switch statement. */
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -