当前位置:网站首页>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边栏推荐
- Visual upper system design and development (Halcon WinForm) -6 Nodes and grids
- VC下Unicode和ANSI互转,CStringW和std::string互转
- 百度智能云助力石嘴山市升级“互联网+养老服务”智慧康养新模式
- Jvm-03-runtime data area PC, stack, local method stack
- Introduction to redis master-slave, sentinel and cluster mode
- socket.io搭建分布式Web推送服务器
- Jvm-08-garbage collector
- 如何使用 @NotNull等注解校验 并全局异常处理
- MySQL reports an error: [error] mysqld: file '/ mysql-bin. 010228‘ not found (Errcode: 2 “No such file or directory“)
- Nppexec get process return code
猜你喜欢

Jvm-08-garbage collector

Functional modules and application scenarios covered by the productization of user portraits

Kubernetes帶你從頭到尾捋一遍

基础SQL教程

Second kill system 3 - list of items and item details

Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)

Baidu AI Cloud helps Shizuishan upgrade the smart health care model of "Internet + elderly care services"

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

Characteristics of MySQL InnoDB storage engine -- Analysis of row lock

北京共有产权房出租新规实施的租赁案例
随机推荐
leetcode_ Power of Four
软件逆向破解入门系列(1)—xdbg32/64的常见配置及功能窗口
驱动与应用程序通信
redis缓存穿透,缓存击穿,缓存雪崩解决方案
Final review points of human-computer interaction
Kubernetes - yaml file interpretation
Puppet automatic operation and maintenance troubleshooting cases
Didi off the shelf! Data security is national security
do{}while()的妙用
Jvm-05-object, direct memory, string constant pool
String functions that you need to know
找映射关系
详解指针进阶1
官网MapReduce实例代码详细批注
redis单线程问题强制梳理门外汉扫盲
Functional modules and application scenarios covered by the productization of user portraits
Enable multi-threaded download of chrome and edge browsers
视觉上位系统设计开发(halcon-winform)
What are the composite types of Blackhorse Clickhouse, an OLAP database recognized in the industry
Mysql报错:[ERROR] mysqld: File ‘./mysql-bin.010228‘ not found (Errcode: 2 “No such file or directory“)