当前位置:网站首页>els 回调函数、退出消息
els 回调函数、退出消息
2022-07-26 03:10:00 【joker_0030】
#include<Windows.h>
LRESULT CALLBACK PELouSi(HWND hWnd, UINT oMsg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,LPSTR ipCmdLine,int nCmdShow)
{
//初始化窗口类。
WNDCLASSEX db;
HWND hWnd;
MSG msg;//结构体变量。
db.cbClsExtra = 0;
db.cbSize = sizeof(WNDCLASSEX);
db.cbWndExtra = 0;
db.hbrBackground = (HBRUSH)COLOR_WINDOW;
db.hCursor = NULL;
db.hIcon = NULL;
db.hIconSm = NULL;
db.hInstance = hInstance;
db.lpfnWndProc = PELouSi;//回调函数名。
db.lpszClassName = "els";
db.lpszMenuName = NULL;
db.style = CS_HREDRAW | CS_VREDRAW;
if(0==RegisterClassEx(&db));
{
int a = GetLastError();
return 0;
}
//创建窗口。hWnd窗口句柄 失败返回NULL。
hWnd=CreateWindowEx(WS_EX_TOPMOST,"els","elsfangkuai",WS_OVERLAPPEDWINDOW,100,100,500,500,NULL,NULL,hInstance,NULL);
if (NULL == hWnd)//窗口句柄。 窗口的唯一标识。
{
return 0;
}
//显示窗口
ShowWindow(hWnd, nCmdShow);
//消息循环。队列。
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
//回调函数
//返回值:LRESULT,CALLBACK调用约定。
//参数1:窗口句柄;参数2:消息ID。
LRESULT CALLBACK PELouSi(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)// LRESULT:long类型;UINT:无符号整型,消息的ID。
{
//关闭窗口消息
switch (nMsg)
{
case WM_DESTROY:
PostQuitMessage(0);//调用PostQuitMessage(0)这个函数发出WM_QUIT消息。//系统依次产生WM_CLOSE,WM_DESTROY,WM_QUIT。
break;
}//手动处理点叉关闭消息。
return DefWindowProc(hWnd, nMsg, wParam, lParam);
//LRESULT a=DefWindowProc(hWnd, oMsg, wParam, lParam);//功能
//return a;
}
边栏推荐
- Win11麦克风权限的开启方法
- [translation] safety. Value of sboms
- Canvas -- drawing of rectangle -- making of histogram
- Autojs cloud control source code + display
- 文件操作(一)——文件简介与文件的打开方式和关闭
- OxyCon 2022 网络抓取前沿大会即将开启!
- STM32 - serial port learning notes (one byte, 16 bit data, string, array)
- 78. 子集
- Canvas - drawing pictures - dynamic drawing production
- 持续交付和DevOps是一对好基友
猜你喜欢

Self-supervised learning method to solve the inverse problem of Fokker-Planck Equation

多线程编程

26 points that must be paid attention to for stability test

Managing databases in a hybrid cloud: eight key considerations

STM——EXTI外部中断学习笔记

YOLOv3: An Incremental Improvement

Software testing post: Ali has three sides. Fortunately, he has made full preparations and has been offered

Win11 method of changing disk drive letter

URDF 语法详解

Keyboardtraffic, a tool developed by myself to solve CTF USB keyboard traffic
随机推荐
YOLOv3: An Incremental Improvement
Continuous delivery and Devops are good friends
26 points that must be paid attention to for stability test
Managing databases in a hybrid cloud: eight key considerations
LeetCode·
JVM内存模型解析
Opencv 在图像上进行标注(画框+写字)
ES6 set and map
Unity quickly builds urban scenes
Teach you to rely on management hand in hand
Design of golang lottery system
Win11 hide input method status bar method
[noip2001 popularization group] the problem of maximum common divisor and minimum common multiple
File operation (I) -- File introduction and file opening and closing methods
[SQL] CASE表达式
Safety margin of mass consumption
如何正确计算 Kubernetes 容器 CPU 使用率
[translation] safety. Value of sboms
What is the difference between heap memory and stack memory?
Autojs cloud control source code + display