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

📄 page2.cpp

📁 FTP探索工具源代码,内涵测试以及详细说明。
💻 CPP
字号:
// Page2.cpp : implementation file
//

#include "stdafx.h"
#include "Page.h"
#include "Page2.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPage2 property page

IMPLEMENT_DYNCREATE(CPage2, CPropertyPage)

CPage2::CPage2() : CPropertyPage(CPage2::IDD)
{

	//{{AFX_DATA_INIT(CPage2)
	m_check_minimize =(::GetPrivateProfileInt("Settings","bMinimized",0,".\\Settings.ini")==0 ?false:true);
	m_bTopMost = (::GetPrivateProfileInt("Settings","bTopMost",1,".\\Settings.ini")==0? false:true);
	//}}AFX_DATA_INIT
}

CPage2::~CPage2()
{
}

void CPage2::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPage2)
	DDX_Control(pDX, IDC_HOTKEY1, m_hotkey);
	DDX_Check(pDX, IDC_CHECK_MINIMIZE, m_check_minimize);
	DDX_Check(pDX, IDC_CHECK_TOPMOST, m_bTopMost);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPage2, CPropertyPage)
	//{{AFX_MSG_MAP(CPage2)
	ON_BN_CLICKED(IDC_CHECK_TOPMOST, OnCheckTopmost)
	ON_BN_CLICKED(IDC_CHECK_MINIMIZE, OnCheckMinimize)
	ON_WM_LBUTTONDOWN()
	ON_BN_CLICKED(IDC_SAVE, OnSave)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPage2 message handlers

void CPage2::OnCheckTopmost() 
{
	UpdateData(true);

	if(m_bTopMost)
	{
		AfxGetMainWnd()->SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
		m_bTopMost=true;
	}
	else
	{
		AfxGetMainWnd()->SetWindowPos(&CWnd::wndNoTopMost ,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
		m_bTopMost=false;
	}
		
	::WritePrivateProfileString("Settings","bTopMost",m_bTopMost ? "1":"0",".\\Settings.ini");

	
}


void CPage2::OnCheckMinimize() 
{
	UpdateData(true);
	::WritePrivateProfileString("Settings","bMinimized",m_check_minimize? "1":"0",".\\Settings.ini");

	
}



void CPage2::OnLButtonDown(UINT nFlags, CPoint point) 
{
   AfxGetMainWnd()->SendMessage(WM_NCLBUTTONDOWN,HTCAPTION,0);

	
	CPropertyPage::OnLButtonDown(nFlags, point);
}

void CPage2::OnSave() 
{
	UpdateData(TRUE);
	
	WORD virtualKey, systemKey;
	m_hotkey.GetHotKey(virtualKey, systemKey);
	
	CString strVirtualKey,strSystemKey;
	strVirtualKey.Format("%d",virtualKey);
	strSystemKey.Format("%d",systemKey);
	
	
	::WritePrivateProfileString("HotKey","HotkeyVK",strVirtualKey,".\\Settings.ini");
	::WritePrivateProfileString("HotKey","HotkeySystem",strSystemKey,".\\Settings.ini");
	
	UINT fsModifiers = 0;
	if (systemKey & HOTKEYF_ALT)
	{
		fsModifiers	|= MOD_ALT;
	}
	if (systemKey & HOTKEYF_CONTROL)
	{
		fsModifiers	|= MOD_CONTROL;
	}
	if (systemKey & HOTKEYF_SHIFT)
	{
		fsModifiers	|= MOD_SHIFT;
	}
	
	RegisterHotKey(AfxGetMainWnd()->m_hWnd, 400, fsModifiers, virtualKey);
}

BOOL CPage2::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

 	
	/*注*/		WORD virtualKey=::GetPrivateProfileInt("HotKey","HotkeyVK",0,".\\Settings.ini");
	/*册*/		WORD systemKey=::GetPrivateProfileInt("HotKey","HotkeySystem",0,".\\Settings.ini");
	/*系*/		m_hotkey.SetHotKey(virtualKey, systemKey);	
	/*统*/		
	/*热*/		UINT fsModifiers = NULL;		
	/*键*/		if (systemKey & HOTKEYF_ALT)// convert systemkeys to modifiers
	/**/		{
	/**/			fsModifiers	|= MOD_ALT;
	/**/		}
	/**/		if (systemKey & HOTKEYF_CONTROL)
	/**/		{
	/**/			fsModifiers	|= MOD_CONTROL;
	/**/		}
	/*注*/		if (systemKey & HOTKEYF_SHIFT)
	/*册*/		{
	/*系*/			fsModifiers	|= MOD_SHIFT;
	/*统*/		}
	/*热*/		RegisterHotKey(AfxGetMainWnd()->m_hWnd,400, fsModifiers, virtualKey);
	/*键*/		UpdateData(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CPage2::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CPropertyPage::PreTranslateMessage(pMsg);
}









CString CPage2::OSVer()
{
	OSVERSIONINFOEX os;
	::ZeroMemory(&os,sizeof(os));
	os.dwOSVersionInfoSize=sizeof(os);
	::GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&os));
	if(os.dwPlatformId==VER_PLATFORM_WIN32_NT && os.dwMajorVersion >=5)
		return "Win2000";
	if(os.dwPlatformId ==VER_PLATFORM_WIN32_WINDOWS)
		return "Win9x";
	
}


⌨️ 快捷键说明

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