📄 simple.c
字号:
#include <windows.h>static char szWindowClass[]="SIMPLE";LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd){ WNDCLASSEXA wcex; HWND hWnd; MSG msg; if(!hPrevInstance) { wcex.cbSize=sizeof(WNDCLASSEXA); wcex.style=CS_HREDRAW|CS_VREDRAW; wcex.cbClsExtra=0; wcex.cbWndExtra=0; wcex.lpfnWndProc=WndProc; wcex.hInstance=hInstance; wcex.hIcon=LoadIconA(hInstance,IDI_APPLICATION); wcex.hCursor=LoadCursorA(0,IDC_ARROW); wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName=NULL; wcex.lpszClassName=szWindowClass; wcex.hIconSm=LoadIconA(hInstance,IDI_APPLICATION); if(!RegisterClassExA(&wcex)) return FALSE; } hWnd=CreateWindowExA(0,szWindowClass,"SIMPLE",WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, 0,0,hInstance,NULL); if(!hWnd) return FALSE; ShowWindow(hWnd,nShowCmd); UpdateWindow(hWnd); while(GetMessageA(&msg,0,0,0)) { TranslateMessage(&msg); DispatchMessageA(&msg); } return msg.wParam;}LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam){ HDC hDC; PAINTSTRUCT ps; switch(message) { case WM_PAINT: hDC=BeginPaint(hWnd,&ps); EndPaint(hWnd,&ps); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; default: return DefWindowProcA(hWnd,message,wParam,lParam); } return -1;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -