当前位置:网站首页>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边栏推荐
- 视觉上位系统设计开发(halcon-winform)-3.图像控件
- 开启 Chrome 和 Edge 浏览器多线程下载
- [cloud native training camp] module VIII kubernetes life cycle management and service discovery
- How are integer and floating-point types stored in memory
- UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)
- Visual host system design and development (Halcon WinForm)
- [combinatorial mathematics] binomial theorem and combinatorial identity (binomial theorem | three combinatorial identities | recursive formula 1 | recursive formula 2 | recursive formula 3 Pascal / Ya
- CString的GetBuffer和ReleaseBuffer使用说明
- Redis主从、哨兵、集群模式介绍
- Popular understanding of ovo and ovr
猜你喜欢

Summary of JVM knowledge points

WinDbg分析dump文件

Visual upper system design and development (Halcon WinForm) -1 Process node design

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

Unityshader - materialcapture material capture effect (Emerald axe)

Detailed pointer advanced 2

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

整形和浮点型是如何在内存中的存储

Redis cache penetration, cache breakdown, cache avalanche solution

Idea does not specify an output path for the module
随机推荐
Detailed explanation of string function and string function with unlimited length
UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)
Summary of concurrent full knowledge points
Kubernetes 进阶训练营 Pod基础
Visual upper system design and development (Halcon WinForm) -2 Global variable design
秒杀系统1-登录功能
Jvm-02-class loading subsystem
Finally, someone explained the financial risk management clearly
Popular understanding of random forest
整形和浮点型是如何在内存中的存储
Solve the problem that pushgateway data will be overwritten by multiple push
视觉上位系统设计开发(halcon-winform)-3.图像控件
视觉上位系统设计开发(halcon-winform)-2.全局变量设计
Idea does not specify an output path for the module
Unity功能——Unity离线文档下载及使用
Jvm-09 byte code introduction
Halcon与Winform学习第一节
百度智能云助力石嘴山市升级“互联网+养老服务”智慧康养新模式
Reentrantlock usage and source code analysis
Kubernetes vous emmène du début à la fin