📄 resolverthread.cpp
字号:
// ResolverThread.cpp : implementation file
//
#include "stdafx.h"
#include "Netmsg.h"
#include "ResolverThread.h"
#include "Conversation.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//the conversation dialog very nicely resolves the host of the person you are talking to.
//it's done here.
/////////////////////////////////////////////////////////////////////////////
// CResolverThread
CResolverThread::CResolverThread(IP Host, CConversation *Dlg)
{
m_Host = Host;
m_Dlg = Dlg;
}
CResolverThread::~CResolverThread()
{
}
BOOL CResolverThread::InitInstance()
{
char chost[4] = {m_Host.seg1, m_Host.seg2, m_Host.seg3, m_Host.seg4};
hostent *host;
host = gethostbyaddr(chost, 4, AF_INET);
if (host)
{
m_Dlg->HostResolved(host->h_name);
}
else
{
m_Dlg->HostResolved("Unable to resolve host");
}
PostThreadMessage(WM_QUIT, 0, 0);
return TRUE;
}
int CResolverThread::ExitInstance()
{
// TODO: perform any per-thread cleanup here
return CWinThread::ExitInstance();
}
BEGIN_MESSAGE_MAP(CResolverThread, CWinThread)
//{{AFX_MSG_MAP(CResolverThread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResolverThread message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -