- 博客(19)
- 资源 (6)
- 收藏
- 关注
原创 MFC的tab控件用法
1、成员变量: CTabCtrl m_tab; int m_CurSelTab; CPage1 m_Page1; CPage2 m_Page2; CDialog* m_pTabDialog[2]; //用来保存对话框对象指针 //各个Page的style为child,Border为None,要作为tab属性页2、在OnInitDialog()里面初始化控件 : //t
2016-04-10 01:01:01
838
原创 CString字符串分割
1、按单字符分割std::vector<CString CBOMAutoToolDlg::GetArrayFromCstringBySep( const CString & str, const TCHAR cSep){ CString CurrStr = str; std::vector DataList; int CurrPos; while((CurrPos = CurrSt
2016-04-10 00:49:35
1760
原创 MFC发送消息
1、在stdafx.h中定义消息:#define WM_UPDATEPAGE1DATA WM_USER+10012、发送消息处理: CWnd *pWnd=CWnd::FindWindow(NULL,m_wn); //查找需要发送接收消息的窗体 if(pWnd==NULL) { CString errmsg = _T("没有找到\"") + m_wn + _T("\"");
2016-04-10 00:39:29
950
原创 MFC右键弹出菜单
参考:1、自定义菜单IDR_MENU_txt2csvGrid(包含添加行和删除行两个二级菜单)2、重写WM_CONTEXTMENU消息:(我需要在指定的空间里面弹出右键菜单)void CDlgtxt2csv::OnContextMenu(CWnd* /*pWnd*/, CPoint point){ // TODO: 在此处添加消息处理程序代码 CRect rect;//定义矩形
2016-04-10 00:27:49
448
转载 C#读写注册表
参考http://www.cnblogs.com/txw1958/archive/2012/08/01/csharp-regidit.html引入命名空间:using Microsoft;using Microsoft.Win32; 写注册表: RegistryKey key = Registry.LocalMachine;
2016-04-10 00:03:41
6310
转载 C++函数指针用法
来源:《C++ Primer Plus》(第六版)(中文版)(第7章第10节函数指针)1、代码:#include //三个函数,分别返回一个数组的三个地址const double *f1(const double ar[], int n){ return ar;}const double *f2(const double ar[], int n){ return ar
2016-03-10 11:04:23
364
转载 文本查询程序(动态内存的使用)
来源:C++ Primer(中文版)(第5版)(第12章)1、头文件#ifndef query_h__#define query_h__/*文本查询程序*/#include #include #include #include #include #include #include using std::vector;using std::map;using
2016-02-24 16:29:11
423
转载 打印数值二进制形式
本文参考《深入理解计算机系统(第二版)》1、代码#include void show_bytes(unsigned char* start, int len){ for (int i = 0; i < len; i++) { printf("%.2x ", start[i]); } printf("\n");}int main(){ int n = 0x
2016-01-17 18:46:25
707
转载 VS获取mac和ip
本文的mac部分来自http://code.taobao.org/p/newProBase/diff/2/WeaponGirl_1/Server/kernel/Include#include //该头文件定义了Socket编程的功能 //#include //该头文件声明了输入输出流函数 //#include //该头文件定义了一些通用函数 //#in
2016-01-17 18:32:15
1430
转载 VS按键响应
一、实际按键响应参考http://m.blog.youkuaiyun.com/blog/marginmou/27212719添加PreTranslateMessage方法,然后BOOL CxxxDlg::PreTranslateMessage(MSG* pMsg){ // TODO: 在此添加专用代码和/或调用基类 if(pMsg->message == WM_KEYDOWN) {
2016-01-17 16:34:24
886
原创 C++操作文本
1、一次性读取文本文件中的数据: //一次性把文件中的数据读到ostringstream中 ifstream fin;//头文件fstream fin.open(filename);//filename是string(C++11)或char* if (!fin.is_open()) { return false; } ostringstream temp; temp << f
2016-01-17 16:00:11
549
原创 C指针数组和数组指针
测试:int main(){ static int m[3][4] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};/* 定义二维数组m并初始化*/ int(*p)[4];//数组指针 p是指针,指向一维数组,每个一维数组有4个int元素 int i, j; int *q[3];//指针数组 q是数组,数组元素是指针,3个int指针 p = m;
2016-01-17 15:51:12
446
原创 Unicode下CString转char*
说明:我的CString内部封装的是wchar_t(宽字符)方法1:使用WideCharToMultiByte int length = m_ShowInfo.GetLength(); char *pinfo = new char[length * 2]; WideCharToMultiByte(CP_ACP, 0, m_ShowInfo, length, pinfo,
2016-01-17 15:19:59
502
转载 MFC只运行一个实例
本文参考http://blog.163.com/ymkigeg@yeah/blog/static/82395301201310211554172/?latestBloghttp://www.cnblogs.com/likebeta/archive/2011/07/01/2095590.html1、在InitInstance的开始 m_hMutex = ::CreateMut
2016-01-17 15:06:57
485
转载 VS添加环境变量和自定义宏
本文参考http://blog.youkuaiyun.com/chinabinlang/article/details/12774209环境变量:控制面板\系统和安全\系统->高级系统设置->高级->环境变量之后新建一个系统变量或者用户变量,并保存要重启VS才会有效在VS中 在需要使用环境变量的地方使用$()把自环境变量包裹起来即可自定义宏:视图->属性管理器-
2016-01-17 15:00:14
20130
原创 一个文本翻译工具的实现
一、需求一个文本翻译工具,功能类似于汇编器,能够把一些字符串(程序的助记符)翻译为其他的字符串或者数字,并打印到文本文件中。完成的功能如下:1. 助记符翻译2. 程序地址分配3. Label替换程序地址4. 数据地址替换5. 宏定义的展开输入文件
2016-01-15 12:29:05
2493
计算机程序设计艺术
2017-02-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人