DlgOptions.cpp
资源名称:GGBT.rar [点击查看]
上传用户:lds876
上传日期:2013-05-25
资源大小:567k
文件大小:4k
源码类别:
P2P编程
开发平台:
Visual C++
- // DlgOptions.cpp : implementation file
- //
- #include "stdafx.h"
- #include "testbt.h"
- #include "DlgOptions.h"
- #include "MainFrm.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgOptions dialog
- CDlgOptions::CDlgOptions(CWnd* pParent /*=NULL*/)
- : CPropertyPage(CDlgOptions::IDD)
- {
- m_dwHotKey = 0;
- //{{AFX_DATA_INIT(CDlgOptions)
- m_bHideTray = FALSE;
- //}}AFX_DATA_INIT
- }
- void CDlgOptions::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgOptions)
- DDX_Control(pDX, IDC_GROUP_HOTKEY, m_gpHotkey);
- DDX_Control(pDX, IDC_GROUP_FILEMAN, m_gpFileMan);
- DDX_Control(pDX, IDC_HOTKEY_BOSS, m_hkBoss);
- DDX_Check(pDX, IDC_CHECK_HIDE_TRAY, m_bHideTray);
- DDX_Control(pDX, IDC_COMBO_WHEN_SAMENAME_EXIST, m_cbSavenameExist);
- DDX_Control(pDX, IDC_COMBO_MOVETO_CATE, m_cbMovetoCate);
- DDX_Control(pDX, IDC_COMBO_DBCLICK_ITEM, m_cbDbclickItem);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgOptions, CPropertyPage)
- //{{AFX_MSG_MAP(CDlgOptions)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgOptions message handlers
- BOOL CDlgOptions::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
- m_hkBoss.SetRules(HKCOMB_NONE|// HKCOMB_A|
- HKCOMB_S|HKCOMB_CA|HKCOMB_SA|
- HKCOMB_SC|HKCOMB_SCA,HOTKEYF_CONTROL);
- m_hkBoss.SetFocus();
- for (int i=0; i<CSetupRegister::eSameNameCount; i++)
- m_cbSavenameExist.AddString(CSetupRegister::m_strOperSameName[i]);
- for (i=0; i<CSetupRegister::eMoveCateCount; i++)
- m_cbMovetoCate.AddString(CSetupRegister::m_strOperMovetoCate[i]);
- for (i=0; i<CSetupRegister::eDbclickCount; i++)
- m_cbDbclickItem.AddString(CSetupRegister::m_strOperDbclick[i]);
- return FALSE;
- }
- bool CDlgOptions::Apply()
- {
- UpdateData();
- UnregisterHotKey(AfxGetMainWnd()->GetSafeHwnd(), HOTKEY_ID);
- // must use Tray to restore mainframe.
- DWORD dwHotKey = m_hkBoss.GetHotKey();
- if (!dwHotKey)
- m_bHideTray = false;
- if (!::RegisterHotKey(AfxGetMainWnd()->GetSafeHwnd(), HOTKEY_ID, HIBYTE(dwHotKey), LOBYTE(dwHotKey)))
- {
- AfxMessageBox("注册热健失败");
- }
- m_dwHotKey = dwHotKey;
- return true;
- }
- void CDlgOptions::SetData(CSetupRegister *pSetupRegister)
- {
- m_bHideTray = pSetupRegister->m_bHideTray;
- m_dwHotKey = pSetupRegister->m_dwHotKey;
- m_hkBoss.SetHotKey(LOBYTE(m_dwHotKey), HIBYTE(m_dwHotKey));
- m_cbSavenameExist.SetCurSel(pSetupRegister->m_eOperSavenameExist);
- m_cbMovetoCate.SetCurSel(pSetupRegister->m_eOperMoveToCate);
- m_cbDbclickItem.SetCurSel(pSetupRegister->m_eOperDbclickItem);
- UpdateData(false);
- }
- void CDlgOptions::GetData(CSetupRegister *pSetupRegister)
- {
- UpdateData();
- pSetupRegister->m_bHideTray = m_bHideTray;
- pSetupRegister->m_dwHotKey = m_dwHotKey ;
- pSetupRegister->m_eOperSavenameExist = (CSetupRegister::eOperSameNameExist)m_cbSavenameExist.GetCurSel();
- pSetupRegister->m_eOperMoveToCate = (CSetupRegister::eOperMoveToCate)m_cbMovetoCate.GetCurSel();
- pSetupRegister->m_eOperDbclickItem = (CSetupRegister::eOperDbclickItem)m_cbDbclickItem.GetCurSel();
- }
- void CDlgOptions::OnOK()
- {
- GetParent()->SendMessage(WM_COMMAND, IDOK, 0);
- CPropertyPage::OnOK();
- }
- void CDlgOptions::OnCancel()
- {
- GetParent()->SendMessage(WM_COMMAND, IDCANCEL, 0);
- CPropertyPage::OnCancel();
- }
- /*******************************************************
- WORD VirtualKeyCode;
- WORD Modifiers;
- m_hkBoss.GetHotKey(VirtualKeyCode, Modifiers);
- if (VirtualKeyCode == 0)
- {
- // AfxMessageBox("请输入热健");
- // m_hkBoss.SetFocus();
- // return ;
- }
- ********************************************************/