?? showinfo.cpp
字號:
// ShowInfo.cpp : implementation file
//
#include "stdafx.h"
#include "pictalk.h"
#include "ShowInfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShowInfo dialog
CShowInfo::CShowInfo(CWnd* pParent /*=NULL*/)
// : CExpandingDialog(CShowInfo::IDD, pParent)
: CExpandingDialog(CShowInfo::IDD, pParent,IDC_DEFDLG,IDC_BUTTON_EXT,
_T(">>"),_T("<<"))
{
//{{AFX_DATA_INIT(CShowInfo)
m_Address = _T("");
m_IcqNum = _T("");
m_IP = _T("");
m_IPAddress = _T("");
m_Name = _T("");
m_Sex = _T("");
m_nAge = 0;
m_Job = _T("");
//}}AFX_DATA_INIT
m_pParent=pParent;
}
void CShowInfo::DoDataExchange(CDataExchange* pDX)
{
CExpandingDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CShowInfo)
DDX_Text(pDX, IDC_ADDRESS, m_Address);
DDX_Text(pDX, IDC_ICQ_NUM, m_IcqNum);
DDX_Text(pDX, IDC_IP, m_IP);
DDX_Text(pDX, IDC_IPADDRESS, m_IPAddress);
DDX_Text(pDX, IDC_NAME, m_Name);
DDX_Text(pDX, IDC_SEX, m_Sex);
DDX_Text(pDX, IDC_AGE, m_nAge);
DDX_Text(pDX, IDC_JJOB, m_Job);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShowInfo, CExpandingDialog)
//{{AFX_MSG_MAP(CShowInfo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShowInfo message handlers
void CShowInfo::OnCancel()
{
if(m_pParent!=NULL){
m_pParent->PostMessage(WM_SHOWINFOCLOSE,IDCANCEL);
}
else{
CExpandingDialog::OnCancel();
}
CExpandingDialog::OnCancel();
}
BOOL CShowInfo::OnInitDialog()
{
CExpandingDialog::OnInitDialog();
// TODO: Add extra initialization here
CString filename="ipp.txt";
CStdioFile file;
if(file.Open(filename,CFile::modeRead)==0){
AfxMessageBox("讀取文件失敗",MB_OK);
}
CString str;
file.ReadString(str);
while(str!=""){
IpStruct ips;
ips.m_From=str.Left(15);
ips.m_TO=str.Mid(16,15);
ips.m_Add=str.Mid(32);
m_IPList.Add(ips);
file.ReadString(str);
}
file.Close();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CShowInfo::FindIP(CString str)
{
while(str.Find('.',0)<3)
str.Insert(0,'0');
while(str.Find('.',4)<7)
str.Insert(4,'0');
while(str.Find('.',8)<11)
str.Insert(8,'0');
while(str.GetLength()<15)
str.Insert(12,'0');
int i;
IpStruct IpLast;
IpLast.m_From="000.000.000.000";
IpLast.m_TO="255.255.255.255";
IpLast.m_Add="內部局域網";
for(i=0;i<m_IPList.GetSize();i++)
if(m_IPList[i].Check(str))
if(m_IPList[i].m_From>=IpLast.m_From &&
m_IPList[i].m_TO<=IpLast.m_TO)
IpLast=m_IPList[i];
m_IPAddress="IP來自:"+IpLast.m_Add;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -