?? property6.cpp
字號:
// Property6.cpp : implementation file
//
#include "stdafx.h"
#include "Sjsys.h"
#include "Property6.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CProperty6 property page
IMPLEMENT_DYNCREATE(CProperty6, CPropertyPage)
CProperty6::CProperty6() : CPropertyPage(CProperty6::IDD)
{
//{{AFX_DATA_INIT(CProperty6)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CProperty6::~CProperty6()
{
}
void CProperty6::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProperty6)
DDX_Control(pDX, IDC_LIST1, m_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProperty6, CPropertyPage)
//{{AFX_MSG_MAP(CProperty6)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProperty6 message handlers
BOOL CProperty6::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
m_list.SetExtendedStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_EX_TOOLWINDOW|WS_BORDER|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
m_list.InsertColumn(0,"ID號",LVCFMT_LEFT,80);
m_list.InsertColumn(1,"日期時間",LVCFMT_LEFT,100);
m_list.InsertColumn(2,"機器名稱",LVCFMT_LEFT,80);
m_list.InsertColumn(3,"訪問標志",LVCFMT_LEFT,80);
m_list.InsertColumn(4,"QQ命令字串",LVCFMT_LEFT,130);
m_list.InsertColumn(5,"源QQ號碼",LVCFMT_LEFT,100);
m_list.InsertColumn(4,"目的QQ號碼",LVCFMT_LEFT,100);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CProperty6::OnSetActive()
{
// TODO: Add your specialized code here and/or call the base class
if(m_deviceid=="")
{
return true;
}
RefreshData();
return CPropertyPage::OnSetActive();
}
void CProperty6::RefreshData()
{
m_list.DeleteAllItems();
m_list.SetRedraw(FALSE);
m_pRecordset.CreateInstance(__uuidof(Recordset));
try
{
CString SQLStr="select Netconnectdetail.ID,Netconnectdetail.Status,Netconnectdetail.Deviceid,Netconnectdetail.Datetime,Netconnectdetail.Descr from Netconnectdetail,Device where Netconnectdetail.Deviceid=Device.ID and Netconnectdetail.Name='游戲' and Device.Devicename='"+m_deviceid+"'";
m_pRecordset->Open((LPTSTR)SQLStr.GetBuffer(130),
((CSjsysApp*)AfxGetApp())->pConnection.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);//打開查詢結果記錄集
int i=0;
int nItem=0;
CString str;
while(!(m_pRecordset->adoEOF))
{
nItem=m_list.InsertItem(i,(LPCSTR)_bstr_t(m_pRecordset->GetCollect("ID")));//
m_list.SetItemText(nItem,1,(LPCSTR)_bstr_t(m_pRecordset->GetCollect("Datetime")));
m_list.SetItemText(nItem,2,(LPCSTR)_bstr_t(m_pRecordset->GetCollect("Deviceid")));
str=(LPCSTR)_bstr_t(m_pRecordset->GetCollect("Status"));
if(str=="1")
str="放行";
else
str="禁止";
m_list.SetItemText(nItem,3,str); //
m_list.SetItemText(nItem,4,(LPCSTR)_bstr_t(m_pRecordset->GetCollect("Descr")));
m_pRecordset->MoveNext();
i++;
}
m_pRecordset->Close();
}
catch(_com_error e)///捕捉異常
{
CString errormessage;
MessageBox("創建記錄集失敗!","錯誤");
}
m_list.SetRedraw(TRUE);
}
int CProperty6::GetIndex()
{
POSITION pos=m_list.GetFirstSelectedItemPosition();
if(pos)
{
int index=m_list.GetNextSelectedItem(pos);
return index;
}
return -1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -