Esempio n. 1
0
/*****************************************************************
*UITask - Task that waits for a keypress. If the # key is press, then jumps
to SetTheTime function. Else, waits for the # press*/
static void UITask(void *p_arg)
{
    INT8U keypress = 0;
    INT8U err;
    INT8U sendmessage;
    INT8U dbutton = TRUE;
    TIME displaytime;
    
    (void)p_arg;
    FOREVER()
    {
        DBUG_PORT &= ~PP6;
        keypress = KeyPend(0, &err);
        DBUG_PORT |= PP6;
                
        if(keypress == '#')
        {
            DBUG_PORT |= PP6;
            SetTheTime();
            DBUG_PORT &= ~PP6;
        }
        else if (keypress == DC1)
        {
            DBUG_PORT |= PP6;
            InTran = TRUE; //if message received throw up symbol 
            LcdShowLayer(CLOCK_LAYER);
            LcdHideLayer(DBUTTON_LAYER);
            LcdHideLayer(DISPLAY_LAYER);
            TypeText();
            InTran = FALSE;//out of transmit phase
            LcdShowLayer(DISPLAY_LAYER);
            TransmitCheck(&sendmessage);
            if(sendmessage == TRUE)
            {
                OSSemPost(TransmitFlag);//Allows transmit to start
            }
            else
            {
            }
            sendmessage = FALSE;
            DBUG_PORT &= ~PP6;   
        }
        else if (keypress == DC4)
        {
            DBUG_PORT |= PP6;
            if(dbutton == TRUE)
            {
            
                LcdShowLayer(DBUTTON_LAYER);
                LcdHideLayer(CLOCK_LAYER);
                LcdDispChar(1,1,DBUTTON_LAYER,AddNum1);
                LcdDispChar(1,2,DBUTTON_LAYER,AddNum2);
                LcdDispChar(1,3,DBUTTON_LAYER,AddNum3);
                DispTimeStamp();//displays when message was received
                dbutton = FALSE; 
            }
            else
            {
                dbutton = TRUE;
                LcdHideLayer(DBUTTON_LAYER);
                LcdShowLayer(CLOCK_LAYER);
            }
            DBUG_PORT &= ~PP6;    
        }
        else
        {
        }

    }

}
Esempio n. 2
0
// поток на выполнение...
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;
			case 4:
				PostMessage(hTarget,StringToLong(pAction->m_Param[0]),StringToLong(pAction->m_Param[1]),StringToLong(pAction->m_Param[2]));
			break;	
		}

	}
	return 0;
}