📄 obtainkey.cpp
字号:
// ObtainKey.cpp : implementation file
//
#include "stdafx.h"
#include "UserKey.h"
#include "ObtainKey.h"
#include "AllControlSheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CObtainKey property page
IMPLEMENT_DYNCREATE(CObtainKey, CPropertyPage)
CObtainKey::CObtainKey() : CPropertyPage(CObtainKey::IDD)
{
//{{AFX_DATA_INIT(CObtainKey)
m_filePath = _T("");
m_searchResult = _T("");
m_ipAddress = _T("");
try
{
InitDialog();
}
catch(CException e)
{
char szCause[255];
e.GetErrorMessage(szCause, 255);
}
//}}AFX_DATA_INIT
}
CObtainKey::~CObtainKey()
{
}
void CObtainKey::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CObtainKey)
DDX_Text(pDX, IDC_FILEPATH, m_filePath);
DDX_Text(pDX, IDC_SEARCHRESULT, m_searchResult);
DDX_Text(pDX, IDC_IPADDRESS, m_ipAddress);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CObtainKey, CPropertyPage)
//{{AFX_MSG_MAP(CObtainKey)
ON_BN_CLICKED(IDC_OPENFILE, OnOpenfile)
ON_BN_CLICKED(ID_SEARCH, OnSearch)
ON_BN_CLICKED(IDC_SEARCH2,OnSearch2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CObtainKey message handlers
void CObtainKey::OnOpenfile()
{
// TODO: Add your control notification handler code here
char BASED_CODE szFilter[] = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||";
CString filePath ;
CFileDialog * fDlg = new CFileDialog(true,NULL,NULL,OFN_OVERWRITEPROMPT,
szFilter,NULL);
fDlg->DoModal();
filePath = fDlg->GetPathName();
m_filePath = filePath;
UpdateData(false);
}
void CObtainKey::OnSearch()
{
// TODO: Add your control notification handler code here
if(m_filePath == "")
{
AfxMessageBox("请先选择字典文件!");
return;
}
m_password = m_ado.GenerateKey(m_filePath,m_ipAddress);
pwd = m_password;
ip = m_ipAddress;
CString m_str1 = "用户名:SA \r\n";
CString m_str2 = "密码:"+m_password;
m_searchResult = m_str1 + m_str2;
UpdateData(false);
}
void CObtainKey::InitDialog()
{
m_selectIP.DoModal();
m_ipAddress = m_selectIP.GetIPAddress();
}
CString CObtainKey::GetPassword()
{
return pwd;
}
CString CObtainKey::GetIPAddress()
{
return ip;
}
void CObtainKey::OnSearch2()
{
m_password = m_ado.NewGenerateKey(m_ipAddress);
pwd = m_password;
ip = m_ipAddress;
CString m_str1 = "用户名:SA \r\n";
CString m_str2 = "密码:"+m_password;
m_searchResult = m_str1 + m_str2;
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -