VC++函数(win32_exe)
1.windows输出,以对话框的方式。
int MessageBox( HWND hWnd, // handle to owner window
LPCTSTR lpText, // text in message box
LPCTSTR lpCaption, // message box title
UINT uType // message box style);
UINT uType 表示消息盒子的款式,返回值表示选择了什么按键。
2.添加资源脚本,“文件”-》“新建”-》“file”

对应汉语版和英文版的Vc
资源脚本名字一般和工程名相同
3.右键插入资源

里面有各种资源类型Icon表示软件运行图标,编辑图标后直接编译即可。当有多个图标资源时,软件默认使用最小ID编号的图标
4.在资源中加入对话框后,编译但仍然没有显示,因为winMain中没有包含
5.导入图标,不用自己画了。是.ico格式
、、、、、、
6.DialogMox(IDD_DIALOG1,);调用对话框
7.消息回调函数:当在对话框中有任何点击按钮、输入内容等,都会调用回调函数。
8.使用OutputDebugString()在Debug窗口显示调试信息。
VOID OutputDebugString( LPCTSTR lpOutputString // string to be displayed
);
char s[256];
sprintf(s,"uMsg =%d \n",uMsg);
OutputDebugString(s);
9.从对话框中中的控件中获取
UINT GetDlgItemInt(
HWND hDlg, // handle to dialog box--对话框句柄
int nIDDlgItem, // control identifier--具体控件id
BOOL*lpTranslated, // success state--一般都成功,NULL
BOOL bSigned // signed or unsigned value--有无符号TRUE(有符号),FALSE(无符号)
);
------------------------
将数值打印到指定窗口的指定控件
BOOL SetDlgItemInt(
HWND hDlg, // handle to dialog box--窗口句柄
int nIDDlgItem, // control identifier--控件ID
UINT uValue, // value to set--设置的值
BOOL bSigned // signed or unsigned indicator--有无符号
);
10.INT_PTR DialogBox( //winMain中加载资源
HINSTANCE hInstance, // handle to module---入参为hInstance,winmain的第一个入参,进程句柄
LPCTSTR lpTemplate, // dialog box template---(LPCSTR)DLGID,要将DLGID强制转换为LPCSTR类型--窗口ID关联到回调函数中的句柄(DLGID<->)
HWND hWndParent, // handle to owner window---NULL,不依附于某个窗口
DLGPROC lpDialogFunc // dialog box procedure---回调函数,当对应的DLGID有任何操作都会调用此函数,类似中断
);
11.//定义一个回调函数,函数名自定
BOOL CALLBACK funProc1(
HWND hwndDlg, // handle to dialog box--窗口句柄
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
12.关闭一个窗口
BOOL EndDialog(
HWND hDlg, // handle to dialog box--要关闭窗口的句柄
INT_PTR nResult // value to return--返回值
);
13.调试时,局部变量要加断点才能看到调试过程中的值,不然程序快速飞过,啥都看不见
14.不使用控制台,改用对话框时,要用回调函数,消息机制。用户在界面任何操作,对应一种事件,调用消息回调函数,根据消息相关参数做响应的事。
15.主函数
int APIENTRY WinMain(
HINSTANCE hInstance,//资源总管
HINSTANCE hPrevInstance,
LPSTR lpCmdLine, //传入参,使用打开命令+ 程序名+参数
int nCmdShow //用来设置程序是明着启动还是暗着启动,缺省为1
)
VC++函数(win32_exe)的更多相关文章
- VC++函数只被调用一次
如何保证某个函数只被调用一次 一个函数caller会在其内部调用另外一个函数callee,现在的情况是,caller可能会在多个地方被多次调用,而你希望callee只在第一次被调用时被调用一次.一 ...
- memset()函数
memset需要的头文件 <memory.h> or <string.h> memset <wchar.h> wmemset 函数介绍 void *memset( ...
- C/C++实践笔记 004
转义字符 #define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h> void main1() { c ...
- VB6.0调用DLL
目录 第1章 VB6.0调用DLL 1 1 VC++编写DLL 1 1.1 使用__stdcall 1 1.2 使用 .DEF 文件 1 2 简单数据类型 2 2.1 传 ...
- c语言memset详解
void *memset(void *s, int ch, size_t n);(int ch可以是char或int) 将s所指向的某一块内存中的每个字节的内容全部设置为ch指定的ASCII值, 块的 ...
- Qt测算程序运行时间
#include <QDebug> #include <QTime> #include <sys/time.h> #include <windows.h> ...
- UVA 11134 Fabled Rooks(贪心的妙用+memset误用警示)
题目链接: https://cn.vjudge.net/problem/UVA-11134 /* 问题 输入棋盘的规模和车的数量n(1=<n<=5000),接着输入n辆车的所能在的矩阵的范 ...
- 【Qt开发】Qt测试计算时间
方法1 利用QTime,其精度为ms级 </pre><pre code_snippet_id="1852215" snippet_file_name=" ...
- VC++时间函数总结
目录 第1章基本概念 1 1.1 基本概念 1 1.2 时间表示法 2 第2章 Win32 API 3 2.1 获取 3 2.1.1 时间间隔 3 2.1.2 时刻 ...
随机推荐
- The use of function Merge (update、insert、delete)
1.The use of function merge(update.insert.delete) Example: #1.Initialize the data create table #test ...
- C#模拟登录的htmlHelper类
public class HTMLHelper { /// <summary> /// 获取CooKie /// /// </summary> /// /// <para ...
- jQuery工作原理解析以及源代码示例
jQuery的开篇声明里有一段非常重要的话:jQuery是为了改变javascript的编码方式而设计的.从这段话可以看出jQuery本身并不是UI组件库或其他的一般AJAX类库.jQuery改变ja ...
- [linux]磁盘挂载
最近磁盘空间不足了, 所以需要将更多的磁盘空间加进来. 因为目前占空间最多的就是home, 无论是下载还是本地用户的东西都是放在这里的. 将分区格式化为ext4, 然后使用blkid /dev/sda ...
- ubuntu soft install
1.Mysql 安装就三个命令 mysql服务端 sudo apt-get install mysql-server mysql客户端 sudo apt-get install mysql-clien ...
- chord原理的解读
chord: A Scalable Peer-to-peer Lookup Service for Internet Application 在 P2P 系统中,有效地定位分布在网络中不同节点的数据资 ...
- VIM下Express jade空格问题:expected "indent", but got "newline"
Error: /home/y/my_note/nodejs/myapp/views/index.jade: | -list=[{name:,email:'zhangsan@123.com'}] | - ...
- LeetCode_Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The ...
- One手动玩转
<preface p2 by Ruiy,我就在开头简单奇葩两句!> 老周被查,涉及到政治问题,我先就不聊了,但Ruiy叹那,都查到七*务了,土党唱哪一出! 能基本玩转OpenNebula都 ...
- <php>PDO用法一
<?php //造PDO对象 $pdo = new PDO("mysql:dbname=mydb;host=localhost","root"," ...