当前位置:网站首页>els 消息循环
els 消息循环
2022-07-26 03:10:00 【joker_0030】
#include<Windows.h>
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 = NULL;
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,100,100,NULL,NULL,hInstance,NULL);
if (NULL == hWnd)//窗口句柄。 窗口的唯一标识。
{
return 0;
}
//显示窗口
ShowWindow(hWnd, nCmdShow);
//消息循环。队列。
//返回值:失败返回NULL。
//参数1:指向MSG消息结构体的指针。
//参数2:指定窗口的句柄,用处理该窗口的消息。NULL表示当前实列的所有信息。
//参数3,4:设定要处理的消息的范围,0,0表示所有信息。
GetMessage(&msg, NULL, 0, 0)//NULL和非NULL的区别。
{
//该函数将虚拟键消息转换字符消息。字符消息被寄送到调用现成的消息队列里。
//返回值:如果消息被转换,返回非零值。
//参数:指向MSG消息结构体的指针。
TranslateMessage(&msg);//翻译消息。
//该函数分发一个消息给窗口程序。
//返回值:返回值是窗口程序返回的值。尽管返回值的含义依赖于被调度的信息,但返回值通常被忽略。
//参数:指向MSG消息结构体的指针。
DispatchMessage(&msg);//分发消息。标准消息 命令消息 通知消息 自定义消息。
}
return 0;
}
边栏推荐
- Hello World driver (II) - primary version
- .net serialize enumeration as string
- 小测(一)
- Unknown-Aware Object Detection:Learning What You Don’t Know from Videos in the Wild(CVPR 2022)
- Personally test five efficient and practical ways to get rid of orders, and quickly collect them to help you quickly find high-quality objects!
- 【尤里复裂人】带你轻松理解——深拷贝和浅拷贝
- Functions and usage of snownlp Library
- 手把手教你依赖管理
- Win11 hide input method status bar method
- VR panoramic shooting and production of business center helps businesses effectively attract people
猜你喜欢

Jenkins' study notes are detailed

Remember SQL optimization once

LeetCode·83双周赛·6128.最好的扑克手牌·模拟

图解LeetCode——5. 最长回文子串(难度:中等)

Swin Transformer【Backbone】

Arthas download and startup

(9) Attribute introspection

YOLOv3: An Incremental Improvement

【尤里复裂人】带你轻松理解——深拷贝和浅拷贝

"Xiao Deng's view" the value brought by Siem to enterprises (II)
随机推荐
中国信通院陈屹力:降本增效是企业云原生应用的最大价值
图解LeetCode——5. 最长回文子串(难度:中等)
Chen Yili, China Academy of communications technology: cost reduction and efficiency increase are the greatest value of Enterprise Cloud native applications
[noip2001 popularization group] the problem of maximum common divisor and minimum common multiple
VR panoramic shooting and production of business center helps businesses effectively attract people
Jenkins' study notes are detailed
【C语言】深入理解 整型提升 和 算术转换
Continuous delivery and Devops are good friends
经典面试问题——OOP语言的三大特征
Managing databases in a hybrid cloud: eight key considerations
如何正确计算 Kubernetes 容器 CPU 使用率
canvas——绘制曲线——挂钟,饼图,五角星
事半功倍:学会WEB性能测试用例设计模型
多线程编程
Execution process behind shell commands
How to design test cases according to the requirements of login testing?
规范自己debug的流程
Standardize your own debug process
万维网、因特网和互联网的区别
[untitled]