当前位置:网站首页>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边栏推荐
- Atlas atlas torque gun USB communication tutorial based on mtcom
- Visual upper system design and development (Halcon WinForm) -6 Nodes and grids
- Jvm-08-garbage collector
- Seckill system 2 redis solves the problem of distributed session
- Redis single thread problem forced sorting layman literacy
- Popular understanding of linear regression (I)
- Kubernetes - YAML文件解读
- 在MapReduce中利用MultipleOutputs输出多个文件
- Srs4.0+obs studio+vlc3 (environment construction and basic use demonstration)
- Digital image processing -- popular understanding of corrosion and expansion
猜你喜欢

Chapter 04_ Logical architecture

GCC cannot find the library file after specifying the link library path

Kubernetes帶你從頭到尾捋一遍

Leasing cases of the implementation of the new regulations on the rental of jointly owned houses in Beijing

Creation and destruction of function stack frames

qt使用QZxing生成二维码

Kubernetes will show you from beginning to end

What is machine reading comprehension? What are the applications? Finally someone made it clear

Detailed pointer advanced 1

Concurrency-02-visibility, atomicity, orderliness, volatile, CAS, atomic class, unsafe
随机推荐
[probably the most complete in Chinese] pushgateway entry notes
Idea does not specify an output path for the module
视觉上位系统设计开发(halcon-winform)-6.节点与宫格
Popular understanding of gradient descent
String functions that you need to know
Find mapping relationship
Jvm-03-runtime data area PC, stack, local method stack
CString的GetBuffer和ReleaseBuffer使用说明
Jvm-02-class loading subsystem
Concurrency-02-visibility, atomicity, orderliness, volatile, CAS, atomic class, unsafe
Redis cache penetration, cache breakdown, cache avalanche solution
Visual host system design and development (Halcon WinForm)
Unity功能——Unity离线文档下载及使用
[combinatorics] combinatorial identities (recursive combinatorial identities | sum of variable terms | simple combinatorial identities and | sum of variable terms | staggered sums of combinatorial ide
Using TCL (tool command language) to manage Tornado (for VxWorks) can start the project
Visual upper system design and development (Halcon WinForm) -1 Process node design
Final review points of human-computer interaction
Srs4.0+obs studio+vlc3 (environment construction and basic use demonstration)
自定义注解
Relationship between truncated random distribution and original distribution