当前位置:网站首页>Use MessageBox to realize window confession applet (with source code)
Use MessageBox to realize window confession applet (with source code)
2022-07-16 06:37:00 【Wang Kaixin】
Effect demonstration :
Run the program to pop up the following window :
choice : yes 
choice : no 
Choose... Again : no , This box will always pop up ;
choice : yes 
Function introduction and usage :
MessageBox It means to display a modal dialog , It contains a system icon 、 A set of buttons and a short application specific message , Information such as status or error . An integer value is returned in the message box , This value indicates which button the user clicked .
function :
MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
Parameters :
hWnd:
This parameter represents the window owned by the message box . If NULL, Then the message box does not have a window .
lpText:
Contents in the prompt box .
lpCaption:
The title of the prompt box .
uType:
Buttons and icons in the message box .
uType Parameters :
| Parameters | Buttons that appear |
|---|---|
| MB_OK | confirm |
| MB_YESNO | YES( yes )、NO( no ) |
| MB_ABORTRETRYIGNORE | Abort( give up )、Retry( retry )、Ignore( skip ) |
| MB_YESNOCANCEL | Yes、No、Cancel |
| MB_RETRYCANCEL | Retry( retry )、Cancel( Cancel ) |
| MB_OKCANCEL | OK、Cancel |
Return value
| Return value | Select the button |
|---|---|
| IDOK | OK |
| IDCANCEL | CANCEL |
| IDABORT | ABORT |
| IDRETRY | ETRY |
| IDIGNORE | IGNORE |
| IDYES | YES |
| IDNO | NO |
Program source code :
#include <tchar.h>
#include <Windows.h>
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPreInstance, LPTSTR lpCmdLine, INT nShowCmd)
{
UINT nRet = MessageBox(NULL, _T(" I like you !"), _T(" Tell you a secret :"), MB_YESNO);
if (nRet == IDYES)
{
MessageBox(NULL, _T(" I love you, MEDA !"),_T(""), MB_OK);
}
if (nRet == IDNO)
{
while (1)
{
UINT mRet = MessageBox(NULL, _T(" I really like you "), _T(" Choose again :"), MB_YESNO);
if (mRet == IDYES)
{
MessageBox(NULL, _T(" I knew you loved me "), _T(" "), MB_OK);
break;
}
}
}
return 0;
}
边栏推荐
- [matlab] matlab lesson 3 - advanced drawing
- stm32学习(入门)
- Chapter I use of DHT11 temperature and humidity sensor
- 如何使用Keil5中的虚拟示波器进行软件仿真
- 【Multisim】关于Multisim仿真“运放积分器”出现的问题以及解决方法
- Blue Bridge Cup embedded Hal library new project
- 自动化仪表与过程控制(期末复习)
- Blue Bridge Cup embedded Hal library Tim_ BASE
- 【STM32F1】驱动DHT11(CubeMX配置)(HAL库)
- Dhcp-master Automated Deployment
猜你喜欢

RTtread-动态内存分配

GY-53红外激光测距模块的使用以及pwm模式代码的实现

Target detection (1) -- data preprocessing and data set segmentation

V4l2 operation process and interface description

Stm32f429+lan4720a+lwip problem record and solution

Chapter III use of ld3320 speech recognition module

Supervisor series: 4. Sub process

语音芯片JQ8400的使用心得

蓝桥杯嵌入式-HAL库-新建工程

Use of functions with variable length parameters (C language < stdarg. H>)
随机推荐
第五章 STM32+LD3320语音识别控制淘宝USB宿舍书桌灯
3.6格式化数字和字符串
Various operations of binary tree (leaf node, parent node, search binary tree, delete node in binary tree, depth of binary tree)
第二章 SYN6288语音合成模块的使用
Chapter III use of ld3320 speech recognition module
嵌入式软件开发 STM32F407 蜂鸣器 寄存器版
RT_thread互斥量的使用
【Verilog】【Vivado】计数器示例
RT_thread生产者与消费者问题
Automation instrumentation and process control (final review)
【信号调理】精密检波电路和PCB示例
常见的存储器介绍
RT_thread 线程优先级的翻转
OPENGL 3D图形开发小记,地形,光照,阴影等
c语言 将数组转化成二叉树
01-kNN
Max3232ese problem record and solution
【Multisim】关于Multisim仿真“运放积分器”出现的问题以及解决方法
RT_thread信号量的使用
Virtual memory location structure (reserved area, code area, stack area, heap area, literal constant area) and variable modifiers (const, auto, static, register, volatile, extern)