当前位置:网站首页>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边栏推荐
猜你喜欢

QT use qzxing to generate QR code

How to use annotations such as @notnull to verify and handle global exceptions

求字符串函数和长度不受限制的字符串函数的详解

Dataframe returns the whole row according to the value

Kubernetes帶你從頭到尾捋一遍

Seckill system 3- product list and product details

Jvm-03-runtime data area PC, stack, local method stack

【云原生训练营】模块七 Kubernetes 控制平面组件:调度器与控制器

Introduction, use and principle of synchronized

UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)
随机推荐
redis单线程问题强制梳理门外汉扫盲
Tensorflow realizes verification code recognition (III)
VC下Unicode和ANSI互转,CStringW和std::string互转
QT common sentence notes
Unity function - unity offline document download and use
Detailed pointer advanced 2
Visual upper system design and development (Halcon WinForm) -2 Global variable design
Kubernetes帶你從頭到尾捋一遍
Can‘t connect to MySQL server on ‘localhost‘
阿特拉斯atlas扭矩枪 USB通讯教程基于MTCOM
视觉上位系统设计开发(halcon-winform)-4.通信管理
[cloud native training camp] module 7 kubernetes control plane component: scheduler and controller
do{}while()的妙用
Kubernetes - yaml file interpretation
Final review points of human-computer interaction
QT use qzxing to generate QR code
Redis single thread problem forced sorting layman literacy
从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
使用Tengine解决负载均衡的Session问题
《微服务设计》读书笔记(下)