📄 dogtestdlg.cpp
字号:
// dogtestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "dogtest.h"
#include "dogtestDlg.h"
#include "tlzj.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDogtestDlg dialog
CDogtestDlg::CDogtestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDogtestDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDogtestDlg)
m_HardID = _T("");
m_UserID = _T("");
m_Userinfo = _T("");
m_secretcode = _T("");
m_seedcode = _T("");
m_seedret = _T("");
m_mycode = _T("");
m_mycoderet = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CDogtestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDogtestDlg)
DDX_Control(pDX, IDC_BUTTON2, m_code);
DDX_Control(pDX, IDC_BUTTON1, m_seed);
DDX_Control(pDX, IDC_COMBO1, m_secrettype);
DDX_Text(pDX, IDC_EDIT1, m_HardID);
DDX_Text(pDX, IDC_EDIT2, m_UserID);
DDX_Text(pDX, IDC_EDIT3, m_Userinfo);
DDX_Text(pDX, IDC_EDIT4, m_secretcode);
DDX_Text(pDX, IDC_EDIT5, m_seedcode);
DDX_Text(pDX, IDC_EDIT6, m_seedret);
DDX_Text(pDX, IDC_EDIT7, m_mycode);
DDX_Text(pDX, IDC_EDIT8, m_mycoderet);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDogtestDlg, CDialog)
//{{AFX_MSG_MAP(CDogtestDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDogtestDlg message handlers
BOOL CDogtestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
//取硬件ID
DWORD hid = GetHardID(0x12345678);
m_HardID.Format("%X",hid);
//取用户ID
DWORD uid = GetUserID();
m_UserID.Format("%X",uid);
//取用户信息
char uinfo[25] ;
GetUserInfo(uinfo);
m_Userinfo = uinfo;
//暗码
m_secrettype.AddString("暗码0");
m_secrettype.AddString("暗码1");
m_secrettype.AddString("暗码2");
m_secrettype.AddString("暗码3");
//初始时取暗码0
m_secrettype.SelectString(-1,"暗码0");
OnSelchangeCombo1();
//显示出来
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CDogtestDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CDogtestDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CDogtestDlg::OnSelchangeCombo1()
{
// TODO: Add your control notification handler code here
DWORD secode = GetSecretCode(m_secrettype.GetCurSel());
m_secretcode.Format("%X",secode);
UpdateData(false);
}
void CDogtestDlg::OnButton1() //种子码算法
{
// TODO: Add your control notification handler code here
UpdateData(true);
DWORD seed,seedret;
sscanf(m_seedcode,"%x",&seed);
seedret = GetSeedCode(seed);
m_seedret.Format("%X",seedret);
UpdateData(false);
}
void CDogtestDlg::OnButton2() //自定义算法
{
// TODO: Add your control notification handler code here
UpdateData(true);
DWORD mycode,mycoderet;
sscanf(m_mycode,"%x",&mycode);
mycoderet = GetMyCode(mycode);
m_mycoderet.Format("%X",mycoderet);
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -