当前位置:网站首页>win32创建窗口及按钮(轻量级)
win32创建窗口及按钮(轻量级)
2022-07-03 15:20:00 【宇龍_】
话不多说,都在注释里,上代码:
#include <Windows.h>
#include <stdio.h>
//按钮ID
#define IDC_BUTTON_CLICK 150
//按钮点击事件
void OnButtonClick()
{
::MessageBox(NULL, L"你好", L"呵呵呵", MB_OK);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT msgID, WPARAM wParam, LPARAM lParam)
{
switch (msgID)
{
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_CREATE:
//界面上创建一个按钮
CreateWindow(L"button",//必须为:button,这是一个按钮类名
L"点我",//按钮上显示的字符
WS_CHILD | WS_VISIBLE,
200, 200, 50, 30, //按钮在界面上出现的位置
hWnd, (HMENU)IDC_BUTTON_CLICK, //设置按钮的ID,随便设置一个数即可
((LPCREATESTRUCT)lParam)->hInstance, NULL);
break;
//销毁窗口
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
if (wParam == IDC_BUTTON_CLICK)
{
//进入按钮点击事件
OnButtonClick();
}
break;
default:
DefWindowProc(hWnd, msgID, wParam, lParam);
}
return 1;
}
int __stdcall WinMain(HINSTANCE hIns边栏推荐
- 视觉上位系统设计开发(halcon-winform)-4.通信管理
- Apache ant extension tutorial
- MySQL reports an error: [error] mysqld: file '/ mysql-bin. 010228‘ not found (Errcode: 2 “No such file or directory“)
- Jvm-05-object, direct memory, string constant pool
- Nppexec get process return code
- Construction of operation and maintenance system
- redis缓存穿透,缓存击穿,缓存雪崩解决方案
- 什么是Label encoding?one-hot encoding ,label encoding两种编码该如何区分和使用?
- Detailed comments on MapReduce instance code on the official website
- Jvm-09 byte code introduction
猜你喜欢

第04章_逻辑架构

视觉上位系统设计开发(halcon-winform)-1.流程节点设计

【Transform】【实践】使用Pytorch的torch.nn.MultiheadAttention来实现self-attention

高并发下之redis锁优化实战
![[transformer] Introduction - the original author of Harvard NLP presented the annotated transformer in the form of line by line implementation in early 2018](/img/2b/b23aeab584f89be6678c0fe059d4b6.png)
[transformer] Introduction - the original author of Harvard NLP presented the annotated transformer in the form of line by line implementation in early 2018

Jvm-05-object, direct memory, string constant pool

Unity hierarchical bounding box AABB tree

秒杀系统2-Redis解决分布式Session问题

Influxdb2 sources add data sources

Solve the problem that pushgateway data will be overwritten by multiple push
随机推荐
Matplotlib drawing label cannot display Chinese problems
Visual upper system design and development (Halcon WinForm) -4 Communication management
Introduction, use and principle of synchronized
[transformer] Introduction - the original author of Harvard NLP presented the annotated transformer in the form of line by line implementation in early 2018
[probably the most complete in Chinese] pushgateway entry notes
Solve the problem that pushgateway data will be overwritten by multiple push
Search in the two-dimensional array of leetcode sword offer (10)
MySQL reports an error: [error] mysqld: file '/ mysql-bin. 010228‘ not found (Errcode: 2 “No such file or directory“)
Visual upper system design and development (Halcon WinForm) -2 Global variable design
自定义注解
使用Tengine解决负载均衡的Session问题
Can‘t connect to MySQL server on ‘localhost‘
Popular understanding of gradient descent
求字符串函数和长度不受限制的字符串函数的详解
PyTorch crop images differentiablly
Visual upper system design and development (Halcon WinForm) -3 Image control
Jvm-06-execution engine
Halcon与Winform学习第一节
Explanation of time complexity and space complexity
函数栈帧的创建和销毁