当前位置:网站首页>Win32 create window and button (lightweight)
Win32 create window and button (lightweight)
2022-07-03 15:27:00 【Yulong_】
Don't talk much , It's all in the notes , Code up :
#include <Windows.h>
#include <stdio.h>
// Button ID
#define IDC_BUTTON_CLICK 150
// Button click event
void OnButtonClick()
{
::MessageBox(NULL, L" Hello ", L" Ha ha ha ", MB_OK);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT msgID, WPARAM wParam, LPARAM lParam)
{
switch (msgID)
{
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_CREATE:
// Create a button on the interface
CreateWindow(L"button",// It has to be for :button, This is a button class name
L" Am I ",// The characters displayed on the button
WS_CHILD | WS_VISIBLE,
200, 200, 50, 30, // Where the button appears on the interface
hWnd, (HMENU)IDC_BUTTON_CLICK, // Set button ID, Just set a number casually
((LPCREATESTRUCT)lParam)->hInstance, NULL);
break;
// Destruction of the window
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
if (wParam == IDC_BUTTON_CLICK)
{
// Enter button click event
OnButtonClick();
}
break;
default:
DefWindowProc(hWnd, msgID, wParam, lParam);
}
return 1;
}
int __stdcall WinMain(HINSTANCE hIns
边栏推荐
- SQL server installation location cannot be changed
- [cloud native training camp] module VIII kubernetes life cycle management and service discovery
- 官网MapReduce实例代码详细批注
- Solve the problem that pushgateway data will be overwritten by multiple push
- Enable multi-threaded download of chrome and edge browsers
- Popular understanding of linear regression (II)
- Use of Tex editor
- Markdown file titles are all reduced by one level
- Seckill system 3- product list and product details
- Visual upper system design and development (Halcon WinForm) -5 camera
猜你喜欢
Digital image processing -- popular Canny edge detection
Concurrency-02-visibility, atomicity, orderliness, volatile, CAS, atomic class, unsafe
Kubernetes will show you from beginning to end
qt使用QZxing生成二维码
Jvm-04-runtime data area heap, method area
Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
Visual upper system design and development (Halcon WinForm) -5 camera
Chapter 04_ Logical architecture
C language brush questions ~leetcode and simple questions of niuke.com
Finally, someone explained the financial risk management clearly
随机推荐
PyTorch crop images differentiablly
Visual upper system design and development (Halcon WinForm) -6 Nodes and grids
XWiki安装使用技巧
Final review points of human-computer interaction
Using multipleoutputs to output multiple files in MapReduce
详解指针进阶1
Summary of JVM knowledge points
Jvm-06-execution engine
Visual upper system design and development (Halcon WinForm) -1 Process node design
Analysis of development mode process based on SVN branch
Calibre LVL
Detailed pointer advanced 2
Kubernetes - YAML文件解读
Concurrency-01-create thread, sleep, yield, wait, join, interrupt, thread state, synchronized, park, reentrantlock
【可能是全中文网最全】pushgateway入门笔记
软件逆向破解入门系列(1)—xdbg32/64的常见配置及功能窗口
Kubernetes带你从头到尾捋一遍
软件安装信息、系统服务在注册表中的位置
Unity功能——Unity离线文档下载及使用
【日常训练】395. 至少有 K 个重复字符的最长子串