|
// DnsDialog.cpp : implementation file
//
#include "stdafx.h"
#include "Dns.h"
#include "DnsDialog.h"
#include ".\dnsdialog.h"
// CDnsDialog dialog
IMPLEMENT_DYNAMIC(CDnsDialog, CDialog)
CDnsDialog::CDnsDialog(INITPRM *params, CWnd* pParent /*=NULL*/)
: CDialog(CDnsDialog::IDD, pParent)
, m_options(0)
, m_ip4array(0)
{
this->params = params;
}
CDnsDialog::~CDnsDialog()
{
if (m_ip4array)
delete[] m_ip4array;
}
void CDnsDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT_NAME, m_name);
DDX_Control(pDX, IDC_LIST_OPTIONS, m_listoptions);
DDX_Text(pDX, IDC_EDIT_SERVER, m_server);
DDX_Control(pDX, IDC_EDIT_NAME, m_queryEdit);
DDX_Control(pDX, IDC_COMBO_TYPE, m_typeCombo);
}
BEGIN_MESSAGE_MAP(CDnsDialog, CDialog)
END_MESSAGE_MAP()
// CDnsDialog message handlers
BOOL CDnsDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
for (int i = 0; i < 13; i++)
m_listoptions.AddString(Options[i].title);
m_listoptions.SetSel(0);
RECT cr;
m_typeCombo.GetClientRect(&cr);
m_typeCombo.SetWindowPos(0, 0, 0, cr.right, cr.bottom + 12*10, SWP_NOMOVE | SWP_NOZORDER);
for (int i = 0; i < 55; i++)
m_typeCombo.AddString(Type[i].title);
m_typeCombo.SetCurSel(params->type);
m_server = params->servers;
m_name = params->name;
UpdateData(false);
m_queryEdit.SetFocus();
return false; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDnsDialog::OnOK()
{
// TODO: Add your specialized code here and/or call the base class
UpdateData();
m_type = Type[m_typeCombo.GetCurSel()].type;
m_options = 0;
for (int i = 0; i < 13; i++) {
if (m_listoptions.GetSel(i))
m_options |= Options[i].options;
}
params->name = m_name;
params->type = m_typeCombo.GetCurSel();
params->servers = m_server;
if (m_server != "") {
if (m_ip4array)
delete[] m_ip4array;
in_addr saddr;
if ((saddr.S_un.S_addr = inet_addr(m_server)) == INADDR_NONE) {
hostent *host = gethostbyname(m_server);
if (host) {
saddr = *((in_addr *)host->h_addr_list[0]);
} else {
CDialog::OnOK();
return;
}
}
m_ip4array = new IP4_ARRAY;
m_ip4array->AddrCount = 1;
m_ip4array->AddrArray[0] = saddr.S_un.S_addr;
m_options |= DNS_QUERY_BYPASS_CACHE;
}
CDialog::OnOK();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Highly skilled Engineer with 14 years of experience in academia, R&D and commercial product development supporting full software life-cycle from idea to implementation and further support. During my academic career I was able to succeed in MIT Computers in Cardiology 2006 international challenge, as a R&D and SW engineer gain CodeProject MVP, find algorithmic solutions to quickly resolve tough customer problems to pass product requirements in tight deadlines. My key areas of expertise involve Object-Oriented
Analysis and Design OOAD, OOP, machine learning, natural language processing, face recognition, computer vision and image processing, wavelet analysis, digital signal processing in cardiology.