随笔分类 - VS/Mfc/Qt
摘要:void CWireLessDlg::CreatePakcetFile(){ CString strFolderPath; strFolderPath = _T("D:\\无线通信板报文存储文件夹"); if(!PathIsDirectory(strFolderPath))//判断路径是否存在 Cr
阅读全文
摘要:1、定义套接字类SocketU 集成CSocket,声明套接字变量 SocketU m_socket; 2、创建套接字 m_socket.Create(int_port, SOCK_DGRAM, str_localip); 3、发送数据 m_socket.SendTo(send_hex_array,
阅读全文
摘要:1、传入_T("AAAABBBBCC"),返回_T("AA AA BB BB CC") CString FormatPacket(CString packet_str){ packet_str.Replace(_T(" "),_T("")); CString packet_backspace_str
阅读全文
摘要:配置:把kerneldlls文件夹、ControlCAN.dll、ControlCAN.lib放在工程下面(debug和Release下面,最后需要exe和这些文件在一起);右键工程属性,链接器->输入->附加依赖项,填入./ControlCAN.lib。 查看工程的外部依赖性里面有了control
阅读全文
摘要:1、使用CTime精确到秒 CTime time = CTime::GetCurrentTime(); CString time_str; time_str.Format(_T("%d-%d-%d-%d"),time.GetMonth(),time.GetDay(),time.GetHour(),t
阅读全文
摘要:打开项目属性->配置属性->常规,平台工作集,选为v100
阅读全文
摘要:1、新建对话框类MyDialog 2、双击对话框,添加.h和.cpp(注意在.h中需要添加Resource.h,因为对话框是存在这个里面的) 3、在需要的地方添加此新建类的头文件; 1、模式对话框:MyDialog new_this; new_this.DoModal(); 2、非模式对话框:MyD
阅读全文
摘要:char szHostName[MAX_PATH + 1]; gethostname(szHostName, MAX_PATH); //得到计算机名 hostent *p = gethostbyname(szHostName); //从计算机名得到主机信息 char *pIP1 = inet_nto
阅读全文
摘要:1、宏定义一个自定义消息 #define WM_MY WM_USER+1 2、定义一个消息响应函数 afx_msg LRESULT WM_MyMessage(WPARAM wparam, LPARAM lparam);//protect类型 3、注册消息 BEGIN_MESSAGE_MAP(CGra
阅读全文
摘要:原因:MFC对象不支持多线程操作,不能供多个线程进程使用,所以尽量不要在线程里面更新界面。 解决办法: 1、将工程改为release 2、使用控件来SetWindowText 3、在线程里面发送消息 SendMessageTimeout(怎么用看另外的博客)
阅读全文
摘要:1、判断某路径的文件是否存在 BOOL PathFileExists( _In_ LPCTSTR pszPath );2、CFileFind类 CFileFind finder; BOOL bWorking = finder.FindFile(_T("*.*")); while (bWorking)
阅读全文
摘要:RGB(255,200,200)->粉红 RGB(200,255,200)->淡绿 RGB(200,200,255)->淡蓝 RGB(200,200,200)->浅灰
阅读全文
摘要:1、用记事本打开.sln,如图修改 2、用记事本打开.vcxproj文件,搜索:v140,修改为v120(有四个)
阅读全文
摘要:CWnd::IsZoomed() CWnd::IsIconic()
阅读全文
摘要:int cx = GetSystemMetrics(SM_CXFULLSCREEN); int cy = GetSystemMetrics(SM_CYFULLSCREEN); 通过上边两个函数获取的是显示屏幕的大小,但不包括任务栏等区域。
阅读全文
摘要:1、定义 template <class KEY,class ARG_KEY,class VALUE, class ARG_VALUE> class CMap:public CObject class KEY:键类型 class ARG_KEY:键大小 class VALUE:值类型 class A
阅读全文
摘要:char szHostName[MAX_PATH + 1]; gethostname(szHostName, MAX_PATH); //得到计算机名 hostent *p = gethostbyname(szHostName); //从计算机名得到主机信息 char *pIP1 = inet_nto
阅读全文
摘要:1、声明一个timer id #define send_timer 100 2、在触发定时器的地方SetTimer SetTimer(send_timer,1000, NULL)); 3、重写虚函数OnTimer(UINT_PTR nIDEvent),其中nIDEvent就是对应的id void C
阅读全文
摘要:char ret[2];//向记事本中写入这个char数组可以实现换行 ret[0] = 13;// \r ret[1] = 10;// \n fwrite(ret, 2, 1, pFile);
阅读全文