下载 >  网络技术 >  其它 > c++外挂类的封装

c++外挂类的封装 评分:

#include "StdAfx h" #include "CtrlCon h" #include "shlwapi h" #include "math h" CCtrlCon::CCtrlCon void { } CCtrlCon:: CCtrlCon void { } void CCtrlCon::Register HWND CtrlHwnd CString ConName int Ctrlid int Ctrltype int ConMode bool save bool set { 创建一 个结构保存临时的值 Con con; con CtrlHwnd CtrlHwnd; con Ctrlid Ctrlid; con ConName ConName; con Choose ""; con Ctrltype Ctrltype; con ConMode ConMode; con save save; con set set; 初始化 选择框的值 if Ctrltype CON CHECK con value T "0" ; else con value T "" ; 查找是否已经存在改控件 有的话 赋值新的值 map<CString Con>::iterator it m con find ConName ; if it m con end { it >second CtrlHwnd CtrlHwnd; it >second Ctrlid Ctrlid; it >second ConMode ConMode; } else 要不然就增加 m con insert map<CString Con>::value type ConName con ; } void CCtrlCon:: ConAlloc map<CString Con>::iterator it { 临时保存变量 Con ConBuf; 临时保存分隔数量 int AllocNum 0; 赋值 该项的值 ConBuf value it >second value; ConBuf ConMode it >second ConMode; ConBuf Ctrltype it >second Ctrltype; 记录cstring分隔变量 int istart 0; 临时结构 vector <CString>buf; vector < Stu>ret; 判断是否有 选择项 如 CONBOX CONLIST 鼠标选择项 if ConBuf value Find T "@" > 0 { it >second Choose ConBuf value Tokenize T "@" istart ; ConBuf value ConBuf value Tokenize T "@" istart ; istart 0; } 判断分隔值 并保存到临时变量 while istart 1 { CString m; m ConBuf value Tokenize T "|" istart ; if istart 1 break; buf push back m ; } 判断是否是 选择框 或者 不需要分隔 if ConBuf Ctrltype CON CHECK return; else 计算有分隔数量 for int i 0;i < 32;i++ AllocNum + ConBuf ConMode>> i 1 & 1 ; 分隔值并保存 vector <CString>::iterator stu it buf begin ; for ;stu it buf end ;stu it++ { 临时保存结构变量 Stu retn stu; istart 0; 判断选项并赋值 for int j 0;j < 32;j++ if ConBuf ConMode >> j 1 & 1 { int k 1; k k<< j 1 ; switch k { case CON NAME:if AllocNum 1 retn stu name stu it ;else retn stu name stu it Tokenize T " " istart ;break; case CON SIZE:if AllocNum 1 retn stu size StrToInt stu it ;else retn stu size StrToInt stu it Tokenize T " " istart ;break; case CON NUM:if AllocNum 1 retn stu num StrToInt stu it ;else retn stu num StrToInt stu it Tokenize T " " istart ;break; case CON ID:if AllocNum 1 retn stu id StrToInt stu it ;else retn stu id StrToInt stu it Tokenize T " " istart ;break; case CON SYSYTEMID:if AllocNum 1 retn stu systemid StrToInt stu it ;else retn stu systemid StrToInt stu it Tokenize T " " istart ;break; case CON QUALITY:if AllocNum 1 retn stu quality StrToInt stu it ;else retn stu quality StrToInt stu it Tokenize T " " istart ;break; case CON TIMER:if AllocNum 1 retn stu timer StrToInt stu it ;else retn stu timer StrToInt stu it Tokenize T " " istart ;break; case CON X:if AllocNum 1 retn stu x StrToInt stu it ;else retn stu x StrToInt stu it Tokenize T " " istart ;break; case CON Y:if AllocNum 1 retn stu y StrToInt stu it ;else retn stu y StrToInt stu it Tokenize T " " istart ;break; case CON EXTENT:if AllocNum 1 retn stu extent StrToInt stu it ;else retn stu extent StrToInt stu it Tokenize T " " istart ;break; case CON INTERVAL:if AllocNum 1 retn stu interval StrToInt stu it ;else retn stu interval StrToInt stu it Tokenize T " " istart ;break; case CON TEXT1:if AllocNum 1 retn stu text1 stu it ;else retn stu text1 stu it Tokenize T " " istart ;break; case CON TEXT2:if AllocNum 1 retn stu text2 stu it ;else retn stu text2 stu it Tokenize T " " istart ;break; case CON TEXT3:if AllocNum 1 retn stu text3 stu it ;else retn stu text3 stu it Tokenize T " " istart ;break; } } ret push back retn stu ; } 赋值到该项结构里 it >second stu ret; } void CCtrlCon:: CtrlLoad map<CString Con>::iterator it { if it >second Ctrlid NULL || it >second CtrlHwnd NULL { return; } switch it >second Ctrltype { case CON CHECK: { 读取选择框的选择值 it >second value toc CButton CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCheck ; break; } case CON LISTBOX: { 是否读取控件中的值 if it >second set true { CString m; 循环读取列表控件中的值 for int i 0;i < CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCount ;i++ { CString buf; CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetText i buf ; m + buf; if CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCount i 1 m + T "|" ; } 是否有选择的值 int num CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCurSel ; 如果有则赋值选中的值 if num> 0 { CString buf; CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetText num buf ; m buf + T "@" + m; } it >second value m; } else { int num CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCurSel ; if num > 0 { CString buf; CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetText num buf ; it >second Choose buf; } } break; } case CON COMBOX: { 是否读取控件中的值 if it >second set true { CString m; 循环读取控件中的值 for int i 0;i < CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCount ;i++ { CString buf; CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetLBText i buf ; m + buf; if CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCount i 1 m + T "|" ; } 是否有选择的值 int num CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCurSel ; 如果有则赋值选中的值 if num> 0 { CString buf; CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetLBText num buf ; m buf + T "@" + m; } 更新到结构里 it >second value m; } else { 是否有选择的值 int num CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetCurSel ; 如果有则赋值选中的值 if num> 0 { CString buf; CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetLBText num buf ; 添加到结构里 it >second Choose buf; } } break; } case CON LISTCTL: { 是否读取控件中的值 if it >second set true { CString m; 循环读取控件中的值 for int i 0; i < CListCtrl CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetItemCount ;i++ { for int j 0; j < CListCtrl CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetHeaderCtrl >GetItemCount ;j++ { m+ CListCtrl CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetItemText i j ; if CListCtrl CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetHeaderCtrl >GetItemCount j 1 m+ T " " ; } if CListCtrl CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >GetItemCount i 1 m+ T "|" ; } it >second value m; } break; } default: { char m ; GetDlgItemText it >second CtrlHwnd it >second Ctrlid m MAX TEXT ; it >second value m; } } 清除结构 it >second stu clear ; } void CCtrlCon:: Show map<CString Con>::iterator it { switch it >second Ctrltype { case CON CHECK: { if it >second value T "0" CButton CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SetCheck 0 ; else CButton CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SetCheck 1 ; break; } case CON LISTBOX: { 清空控件 CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >ResetContent ; 循环读取结构中的值并赋值 for UINT i 0;i<it >second stu size ;i++ { CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >InsertString i it >second stu at i name ; } 选择选中项 CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SelectString 0 it >second Choose ; break; } case CON COMBOX: { 清空控件 CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >ResetContent ; 循环读取结构中的值并赋值 for UINT i 0;i<it >second stu size ;i++ { CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >InsertString i it >second stu at i name ; } 选择选中项 CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SelectString 0 it >second Choose ; break; } case CON LISTCTL: { 清空控件 CListCtrl CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >DeleteAllItems ; for UINT i 0;i<it >second stu size ;i++ { CString m; 插入listctrl的行位置 int site 0; for int j 0;j< 32;j++ { if it >second ConMode >> j 1 & 1 { char l ; int k 1; k k << j 1 ; switch k { case CON NAME:l it >second stu at i name GetBuffer ;if site 0 CODE INSERT it >second stu at i name ReleaseBuffer ;site++;break; case CON SIZE:m toc it >second stu at i size ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON NUM:m toc it >second stu at i num ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON ID:m toc it >second stu at i id ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON SYSYTEMID:m toc it >second stu at i systemid ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON QUALITY:m toc it >second stu at i quality ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON TIMER:m toc it >second stu at i timer ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON X:m toc it >second stu at i x ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON Y:m toc it >second stu at i y ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON EXTENT:m toc it >second stu at i extent ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON INTERVAL:m toc it >second stu at i interval ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON TYPE:m toc it >second stu at i type ;l m GetBuffer ;if site 0 CODE INSERT m ReleaseBuffer ;site++;break; case CON TEXT1:l it >second stu at i text1 GetBuffer ;if site 0 CODE INSERT it >second stu at i name ReleaseBuffer ;site++;break; case CON TEXT2:l it >second stu at i text2 GetBuffer ;if site 0 CODE INSERT it >second stu at i name ReleaseBuffer ;site++;break; case CON TEXT3:l it >second stu at i text3 GetBuffer ;if site 0 CODE INSERT it >second stu at i name ReleaseBuffer ;site++;break; } } } } break; } default: { SetDlgItemText it >second CtrlHwnd it >second Ctrlid it >second value ; break; } } } void CCtrlCon::Set { 遍历整个结构列表 map<CString Con>::iterator it m con begin ; for ;it m con end ;it++ { 读取控件值 CtrlLoad it ; 分隔匹配 ConAlloc it ; } } void CCtrlCon::Set CString ConName { 查找匹配项 map<CString Con>::iterator it m con find ConName ; if it m con end { 读取控件值 CtrlLoad it ; 分隔匹配 ConAlloc it ; } Show ConName ; } void CCtrlCon::Set CString ConName CString ConValue { 查找匹配项 map<CString Con>::iterator it m con find ConName ; if it m con end { 赋值 it >second value ConValue; 清空结构 it >second stu clear ; 分隔匹配 ConAlloc it ; } Show ConName ; } 变量显示到控件 void CCtrlCon::Show { map<CString Con>::iterator it m con begin ; for ;it m con end ;it++ { Show it ; } } void CCtrlCon::Show CString ConName { map<CString Con>::iterator it m con find ConName ; if it m con end Show it ; } CString CCtrlCon::Return CString ConName { map<CString Con>::iterator it m con find ConName ; if it m con end return it >second value; return T "" ; } int CCtrlCon::ReturnInt CString ConName { map<CString Con>::iterator it m con find ConName ; if it m con end { #ifdef UNICODE USES CONVERSION; int m atoi W2A it >second value GetBuffer ; it >second value ReleaseBuffer ; return m; #else int m atoi it >second value GetBuffer ; it >second value ReleaseBuffer ; return m; #endif } return 0; } bool CCtrlCon::ReturnExist CString ConName CString SeacherName { map<CString Con>::iterator it m con find ConName ; for ;it m con end ;it++ { for UINT i 0;i<it >second stu size ;i++ { if SeacherList it >second stu at i name SeacherName { return true; } } } return false; } CString CCtrlCon::ReturnChoose CString ConName { map<CString Con>::iterator it m con find ConName ; if it m con end if it >second Ctrltype CON COMBOX||it >second Ctrltype CON LISTBOX return it >second Choose; else return it >second value; return T "" ; } int CCtrlCon::ReturnChooseSite CString ConName { map<CString Con>::iterator it m con find ConName ; if it m con end if it >second Ctrltype CON COMBOX||it >second Ctrltype CON LISTBOX { for UINT i 0;i<it >second stu size ;i++ { if SeacherList it >second stu at i name it >second Choose return i; } } return 1; } int CCtrlCon::Return stru num CString ConName { map<CString Con>::iterator it m con find ConName ; if it m con end return it >second stu size ; return 0; } CString CCtrlCon::Return stru CString ConName int ConType CString str { map<CString Con>::iterator it m con find ConName ; if it m con end { for UINT i 0;i<it >second stu size ;i++ { if SeacherList it >second stu at i name str { switch ConType { case CON NAME:return it >second stu at i name;break; case CON SIZE:return toc it >second stu at i size ;break; case CON NUM:return toc it >second stu at i num ;break; case CON ID:return toc it >second stu at i id ;break; case CON SYSYTEMID:return toc it >second stu at i systemid ;break; case CON QUALITY:return toc it >second stu at i quality ;break; case CON INTERVAL:return toc it >second stu at i interval ;break; case CON TIMER:return toc it >second stu at i timer ;break; case CON X:return toc it >second stu at i x ;break; case CON Y:return toc it >second stu at i y ;break; case CON EXTENT:return toc it >second stu at i extent ;break; case CON TYPE:return toc it >second stu at i type ;break; case CON TEXT1:return it >second stu at i text1;break; case CON TEXT2:return it >second stu at i text2;break; case CON TEXT3:return it >second stu at i text3;break; } } } } return T "" ; } CString CCtrlCon::Return stru site CString ConName int ConType int i { map<CString Con>::iterator it m con find ConName ; if it m con end { switch ConType { case CON NAME:return it >second stu at i name;break; case CON SIZE:return toc it >second stu at i size ;break; case CON NUM:return toc it >second stu at i num ;break; case CON ID:return toc it >second stu at i id ;break; case CON SYSYTEMID:return toc it >second stu at i systemid ;break; case CON QUALITY:return toc it >second stu at i quality ;break; case CON INTERVAL:return toc it >second stu at i interval ;break; case CON TIMER:return toc int it >second stu at i timer ;break; case CON X:return toc it >second stu at i x ;break; case CON Y:return toc it >second stu at i y ;break; case CON EXTENT:return toc it >second stu at i extent ;break; case CON TYPE:return toc it >second stu at i type ;break; case CON TEXT1:return it >second stu at i text1;break; case CON TEXT2:return it >second stu at i text2;break; case CON TEXT3:return it >second stu at i text3;break; } } return T "" ; } void CCtrlCon::Set stru site CString ConName int ConType int i CString text { map<CString Con>::iterator it m con find ConName ; #ifdef UNICODE USES CONVERSION; int num atoi W2A text GetBuffer ; #else int num atoi text GetBuffer ; #endif if it m con end { switch ConType { case CON NAME:it >second stu at i name text;break; case CON SIZE:it >second stu at i size num;break; case CON NUM:it >second stu at i num num;break; case CON ID:it >second stu at i id num;break; case CON SYSYTEMID:it >second stu at i systemid num;break; case CON QUALITY:it >second stu at i quality num;break; case CON INTERVAL:it >second stu at i interval num;break; case CON TIMER:it >second stu at i timer num;break; case CON X:it >second stu at i x num;break; case CON Y:it >second stu at i y num;break; case CON EXTENT:it >second stu at i extent num;break; case CON TYPE:it >second stu at i type num;break; case CON TEXT1:it >second stu at i text1 text;break; case CON TEXT2:it >second stu at i text2 text;break; case CON TEXT3:it >second stu at i text3 text;break; } } text ReleaseBuffer ; } void CCtrlCon::ConAlloc { 遍历整个结构列表 map<CString Con>::iterator it m con begin ; for ;it m con end ;it++ 分割匹配 ConAlloc it ; } void CCtrlCon::push back CString ConName CString ConValue bool repeat { 查找匹配项 map<CString Con>::iterator it m con find ConName ;; 值是否可以重复 if repeat false && it m con end { for UINT i 0;i < it >second stu size ;i++ { if it >second stu at i name ConValue return; } } 添加到结构末尾 if it m con end return; if it >second value T "" it >second value it >second value+ T "|" + ConValue; else it >second value ConValue; 重新分隔 it >second stu clear ; ConAlloc it ; Show it >second ConName ; } void CCtrlCon::pop back CString ConName { 查找匹配项 map<CString Con>::iterator it m con find ConName ;; if it m con end return; CString buf; int istart 0; int last 1; while istart 1 { it >second value Tokenize T "|" istart ; if istart 1 { if last 1 { it >second value Delete last 1 it >second value GetLength last+1 ; } else { it >second value T "" ; } break; } if it >second value GetLength + 1 istart { continue; } last istart; } ConAlloc it ; Show it ; } void CCtrlCon::Choose CString ConName CString ConValue { map<CString Con>::iterator it m con find ConName ;; if it m con end return; switch it >second Ctrltype { case CON COMBOX: { if ConValue "" CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SelectString 0 ConValue ; else CComboBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SelectString 0 it >second Choose ; } case CON LISTBOX: { if ConValue "" CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SelectString 0 ConValue ; else CListBox CWnd::FromHandle it >second CtrlHwnd >GetDlgItem it >second Ctrlid >SelectString 0 it >second Choose ; } } Show it ; } CString CCtrlCon::List { map<CString Con>::iterator it m con begin ; CString str; for ;it m con end ;it++ { CString buf; str + it >second ConName; str + T " " ; str + it >second value; str + T " r n" ; } return str; } void CCtrlCon::Load CString str { int istart 0; while istart 1 { CString buf str Tokenize T " r n" istart ; if buf Find T " " > 0 { int istart2 0; CString ConName buf Tokenize T " " istart2 ; CString ConValue buf Tokenize T " " istart2 ; Set ConName ConValue ; } } } void CCtrlCon::AutoCreateFile CString path { CString pathname m cfg return pathname path ; 判断是否有文件如果没有创建一个 CFileFind filefind; if filefind FindFile pathname { int len pathname GetLength ; while pathname Mid len 1 1 " " { len ; pathname pathname Left len ; } CString filename pathname; int path num filename ReverseFind " " ; 从右边找 filename filename Left path num ; if filefind FindFile pathname { AutoCreateFile pathname ; } CreateDirectory pathname NULL ; } } void CCtrlCon::SaveCon CString path CString ConName { 判断是否有文件如果没有创建一个 AutoCreateFile path ; map<CString Con>::iterator it; 如果保存配置名为空 if ConName "" { it m con begin ; 循环遍历整个结构 for ;it m con end ;it++ 是否保存 if it >second save true 写入INI WritePrivateProfileString T "配置" it >second ConName it >second value path ; } else { 不为空则查找单项 it m con find ConName ; if it m con end 是否保存 if it >second save true 写入INI WritePrivateProfileString T "配置" it >second ConName it >second value path ; } } 文件读取到变量 bool CCtrlCon::ReadCon CString path CString ConName { 判断是否有文件 CFileFind filefind; if filefind FindFile path { TRACE "没有配置文件 %s 无法读取" path ; return false; } map<CString Con>::iterator it; if ConName T "" { it m con begin ; for ;it m con end ;it++ { char value ; GetPrivateProfileString T "配置" it >second ConName T "error" value MAX TEXT path ; if cmp value T "error" 0 {it >second value value;} } } else { it m con find ConName ; char value ; GetPrivateProfileString T "配置" ConName T "error" value MAX TEXT path ; if cmp value T "error" 0 { it >second value value; } } 分配 显示 ConAlloc ; Show ; return true; } CString CCtrlCon::toc int i { CString m; m Format T "%d" i ; return m; } CString CCtrlCon::toc float i { CString m; m Format T "%f" i ; return m; } CString CCtrlCon::toc DWORD i { CString m; m Format T "%x" i ; return m; } int CCtrlCon:: SeacherList toke CString &name CString &list name { int x list name Find T "&" ; int y list name Find T "^" ; if x 1 && y 1 { return 1; } if x 0 && y 1 { y list name Find T "&" x+1 ; if y 1 name list name Mid x+1 ; else name list name Mid x+1 y 1 ; x list name Find T "&" x+1 ; if x 1 list name T "" ; else list name list name Mid x ; return 1; } else if y 0 && x 1 { x list name Find T "^" y+1 ; if x 1 name list name Mid y+1 ; else name list name Mid y+1 x 1 ; y list name Find T "^" y+1 ; if y 1 list name T "" ; else list name list name Mid y ; return 2; } if x < y { x list name Find T "&" 1 ; y list name Find T "^" 1 ; int z 0; if x > 0 && y 1 z x; else if y > 0 && x 1 z y; else if x < y z x; else if y < x z y; name list name Mid 1 z 1 ; list name list name Mid z ; return 1; } else if y < x { x list name Find T "&" 1 ; y list name Find T "^" 1 ; int z 0; if x > 0 && y 1 z x; else if y > 0 && x 1 z y; else if x < y z x; else if y < x z y; name list name Mid 1 z 1 ; list name list name Mid z ; return 2; } return 0; } bool CCtrlCon::SeacherList CString list name CString name 前面是列表 后面是搜索的值 { CString buf name; CString buf list name; CString one name; 剔除非法字符 name Replace T " r" T "" ; name Replace T " n" T "" ; name Replace T " " T "" ; int z name Find T " " ; 查找是否有“ ”号 if z 0 { int iStart 0; name Replace T " " T "" ; 去除" "号 int x name Find T "&" ; 查找是否有"&"分隔符 int y name Find T "^" ; 查找是否有"^"分隔符 if x 1 && y 1 如果2个都没有 { if list name Find name > 0 return true; else return false; } else if x > 0 && y 1 { one name name Mid 0 x ; buf list name name Mid x ; } else if y > 0 && x 1 { one name name Mid 0 y ; buf list name name Mid y ; } else if x < y { one name name Mid 0 x ; buf list name name Mid x ; } else if y < x { one name name Mid 0 y ; buf list name name Mid y ; } if list name Find one name 1 return false; int m SeacherList toke buf name buf list name ; while m>0 { if m 1 { if buf name Find T "$" 1 { if list name Find buf name 1 { return false; } } else { bool tag false; iStart 0; do { CString buf buf name Tokenize T "$" iStart ; if list name Find buf > 0 && buf T "" { tag true; } } while iStart 1 ; if tag false { return false; } } } if m 2 { if buf name Find T "$" 1 { if list name Find buf name > 0 { return false; } } else { bool tag false; iStart 0; do { CString buf buf name Tokenize T "$" iStart ; if list name Find buf > 0 && buf T "" { tag true; } } while iStart 1 ; if tag true { return false; } } } m SeacherList toke buf name buf list name ; } if m 1 { if name list name { 匹配 直接返回真 return true; } } return true; } else { if name list name { 匹配 直接返回真 return true; } } 第一个字符不是“ ”号 为完全匹配 return false; } int CCtrlCon::com sam float x1 float y1 float x2 float y2 { float x fabs x1 x2 ; float y fabs y1 y2 ; float z sqrt pow x 2 + pow y 2 ; return int z; } char CCtrlCon::trim char ss { char p[512] {0}; int i j 0; strcpy s p MAX PATH ss ; memset ss 0x00 strlen ss ; for i 0; i< int strlen p +1; i++ if p[i] " " ss[j++] p[i]; return ss; } CString CCtrlCon::m cfg return pathname CString m { #ifdef UNICODE wchar t drive[100]; wchar t dir[100]; wchar t fname[100]; wchar t ext[100]; wchar t m1 {0}; m ReleaseBuffer ; wsplitpath s m drive dir fname ext ; CString l; l+ drive; l+ dir; l Replace T " " T " " ; return l; #else char drive[100]; char dir[100]; char fname[100]; char ext[100]; char m1 {0}; USES CONVERSION; m1 m GetBuffer ; m ReleaseBuffer ; splitpath s m1 drive dir fname ext ; CString l; l+ drive; l+ dir; l Replace T " " T " " ; return l; #endif } CString CCtrlCon::m cfg return filename CString m { #ifdef UNICODE wchar t drive[100]; wchar t dir[100]; wchar t fname[100]; wchar t ext[100]; wchar t m1 {0}; m ReleaseBuffer ; wsplitpath s m drive dir fname ext ; CString l; l+ fname; l+ ext; l Replace T " " T " " ; return l; #else char drive[100]; char dir[100]; char fname[100]; char ext[100]; char m1 {0}; USES CONVERSION; m1 m GetBuffer ; m ReleaseBuffer ; splitpath s m1 drive dir fname ext ; CString l; l+ fname; l+ ext; l Replace T " " T " " ; return l; #endif } CString CCtrlCon::Return Path CString modulename { #ifdef UNICODE wchar t buf[250] {0}; #else char buf[250] {0}; #endif HMODULE H; if modulename T "" { GetModuleFileName NULL buf 250 ; return m cfg return pathname buf ; } else { H GetModuleHandle modulename ; char m ; GetModuleFileName H m 100 ; return m cfg return pathname m ; } } CString CCtrlCon::ReadPathFile CString PathName 读取文件 { CFile file; #ifdef UNICODE wchar t m buf[65565] {0}; #else char m buf[65565] {0}; #endif if file Open PathName CFile::modeRead|CFile::shareDenyNone { return T "" ; } ULONGLONG file len file GetLength ; file Read m buf UINT file len ; file Close ; return m buf; } void CCtrlCon::WritePathFile CString PathName CString config 写入文件 { CFileFind filefind; if filefind FindFile m cfg return pathname PathName { CreateDirectory m cfg return pathname PathName NULL ; } CFile file PathName CFile::modeCreate|CFile::modeWrite ; file Write config config GetLength ; file Flush ; file Close ; } DWORD CCtrlCon::SetTimerFlag CString FlagName bool value 时间标记 { map<CString DWORD>::iterator it m timer find FlagName ; if it m timer end { DWORD timer GetTickCount it >second; if value it >second GetTickCount ; return timer; } else { m timer insert map<CString DWORD>::value type FlagName 0 ; return GetTickCount ; } }">#include "StdAfx h" #include "CtrlCon h" #include "shlwapi h" #include "math h" CCtrlCon::CCtrlCon void { } CCtrlCon:: CCtrlCon void { } void CCtrlCon::Register HWND CtrlHwnd CString ConName int Ctrlid int Ctrltype int ConMode bool save bool set { [更多]
...展开详情收缩
2015-03-12 上传大小:81KB
分享
收藏 举报

热点文章

下载码下载
做任务获取下载码
取消 提交下载码
img

spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip

资源所需积分/C币 当前拥有积分 当前拥有C币
5 0 0
点击完成任务获取下载码
输入下载码
为了良好体验,不建议使用迅雷下载
img

c++外挂类的封装

会员到期时间: 剩余下载个数: 剩余C币: 剩余积分:0
为了良好体验,不建议使用迅雷下载
VIP下载
您今日下载次数已达上限(为了良好下载体验及使用,每位用户24小时之内最多可下载20个资源)

积分不足!

资源所需积分/C币 当前拥有积分
您可以选择
开通VIP
4000万
程序员的必选
600万
绿色安全资源
现在开通
立省522元
或者
购买C币兑换积分 C币抽奖
img

资源所需积分/C币 当前拥有积分 当前拥有C币
5 4 45
为了良好体验,不建议使用迅雷下载
确认下载
img

资源所需积分/C币 当前拥有积分 当前拥有C币
1 0 0
为了良好体验,不建议使用迅雷下载
VIP和C币套餐优惠
img

资源所需积分/C币 当前拥有积分 当前拥有C币
5 4 45
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
确认下载
下载
您还未下载过该资源
无法举报自己的资源

兑换成功

你当前的下载分为234开始下载资源
你还不是VIP会员
开通VIP会员权限,免积分下载
立即开通

你下载资源过于频繁,请输入验证码

您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:webmaster@csdn.net!

举报

  • 举报人:
  • 被举报人:
  • *类型:
    • *投诉人姓名:
    • *投诉人联系方式:
    • *版权证明:
  • *详细原因: