当前位置:网站首页>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边栏推荐
- Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
- mysql innodb 存储引擎的特性—行锁剖析
- Redis主从、哨兵、集群模式介绍
- 软件安装信息、系统服务在注册表中的位置
- [combinatorics] combinatorial identities (recursive combinatorial identities | sum of variable terms | simple combinatorial identities and | sum of variable terms | staggered sums of combinatorial ide
- How to use annotations such as @notnull to verify and handle global exceptions
- Popular understanding of ovo and ovr
- The difference between RAR and zip files
- 运维体系的构建
- Didi off the shelf! Data security is national security
猜你喜欢

Find mapping relationship

如何使用 @NotNull等注解校验 并全局异常处理

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

Solve the problem that pushgateway data will be overwritten by multiple push

Concurrency-01-create thread, sleep, yield, wait, join, interrupt, thread state, synchronized, park, reentrantlock

Unityshader - materialcapture material capture effect (Emerald axe)

How are integer and floating-point types stored in memory

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

Tensorflow realizes verification code recognition (I)

Construction of operation and maintenance system
随机推荐
socket.io搭建分布式Web推送服务器
Popular understanding of gradient descent
使用Tengine解决负载均衡的Session问题
函数栈帧的创建和销毁
qt使用QZxing生成二维码
Construction of operation and maintenance system
从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
Introduction, use and principle of synchronized
QT common sentence notes
Dataframe returns the whole row according to the value
Unity function - unity offline document download and use
Jvm-04-runtime data area heap, method area
Tensorflow realizes verification code recognition (III)
do{}while()的妙用
The markdown file obtains the pictures of the network and stores them locally and modifies the URL
Detailed pointer advanced 1
Kubernetes will show you from beginning to end
Stress test WebService with JMeter
Final review points of human-computer interaction
Summary of JVM knowledge points