当前位置:网站首页>使用Visual Studio 2017创建简单的窗口程序
使用Visual Studio 2017创建简单的窗口程序
2022-06-12 09:20:00 【Tody Guo】
目前针对使用VS2017创建窗口来说有点难度,不过,经过一些开源代码的事例来证实,还是有很简单的方式的。
可以通过简单的代码来创建一些简单的窗口程序。这个特别适合一些小工具的开发,大型项目的话,还是需要专业的工具进行。
下面我就跟大家介绍下方法:
1.使用工程的菜单创建一个Windows Application的程序,并选择空白的项目。
2.在新建的工程项目里面,创建一个“DIALOG”的对话框资源。
3.新建一个source的CPP文件,并在里面加入如下代码(记得在CPP文件里面加入资源的头文件哦)
#include "resource.h"
#include <Windows.h>
BOOL CALLBACK dialogproc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch (m) {
case WM_COMMAND:
switch (LOWORD(w)) {
case IDCANCEL:
MessageBox(h, L"IDCANCEL", L"tip", 48);
DestroyWindow(h);
return 1;
case IDOK:
MessageBox(h, L"now test", L"tip", 48);
return 1;
}
case WM_INITDIALOG:
MessageBox(h, L"WM_INITDIALOG", L"tip", 48);
break;
case WM_DESTROY:
MessageBox(h, L"WM_DESTROY", L"tip", 48);
break;
}
return 0;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// main dialog
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, &dialogproc);
return 0;
}运行效果:

边栏推荐
- Es6-- common basic knowledge
- Common omissions in software test reports, give yourself a wake-up call
- Selection of interview questions for software testing
- 自动化测试框架的设计原则有哪些?我帮你总结好了快来看
- The onbindviewholder of recyclerview is called twice at the same time
- ABC253F Operations on a Matrix
- 2024. 考试的最大困扰度-滑动窗口
- Basic knowledge of Linear Algebra -- concepts and relationships of common matrices
- Binary tree calculation problem
- MySQL安装
猜你喜欢

Principle analysis of mongodb storage engine wiredtiger
APP测试面试题汇总,面试必考一定要看
还在原地踏步,提高软件测试能力的方法你知道吗?
功能测试面试常见的技术问题,总结好了你不看?
Database common interview questions are ready for you

JVM virtual machine
软件测试需求分析方法有哪些,一起来看看吧

Visualization of two-dimensional feature logistic regression prediction results
测试用例和bug描述规范参考
![Sword finger offer:[day 9 dynamic planning (medium)] --- > maximum sum of continuous subarrays](/img/6b/6dcc86bfe0f48103ef8420b9996c1e.jpg)
Sword finger offer:[day 9 dynamic planning (medium)] --- > maximum sum of continuous subarrays
随机推荐
JVM virtual machine
Network layer IP protocol ARP & ICMP & IGMP nat
数据库常见面试题都给你准备好了
【极术公开课预告】Arm最强MCU内核Cortex-M85处理器,全方位助力物联网创新(有抽奖)
Subtractive integer (number theory)
自动化测试学习路线,快来学吧
Mycat的使用
測試用例和bug描述規範參考
II Transforming regular expressions into finite state automata: NFA state machine recognizes input strings
MySQL安装
Auto.js学习笔记8:常用且重要的一些API
Financial test interview questions to help you get the offer
Distributed transaction solution 1: TCC (compensation transaction)
Grab screen and ground glass effect
Offer:[day 8 dynamic planning (simple)] --- > maximum profit of stock
How should the test plan be written? A thought teaches you
【云原生】Eureka服务注册的搭建
测试用例如何编写?
Swagger documentation details
Ceil, floor and round functions