当前位置:网站首页>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边栏推荐
- Using multipleoutputs to output multiple files in MapReduce
- 【pytorch学习笔记】Datasets and Dataloaders
- Besides lying flat, what else can a 27 year old do in life?
- Halcon与Winform学习第二节
- Kubernetes 进阶训练营 Pod基础
- [transformer] Introduction - the original author of Harvard NLP presented the annotated transformer in the form of line by line implementation in early 2018
- Stress test WebService with JMeter
- Visual upper system design and development (Halcon WinForm) -1 Process node design
- 视觉上位系统设计开发(halcon-winform)-3.图像控件
- Reentrantlock usage and source code analysis
猜你喜欢

Halcon与Winform学习第一节

redis缓存穿透,缓存击穿,缓存雪崩解决方案

Characteristics of MySQL InnoDB storage engine -- Analysis of row lock
![[Yu Yue education] scientific computing and MATLAB language reference materials of Central South University](/img/83/922efb4f88843f1b7feaccf2b515b9.jpg)
[Yu Yue education] scientific computing and MATLAB language reference materials of Central South University

北京共有产权房出租新规实施的租赁案例

Influxdb2 sources add data sources

The state does not change after the assignment of El switch

Dataframe returns the whole row according to the value

什么是one-hot encoding?Pytorch中,将label变成one hot编码的两种方式

Halcon and WinForm study section 2
随机推荐
Introduction, use and principle of synchronized
[combinatorics] permutation and combination (set permutation, step-by-step processing example)
SQL server installation location cannot be changed
在MapReduce中利用MultipleOutputs输出多个文件
【pytorch学习笔记】Transforms
Center and drag linked global and Chinese markets 2022-2028: Research Report on technology, participants, trends, market size and share
Win10 enterprise 2016 long term service activation tutorial
Redis single thread problem forced sorting layman literacy
什么是embedding(把物体编码为一个低维稠密向量),pytorch中nn.Embedding原理及使用
Markdown file titles are all reduced by one level
开启 Chrome 和 Edge 浏览器多线程下载
Kubernetes帶你從頭到尾捋一遍
MySQL reports an error: [error] mysqld: file '/ mysql-bin. 010228‘ not found (Errcode: 2 “No such file or directory“)
Global and Chinese market of optical fiber connectors 2022-2028: Research Report on technology, participants, trends, market size and share
基础SQL教程
The method of parameter estimation of user-defined function in MATLAB
求字符串函数和长度不受限制的字符串函数的详解
Mysql报错:[ERROR] mysqld: File ‘./mysql-bin.010228‘ not found (Errcode: 2 “No such file or directory“)
Kubernetes advanced training camp pod Foundation
Basic SQL tutorial