// xdaunlockDlg.cpp : implementation file // #include "stdafx.h" #include "xdaunlock.h" #include "xdaunlockDlg.h" #include "gsmdevice.h" #include "debug.h" #include "unlocker.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CXdaUnlockDlg dialog CXdaUnlockDlg::CXdaUnlockDlg(CWnd* pParent /*=NULL*/) : CDialog(CXdaUnlockDlg::IDD, pParent) { //{{AFX_DATA_INIT(CXdaUnlockDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CXdaUnlockDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CXdaUnlockDlg) DDX_Control(pDX, IDC_EDIT_UNLOCK_CODE, m_cUnlockCode); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CXdaUnlockDlg, CDialog) //{{AFX_MSG_MAP(CXdaUnlockDlg) ON_BN_CLICKED(IDC_BUTTON_GETCODE, OnButtonGetCode) ON_BN_CLICKED(IDC_BUTTON_UNLOCK, OnButtonUnlock) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CXdaUnlockDlg message handlers BOOL CXdaUnlockDlg::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 CenterWindow(GetDesktopWindow()); // center to the hpc screen return TRUE; // return TRUE unless you set the focus to a control } void CXdaUnlockDlg::OnButtonGetCode() { CString code; if (!m_unlocker.GetUnlockCode(code)) m_cUnlockCode.SetWindowText(L"ERROR"); else m_cUnlockCode.SetWindowText(code); } void CXdaUnlockDlg::OnButtonUnlock() { CString code; m_cUnlockCode.GetWindowText(code); if (m_unlocker.DoUnlock(code)) MessageBox(L"unlocked!"); else MessageBox(L"error"); }