当前位置: 首页>>代码示例>>C++>>正文


C++ CAction::GetKeyElement方法代码示例

本文整理汇总了C++中CAction::GetKeyElement方法的典型用法代码示例。如果您正苦于以下问题:C++ CAction::GetKeyElement方法的具体用法?C++ CAction::GetKeyElement怎么用?C++ CAction::GetKeyElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAction的用法示例。


在下文中一共展示了CAction::GetKeyElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ExecuteThread

// поток на выполнение...
UINT ExecuteThread(LPVOID pParam)
{
	HWND hServer=hServer_;
	HWND hTarget=hTarget_;
	CGesture* pGesture=pGesture_;

	// *** выпоняем
	// сообщаяем главному окну
	PostMessage(hServer,WM_IDENTIFY,(WPARAM)1,(LPARAM)pGesture);
	CAction* pAction;
	for(int i=0;i<pGesture->m_Commands.m_nActions;i++)
	{
		pAction=&pGesture->m_Commands.m_Actions[i];
		switch(pAction->m_Type)
		{
			case 0:
			{
				CString &s=pAction->m_Param[0];
				if(s==_T("Close"))
				{
					PressHotKey(VK_F4,VK_MENU);
					//PostMessage(m_hClientWnd,WM_CLOSE,0,0);
				}
				if(s==_T("Maximize"))	PostMessage(hTarget, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
				if(s==_T("Minimize"))	PostMessage(hTarget, WM_SYSCOMMAND, SC_MINIMIZE, 0);
				if(s==_T("MinimizeAll"))
				{
					PressHotKey('D',VK_LWIN);
					//SendMessage(FindWindow("Shell_TrayWnd",NULL),WM_COMMAND,0x019F,0);
				}
				if(s==_T("Copy"))	PressHotKey('C',VK_CONTROL);
				if(s==_T("Paste"))	PressHotKey('V',VK_CONTROL);
				if(s==_T("Cut"))	PressHotKey('X',VK_CONTROL);
				if(s==_T("Open"))	PressHotKey('O',VK_CONTROL);
				if(s==_T("Save"))	PressHotKey('S',VK_CONTROL);
				if(s==_T("Print"))	PressHotKey('P',VK_CONTROL);
				if(s==_T("Next"))	PressHotKey(VK_RIGHT,VK_MENU);
				if(s==_T("Back"))	PressHotKey(VK_LEFT,VK_MENU);
				if(s==_T("Shutdown"))
				{
					ExitWindowsEx(EWX_POWEROFF|EWX_SHUTDOWN,0);
				}

				if(s==_T("NextWindow"))	PressHotKey(VK_ESCAPE,VK_MENU);
				if(s==_T("PrevWindow"))
				{
					keybd_event(VK_MENU, 0, 0, 0);
					keybd_event(VK_SHIFT, 0, 0, 0);
					keybd_event(VK_ESCAPE, 0, 0, 0);
					keybd_event(VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0);
					keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
					keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
				}
				if(s==_T("Undo"))	PressHotKey('Z',VK_CONTROL);
				if(s==_T("Redo"))	PressHotKey('Y',VK_CONTROL);
				if(s==_T("SelectAll"))	PressHotKey('A',VK_CONTROL);
				if(s==_T("CloseDocument"))	PressHotKey(VK_F4,VK_CONTROL);
			}
			break;
			case 1:
				{
				//if(pAction->m_Param[0].Mid(pAction->m_Param[0].GetLength()-1,4)==".lnk")
                    ShellExecute(NULL,_T("open"),pAction->m_Param[0],pAction->m_Param[1],pAction->m_Param[2],SW_SHOWNORMAL);
				//else
                //    ShellExecute(NULL,"open","start "+pAction->m_Param[0],pAction->m_Param[1],pAction->m_Param[2],SW_SHOWNORMAL);
				}
			break;
			case 2:
				TypeText(pAction->m_Param[0],hTarget);
			break;
			case 3:
				{
				int type=0,key=0;
				CString s=pAction->m_Param[0];
				while(!s.IsEmpty())
					{
					pAction->GetKeyElement(s,type,key);
					if(type==0)
						keybd_event(key,0,0,0);
					else
						keybd_event(key,0,KEYEVENTF_KEYUP,0);
					Sleep(100);
					}
				/*	//old
					long i=0,m=0;
					i=atol(pAction->m_Param[0]);
					m=atol(pAction->m_Param[1]);
					
					if((m & HOTKEYF_SHIFT)==HOTKEYF_SHIFT)		keybd_event(VK_SHIFT,0,0,0);
					if((m & HOTKEYF_CONTROL)==HOTKEYF_CONTROL)	keybd_event(VK_CONTROL,0,0,0);
					if((m & HOTKEYF_ALT)==HOTKEYF_ALT)			keybd_event(VK_MENU,0,0,0);
					keybd_event((BYTE)i, 0, 0, 0);
					keybd_event((BYTE)i, 0, KEYEVENTF_KEYUP, 0);
					if((m & HOTKEYF_SHIFT)==HOTKEYF_SHIFT)		keybd_event(VK_SHIFT,0,KEYEVENTF_KEYUP,0);
					if((m & HOTKEYF_CONTROL)==HOTKEYF_CONTROL)	keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
					if((m & HOTKEYF_ALT)==HOTKEYF_ALT)			keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
				*/
				}
			break;
//.........这里部分代码省略.........
开发者ID:shergin,项目名称:downright,代码行数:101,代码来源:Gesture.cpp


注:本文中的CAction::GetKeyElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。