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

📄 keyshortcuts.cpp

📁 AVI这个软件是用VC编写的
💻 CPP
字号:
// Keyshortcuts.cpp : implementation file
//

#include "stdafx.h"
#include "vscap.h"
#include "Keyshortcuts.h"

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

extern UINT keyRecordStart;
extern UINT keyRecordEnd;
extern UINT keyRecordCancel;

UINT keyRecordStartLocal;
UINT keyRecordEndLocal;
UINT keyRecordCancelLocal;



/////////////////////////////////////////////////////////////////////////////
// Keyshortcuts dialog


Keyshortcuts::Keyshortcuts(CWnd* pParent /*=NULL*/)
	: CDialog(Keyshortcuts::IDD, pParent)
{
	//{{AFX_DATA_INIT(Keyshortcuts)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void Keyshortcuts::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Keyshortcuts)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Keyshortcuts, CDialog)
	//{{AFX_MSG_MAP(Keyshortcuts)
	ON_CBN_SELCHANGE(IDC_STOPKEY, OnSelchangeStopkey)
	ON_CBN_SELCHANGE(IDC_CANCELKEY, OnSelchangeCancelkey)
	ON_CBN_SELCHANGE(IDC_RECORDKEY, OnSelchangeRecordkey)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Keyshortcuts message handlers

void Keyshortcuts::OnOK() 
{
	// TODO: Add extra validation here
	keyRecordStart = keyRecordStartLocal;
	keyRecordEnd = keyRecordEndLocal;
	keyRecordCancel = keyRecordCancelLocal;

	
	CDialog::OnOK();
}

BOOL Keyshortcuts::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	keyRecordStartLocal = keyRecordStart;
	keyRecordEndLocal = keyRecordEnd;
	keyRecordCancelLocal = keyRecordCancel;

	int nx = GetIndex(keyRecordStart);
	((CComboBox *) GetDlgItem(IDC_RECORDKEY))->SetCurSel(nx);

	nx = GetIndex(keyRecordEnd);
	((CComboBox *) GetDlgItem(IDC_STOPKEY))->SetCurSel(nx);

	nx = GetIndex(keyRecordCancel);
	((CComboBox *) GetDlgItem(IDC_CANCELKEY))->SetCurSel(nx);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


int Keyshortcuts::GetIndex(UINT keyShortCut) {
	
	int index = 0;

	switch (keyShortCut) {

		case VK_F1 :  index = 0; break;
		case VK_F2 :  index = 1; break;
		case VK_F3 :  index = 2; break;
		case VK_F4 :  index = 3; break;
		case VK_F5 :  index = 4; break;
		case VK_F6 :  index = 5; break;
		case VK_F7 :  index = 6; break;
		case VK_F8 :  index = 7; break;
		case VK_F9 :  index = 8; break;
		case VK_F10 :  index = 9; break;			
		case VK_F11 :  index = 10; break;
		case VK_F12 :  index = 11; break;
		case 'A' :  index = 12; break;
		case 'B' :  index = 13; break;
		case 'C' :  index = 14; break;
		case 'D' :  index = 15; break;
		case 'E' :  index = 16; break;
		case 'F' :  index = 17; break;
		case 'G' :  index = 18; break;
		case 'H' :  index = 19; break;
		case 'I' :  index = 20; break;
		case 'J' :  index = 21; break;
		case 'K' :  index = 22; break;
		case 'L' :  index = 23; break;
		case 'M' :  index = 24; break;
		case 'N' :  index = 25; break;
		case 'O' :  index = 26; break;
		case 'P' :  index = 27; break;
		case 'Q' :  index = 28; break;
		case 'R' :  index = 29; break;
		case 'S' :  index = 30; break;
		case 'T' :  index = 31; break;
		case 'U' :  index = 32; break;
		case 'V' :  index = 33; break;
		case 'W' :  index = 34; break;
		case 'X' :  index = 35; break;
		case 'Y' :  index = 36; break;
		case 'Z' :  index = 37; break;		
		case '1' :  index = 38; break;
		case '2' :  index = 39; break;
		case '3' :  index = 40; break;
		case '4' :  index = 41; break;
		case '5' :  index = 42; break;
		case '6' :  index = 43; break;
		case '7' :  index = 44; break;
		case '8' :  index = 45; break;
		case '9' :  index = 46; break;
		case '0' :  index = 47; break;		
		case VK_NUMPAD0  :  index = 48; break;
		case VK_NUMPAD1  :  index = 49; break;
		case VK_NUMPAD2  :  index = 50; break;
		case VK_NUMPAD3  :  index = 51; break;
		case VK_NUMPAD4  :  index = 52; break;
		case VK_NUMPAD5  :  index = 53; break;
		case VK_NUMPAD6  :  index = 54; break;
		case VK_NUMPAD7  :  index = 55; break;
		case VK_NUMPAD8  :  index = 56; break;
		case VK_NUMPAD9  :  index = 57; break;
		case VK_MENU  :  index = 58; break;
		case VK_SHIFT  :  index = 59; break;
		case VK_CONTROL  :  index = 60; break;
		case VK_ESCAPE  :  index = 61; break;
		case VK_HOME  :  index = 62; break;
		case VK_INSERT  :  index = 63; break;		
		case VK_DELETE  :  index = 64; break;
		case VK_END  :  index = 65; break;
		case VK_RETURN  :  index = 66; break;
		case VK_SPACE  :  index = 67; break;
		case VK_TAB  :  index = 68; break;

	}
	
	
	return index;
	
	
};


UINT Keyshortcuts::GetCode(int index) {
	
	int vcode = 0;

	switch (index) {

		case  0 : vcode = VK_F1; break;
		case  1 : vcode = VK_F2; break;
		case  2 : vcode = VK_F3; break;
		case  3 : vcode = VK_F4; break;
		case  4 : vcode = VK_F5; break;
		case  5 : vcode = VK_F6; break;
		case  6 : vcode = VK_F7; break;
		case  7 : vcode = VK_F8; break;
		case  8 : vcode = VK_F9; break;
		case  9 : vcode = VK_F10; break;
		case  10 : vcode = VK_F11; break;
		case  11 : vcode = VK_F12; break;
		case  12 : vcode = 'A'; break;
		case  13 : vcode = 'B'; break;
		case  14 : vcode = 'C'; break;
		case  15 : vcode = 'D'; break;
		case  16 : vcode = 'E'; break;
		case  17 : vcode = 'F'; break;
		case  18 : vcode = 'G'; break;
		case  19 : vcode = 'H'; break;
		case  20 : vcode = 'I'; break;
		case  21 : vcode = 'J'; break;
		case  22 : vcode = 'K'; break;
		case  23 : vcode = 'L'; break;
		case  24 : vcode = 'M'; break;
		case  25 : vcode = 'N'; break;
		case  26 : vcode = 'O'; break;
		case  27 : vcode = 'P'; break;
		case  28 : vcode = 'Q'; break;
		case  29 : vcode = 'R'; break;
		case  30 : vcode = 'S'; break;
		case  31 : vcode = 'T'; break;
		case  32 : vcode = 'U'; break;
		case  33 : vcode = 'V'; break;
		case  34 : vcode = 'W'; break;
		case  35 : vcode = 'X'; break;
		case  36 : vcode = 'Y'; break;
		case  37 : vcode = 'Z'; break;
		case  38 : vcode = '1'; break;
		case  39 : vcode = '2'; break;
		case  40 : vcode = '3'; break;
		case  41 : vcode = '4'; break;
		case  42 : vcode = '5'; break;
		case  43 : vcode = '6'; break;
		case  44 : vcode = '7'; break;
		case  45 : vcode = '8'; break;
		case  46 : vcode = '9'; break;
		case  47 : vcode = '0'; break;
		case  48 : vcode = VK_NUMPAD0 ; break;
		case  49 : vcode = VK_NUMPAD1 ; break;
		case  50 : vcode = VK_NUMPAD2 ; break;
		case  51 : vcode = VK_NUMPAD3 ; break;
		case  52 : vcode = VK_NUMPAD4 ; break;
		case  53 : vcode = VK_NUMPAD5 ; break;
		case  54 : vcode = VK_NUMPAD6 ; break;
		case  55 : vcode = VK_NUMPAD7 ; break;
		case  56 : vcode = VK_NUMPAD8 ; break;
		case  57 : vcode = VK_NUMPAD9 ; break;
		case  58 : vcode = VK_MENU ; break;
		case  59 : vcode = VK_SHIFT ; break;
		case  60 : vcode = VK_CONTROL ; break;
		case  61 : vcode = VK_ESCAPE ; break;
		case  62 : vcode = VK_HOME ; break;
		case  63 : vcode = VK_INSERT ; break;
		case  64 : vcode = VK_DELETE ; break;
		case  65 : vcode = VK_END ; break;
		case  66 : vcode = VK_RETURN ; break;
		case  67 : vcode = VK_SPACE ; break;
		case  68 : vcode = VK_TAB ; break;

	}
	
	return vcode;	
	
};



void Keyshortcuts::OnSelchangeStopkey() 
{
	// TODO: Add your control notification handler code here	
	int index = ((CComboBox *) GetDlgItem(IDC_STOPKEY))->GetCurSel();
	UINT vcode = GetCode(index);
	CString msgstr;

	if (vcode==keyRecordStartLocal) {

		msgstr.LoadString(ID_KEY_USED_PAUSE);
		MessageBox(msgstr);
	
		int nx = GetIndex(keyRecordEndLocal);
		((CComboBox *) GetDlgItem(IDC_STOPKEY))->SetCurSel(nx);
		return;


	}
		
	if (vcode==keyRecordCancelLocal) {

		msgstr.LoadString(ID_KEY_USED_CANCEL);
		MessageBox(msgstr);
		
		int nx = GetIndex(keyRecordEndLocal);
		((CComboBox *) GetDlgItem(IDC_STOPKEY))->SetCurSel(nx);
		return;
	}

	keyRecordEndLocal = vcode;
	
}


void Keyshortcuts::OnSelchangeCancelkey() 
{
	// TODO: Add your control notification handler code here
	int index = ((CComboBox *) GetDlgItem(IDC_CANCELKEY))->GetCurSel();
	UINT vcode = GetCode(index);
	CString msgstr;

	if (vcode==keyRecordStartLocal) {

		msgstr.LoadString(ID_KEY_USED_PAUSE);
		MessageBox(msgstr);
	
		int nx = GetIndex(keyRecordCancelLocal);
		((CComboBox *) GetDlgItem(IDC_CANCELKEY))->SetCurSel(nx);
		return;

	}
		
	if (vcode==keyRecordEndLocal) {
		
		msgstr.LoadString(ID_KEY_USED_STOP);
		MessageBox(msgstr);	
		
		int nx = GetIndex(keyRecordCancelLocal);
		((CComboBox *) GetDlgItem(IDC_CANCELKEY))->SetCurSel(nx);
		return;
	}

	keyRecordCancelLocal = vcode;
	
}

void Keyshortcuts::OnSelchangeRecordkey() 
{
	// TODO: Add your control notification handler code here
	int index = ((CComboBox *) GetDlgItem(IDC_RECORDKEY))->GetCurSel();
	UINT vcode = GetCode(index);
	CString msgstr;

	if (vcode==keyRecordCancelLocal) {

		msgstr.LoadString(ID_KEY_USED_CANCEL);
		MessageBox(msgstr);
	
		int nx = GetIndex(keyRecordStartLocal);
		((CComboBox *) GetDlgItem(IDC_RECORDKEY))->SetCurSel(nx);
		return;

	}
		
	if (vcode==keyRecordEndLocal) {

		msgstr.LoadString(ID_KEY_USED_STOP);
		MessageBox(msgstr);	
		
		int nx = GetIndex(keyRecordStartLocal);
		((CComboBox *) GetDlgItem(IDC_RECORDKEY))->SetCurSel(nx);
		return;
	}

	keyRecordStartLocal = vcode;
	
}

⌨️ 快捷键说明

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