📄 pindlg.cpp
字号:
// PINDlg.cpp : implementation of the CPINDlg class
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include "PINDlg.h"
LRESULT CPINDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
// center the dialog on the screen
CenterWindow();
// set icons
HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
SetIcon(hIcon, TRUE);
HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
SetIcon(hIconSmall, FALSE);
return TRUE;
}
LRESULT CPINDlg::OnBnClickedOk(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
// TODO: Add your control notification handler code here
int tmp = 0;
DWORD dwLockingFacility = 0;
static int nPINNum = 0;
LPTSTR lpSimPIN = NULL;
LPTSTR lpOutbuf = NULL;
//通过Edit Control Box来获得PIN码(MSDN)
GetDlgItemText(
IDC_EDIT_PIN,
lpSimPIN,
9);
//Method 1
result = SimUnlockPhone(m_hSim, lpSimPIN, NULL);
if ( FAILED(result) )
{
tmp = 3 - (++nPINNum);
if (!tmp)
{
MessageBoxW(_T("You have NO chances to enter PIN. The PIN will be blocked!"), _T("Warning"), MB_OK|MB_ICONERROR);
exit(1);
}
wsprintf(lpOutbuf, L"Now,there's only %d chances left", tmp);
MessageBoxW(lpOutbuf, _T("Note"), MB_OK|MB_ICONERROR);
}
//Method 2
// SimUnlockPhone(m_hSim, PIN, NULL);
return 0;
}
LRESULT CPINDlg::OnBnClickedCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
// TODO: Add your control notification handler code here
EndDialog(wID);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -