www.pudn.com > vcsvr.rar > TagAdd.cpp
// TagAdd.cpp : implementation file // #include "stdafx.h" #include "vcsvr.h" #include "TagAdd.h" #include "TagDef.h" #include#include #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CTagAdd dialog CTagAdd::CTagAdd(CWnd* pParent /*=NULL*/) : CDialog(CTagAdd::IDD, pParent) { //{{AFX_DATA_INIT(CTagAdd) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CTagAdd::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTagAdd) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CTagAdd, CDialog) //{{AFX_MSG_MAP(CTagAdd) ON_WM_SHOWWINDOW() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CTagAdd message handlers //向标签列表增加地址标签 void CTagAdd::OnOK() { CString str; long vType, I; TIME_ZONE_INFORMATION tzi; SYSTEMTIME st; FILETIME ft; GetTimeZoneInformation(&tzi); GetSystemTime(&st); SystemTimeToTzSpecificLocalTime(&tzi,&st,&st); SystemTimeToFileTime(&st,&ft); CEdit *pWndEdit= (CEdit *)GetDlgItem(IDC_EDIT1); pWndEdit->GetWindowText(str); str.MakeLower(); str.TrimLeft(); str.TrimRight(); vType=5; CButton *pWndButton1= (CButton *)GetDlgItem(IDC_RADIO1); if(pWndButton1->GetCheck()==1) vType=5; CButton *pWndButton2= (CButton *)GetDlgItem(IDC_RADIO2); if(pWndButton2->GetCheck()==1) vType=11; CButton *pWndButton3= (CButton *)GetDlgItem(IDC_RADIO3); if(pWndButton3->GetCheck()==1) vType=8; if(TagCount>=MaxTagCount) { AfxMessageBox("标签数量不能大于256"); return; } if(str.IsEmpty()) { AfxMessageBox("标签标识不能为空..."); return; }; for(I=0;I<=TagCount;I++) { if(TagList[I].cID==str) { AfxMessageBox("标签标识不能重复..."); return; } } TagCount++; TagList[TagCount].bActive=false; TagList[TagCount].cID=str; TagList[TagCount].hHWND=-1; TagList[TagCount].lQuality=192; TagList[TagCount].ft=ft; TagList[TagCount].vType=vType; switch(vType) { case 5: TagList[TagCount].vValue.vt=VT_R4; TagList[TagCount].vValue.fltVal=0; break; case 8: TagList[TagCount].vValue.vt=VT_BSTR; TagList[TagCount].vValue.bstrVal=NULL; break; case 11: TagList[TagCount].vValue.vt=VT_BOOL; TagList[TagCount].vValue.boolVal=false; break; }; } //设置默认属性 void CTagAdd::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); CButton *pWndButton1= (CButton *)GetDlgItem(IDC_RADIO1); pWndButton1->SetCheck(1); }