⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progressdlg.cpp

📁 SyncML 协议的同步实现的数据备份,是基于wince平台,,也可很容易移植到其它平台
💻 CPP
字号:
// progressdlg.cpp : implementation file
//

#include "stdafx.h"
#include "App_Sync728.h"
#include "progressdlg.h"
#include "pw.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#include "selectimetype.h"
/////////////////////////////////////////////////////////////////////////////
// CProgressDlg dialog


CProgressDlg::CProgressDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CProgressDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CProgressDlg)
	m_strMsg = _T("");
	m_strPassword = _T("");
	//}}AFX_DATA_INIT
	m_bOK = FALSE;
	m_nCount = 0;
}
/*
CProgressDlg::CProgressDlg(CApp_Sync728View *pSyncView, CWnd* pParent)
	: CDialog(CProgressDlg::IDD, pParent)
{
	m_pSyncView = pSyncView;
}
*/

void CProgressDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CProgressDlg)
	DDX_Text(pDX, IDC_STATIC_ERRMSG, m_strMsg);
	DDX_Text(pDX, IDC_EDIT_PASSWORD, m_strPassword);
	DDV_MaxChars(pDX, m_strPassword, 40);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
	//{{AFX_MSG_MAP(CProgressDlg)
	ON_BN_CLICKED(IDC_BUTTON_OK, OnButtonOk)
	ON_EN_CHANGE(IDC_EDIT_PASSWORD, OnChangeEditPassword)
	ON_BN_CLICKED(IDC_BUTTON_CANCLE, OnButtonCancle)
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_SYNC_MESSAGE, ShowMessage)
	ON_MESSAGE(WM_SYNC_PROGRESS, ShowProgress)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProgressDlg message handlers

BOOL CProgressDlg::OnInitDialog() 
{
	CRect rt;
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//m_pSyncView->m_hwndDlg = m_hWnd;

	//m_progressSync.SetRange(0, 99);
	//this->set
	GetWindowRect(&rt);	
	this->SetWindowPos(&wndTop,0,0,rt.Width(),rt.Height(),SWP_SHOWWINDOW);
	this->SetForegroundWindow();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CProgressDlg::ShowMessage(UINT wParam, LONG lParam)
{
	m_strMsg = (LPWSTR)lParam;
	UpdateData(FALSE);
} 

void CProgressDlg::ShowProgress(UINT wParam, LONG lParam)
{
	m_progressSync.SetPos(lParam);
} 

void CProgressDlg::OnButtonOk() 
{
	// TODO: Add your control notification handler code here
	m_bOK = CheckProtectPW((LPTSTR)(LPCTSTR)m_strPassword, m_strPassword.GetLength());
	m_nCount++;
	if (!m_bOK && m_nCount < 3)
	{
        TCHAR SZ1[80];
        LoadString(AfxGetInstanceHandle(), MESSAGE_MAIN_ERRORKEY, SZ1, sizeof(SZ1)/sizeof(TCHAR));
		m_strMsg = CString(SZ1);

		UpdateData(FALSE);
	}
	else
	{
		CDialog::OnOK();
	}
}

void CProgressDlg::OnChangeEditPassword() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
}

void CProgressDlg::OnButtonCancle() 
{
	// TODO: Add your control notification handler code here
	CDialog::OnCancel();
}

BOOL CProgressDlg::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	BOOL ret=CDialog::PreTranslateMessage(pMsg);

	if(pMsg->message==WM_LBUTTONDOWN)
	{
		UINT ctlID=::GetDlgCtrlID(pMsg->hwnd);
		switch(ctlID)
		{
		case IDC_EDIT_PASSWORD:
			YLImeShow(ENGLISH_IME);
			break;
		default:
			SipShowIM(SIPF_OFF);
			break;
		}
	}

	return ret;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -