Esempio n. 1
0
bool QPinyinImpl::commit_selection(int k)
{
        bool bUpdate = false;
        unsigned int index = ((k-'0')+9)%10;

        if(index<m_pinyin_frame->m_ime_info.candidates_on_page){
                m_pinyin_frame->m_engine.hit(m_pinyin_frame->m_ime_info.first_visible+index);
                if(m_pinyin_frame->m_engine.isPhrase()){
                        QString phrase=m_pinyin_frame->get_phrase(m_pinyin_frame->m_ime_info.first_visible+index);
                        if(m_pinyin_frame->m_bMakingPhrase){
                                m_pinyin_frame->m_ime_info.phrase+=phrase;
                        }
                        else{
                                printf("phrase unicode:");
                                for(int i=0;i<phrase.length();i++){
                                        printf("%04X,",phrase[i].unicode());
                                        SendKey(phrase[i].unicode());
                                }
                                printf("\n");
                        }
                }
                else{
                        if(m_pinyin_frame->m_bMakingPhrase){
                                m_pinyin_frame->m_ime_info.phrase+=m_pinyin_frame->get_char(m_pinyin_frame->m_ime_info.first_visible+index);
                        }
                        else{
                                SendKey(m_pinyin_frame->get_charunicode(index));

                        }
                }
                resetState();
                bUpdate=true;
        }
        return bUpdate;
}
Esempio n. 2
0
void TrySpellcheck(Display *d, KeySym key) {
  int i = 0;
  char *match;
  char *buf;
  printf("TrySpellCheck\n");
  XUngrabKeyboard(d, CurrentTime);
  SendKey (d, key, 0);
  while(xlate[i].search) {
    printf("Matching: '%s', '%s'\n", &txtbuf[txtidx], xlate[i].search);
    match = xlate[i].search + strlen(xlate[i].search);
    buf = &txtbuf[txtidx] + strlen(&txtbuf[txtidx]);
    while((buf >= &txtbuf[txtidx]) && (match >= xlate[i].search) && (*buf == *match)) {
      buf--; match--;
    }
    if(match < xlate[i].search) {
      int k = 0;
      printf("Matched %s!\n", xlate[i].search);
      while(xlate[i].replace[k]) {  
        if (xlate[i].replace[k] == '\b') {
          SendKey (d, XK_BackSpace, 0);
        } else {
          SendKey (d, xlate[i].replace[k], 0);
        }
        k++;
      }
    }
    i++;
  }
  XGrabKeyboard(d, DefaultRootWindow(d), True, GrabModeAsync, GrabModeAsync, CurrentTime);
}
Esempio n. 3
0
// Truyen 1 chuoi tu mot so
void SendStringFromNum(int num)
{
	int div = 1;
	int temp;
	char sign = 0;
	//Kiem tra dau
	if(num < 0)
	{
		num *= (-1);
		sign = 1;
	}
	
	while((num/div)>=10)
	{
		div*=10;
	}

	
	if(sign == 1)
	{
		SendKey('-');
	}

	while(div > 0)
	{
		temp = (num/div) + 48;
		SendKey(temp);
		num = num % div;
		div /= 10;			
	}
}
Esempio n. 4
0
void systick () {
	stateTicks++;
	if (typeTicks >= 0) typeTicks++;

	//Check if button was pressed. TODO: Disable button events in certain states
	bool buttonDown = !any_gpio_read (KEY_PORT, KEY_PIN);
	if (buttonDown && !buttonWasDown && (typeTicks < 0)) {
		typeTicks = 0;
		if ((state == State_AllOff) || (state == State_Alone)) {
			state = State_Alone;
			stateTicks = 0;
		} 
	}
	buttonWasDown = buttonDown;

	//Special case no feedback: If we're all alone, go back to alloff after a while
	if ((state == State_Alone) && (stateTicks > LIGHT_ON_DURATION)) {
		state = State_AllOff;
		stateTicks = 0;
	}
	
	//Send typing HID events.
	if (typeTicks == 0) {
		SendKey(keys[myButtonIdx]);
	} else if (typeTicks == KEY_DOWN_DURATION) {
		SendKey(0);
		typeTicks = -1;
	}

	//Set RGB color according to state
	if (state <= State_P1_P2_P3_Enabled) {
		bool on = state & (1 << myButtonIdx);
		SetRGBColor(on ? &colors[myButtonIdx] : &black);
	} else if ((state >= State_P1_Only) && (state <= State_P3_Urgent)) {
		bool blink = state >= State_P1_Urgent;
		int activeButtonIdx = (state - State_P1_Only) % numButtons;
		bool on = blink ? ((stateTicks & 0x10) == 0) : true;
		SetRGBColor(on ? &colors[activeButtonIdx] : &black);
	} else if (state == State_Rainbow) {
		int fromIdx = (stateTicks >> 7) % 6;
		int toIdx = (fromIdx + 1) % 6;
		uint32_t weight_to   = stateTicks & 0x7f;
        uint32_t weight_from = 0x80 - weight_to;
        uint32_t r = (weight_from * rainbowColors[fromIdx].r + weight_to * rainbowColors[toIdx].r ) >> 7;
        uint32_t g = (weight_from * rainbowColors[fromIdx].g + weight_to * rainbowColors[toIdx].g ) >> 7;
        uint32_t b = (weight_from * rainbowColors[fromIdx].b + weight_to * rainbowColors[toIdx].b ) >> 7;
        RGBColor blendColor = { r,g,b };
		SetRGBColor(&blendColor);
	} else if (state == State_Alone) {
Esempio n. 5
0
// Timeout of press and hold ALT and also WIN
void timerTick()
{
	StopTimeOut();
	if (LAltDown)
	{
		OutputDebugStringA(LPCSTR("timerTick : LAltDown ==> kill_tab = false \n"));
		kill_Tab = FALSE;
		//kill_LAlt = FALSE; // just kill TAB so Alt - LEFT = back
		//SendKey(VK_LMENU);
		return;
	}
	
	if (LWinDown)
	{
		OutputDebugStringA(LPCSTR("timerTick : re-send VK_LWIN down\n"));
		kill_LWin = FALSE;
		LWinDown = FALSE;
		SendKey(VK_LWIN);
		return;
	}
	if (RButtonDown)
	{
		OutputDebugStringA(LPCSTR("timerTick : re-send WM_RBUTTONDOWN \n"));
		RButtonDown = FALSE;
		SendMouseClick(MOUSEEVENTF_RIGHTDOWN, 0, 0, NULL, NULL);
		return;
	}
}
Esempio n. 6
0
void screenShot()
{
	HWND hWndTarget = FindWindow(NULL, L"FIFA Online 2 Korea");

	if (SetForegroundWindow(hWndTarget))
		SendKey(hWndTarget, VK_SNAPSHOT);
}
Esempio n. 7
0
bool QPinyinImpl::send_hanzi_mark(int ascii_mark)
{
        int unicode = 0;
        switch(ascii_mark){
                case ',':
                        unicode = COMMA_MARK;
                        break;
                case '.':
                        unicode = PERIOD_MARK;
                        break;
                case '<':
                        unicode = BOOK_MARK1;
                        break;
                case '>':
                        unicode = BOOK_MARK2;
                        break;
                case '?':
                        unicode = QUESTION_MARK;
                        break;
                case ':':
                        unicode = COLON_MARK;
                        break;
        }
        if(unicode!=0){
                SendKey(unicode);
                return true;
        }
        else{
                return false;
        }
}
Esempio n. 8
0
PLUGIN_EXPORT void ExecuteBang(LPCTSTR args, UINT id)
{
	if (_wcsicmp(args, L"NextTrack") == 0)
	{
		SendKey(VK_MEDIA_NEXT_TRACK);
	}
	else if (_wcsicmp(args, L"PrevTrack") == 0)
	{
		SendKey(VK_MEDIA_PREV_TRACK);
	}
	else if (_wcsicmp(args, L"Stop") == 0)
	{
		SendKey(VK_MEDIA_STOP);
	}
	else if (_wcsicmp(args, L"PlayPause") == 0)
	{
		SendKey(VK_MEDIA_PLAY_PAUSE);
	}
	else if (_wcsicmp(args, L"VolumeMute") == 0)
	{
		SendKey(VK_VOLUME_MUTE);
	}
	else if (_wcsicmp(args, L"VolumeDown") == 0)
	{
		SendKey(VK_VOLUME_DOWN);
	}
	else if (_wcsicmp(args, L"VolumeUp") == 0)
	{
		SendKey(VK_VOLUME_UP);
	}
	else
	{
		RmLog(LOG_WARNING, L"MediaKey.dll: Unknown bang");
	}
}
Esempio n. 9
0
// Truyen 1 chuoi str
void SendString(char* str)
{
	int i;
	int length = strlen(str);
	for(i = 0; i<length; i++)
	{
		SendKey(str[i]);
	}
}
Esempio n. 10
0
bool CDVDSession::Authenticate()
{
    if (m_session == DVD_END_ALL_SESSIONS) {
        return false;
    }

    BYTE Challenge[10], Key[10];

    for (BYTE i = 0; i < 10; i++) {
        Challenge[i] = i;
    }

    if (!SendKey(DvdChallengeKey, Challenge)) {
        return false;
    }

    if (!ReadKey(DvdBusKey1, Key)) {
        return false;
    }

    int varient = -1;

    for (int i = 31; i >= 0; i--) {
        BYTE KeyCheck[5];
        CSSkey1(i, Challenge, KeyCheck);
        if (!memcmp(KeyCheck, Key, 5)) {
            varient = i;
        }
    }

    if (!ReadKey(DvdChallengeKey, Challenge)) {
        return false;
    }

    CSSkey2(varient, Challenge, &Key[5]);

    if (!SendKey(DvdBusKey2, &Key[5])) {
        return false;
    }

    CSSbuskey(varient, Key, m_SessionKey);

    return true;
}
//keys is a utf-8 array
void KeyboardControler::SendMultiKey(char *utf8, int size)
{
	short* keys = GetKeyUnicodes(utf8, size);
	int count = GetKeyCount(utf8, size);

	for(int i=0;i<count;i++)
	{
		SendKey(keys[i]);
	}
}
Esempio n. 12
0
void MFDWindow::ProcessButton (int bt, int event)
{
	switch (bt) {
	case 12:
		if (event == PANEL_MOUSE_LBDOWN)
			SendKey (OAPI_KEY_ESCAPE);
		break;
	case 13:
		if (event == PANEL_MOUSE_LBDOWN)
			SendKey (OAPI_KEY_F1);
		break;
	case 14:
		if (event == PANEL_MOUSE_LBDOWN)
			SendKey (OAPI_KEY_GRAVE);
		break;
	default:
		ExternMFD::ProcessButton (bt, event);
		break;
	}
}
Esempio n. 13
0
// Lay 1 so tu chuoi nhan duoc
int GetNumFromString(void)
{
	int res = 0;
	char sign = 0;
	int ch;

	ch = GetKey(); 
	SendKey(ch);
	if(ch == '-')
	{
		sign = 1;	
	}
	while(1)
	{
		if(ch == 13)
		{
			break;
		}
		else
		{
			if(ch >= 48 && ch <= 57)
			{
				ch -= 48;
				res = res*10 + ch;
			}
		}
		ch = GetKey();
		SendKey(ch);
	}
	if(sign == 1)
	{
		res *= (-1);
	}

	return res;	
}
Esempio n. 14
0
////////////////////////////////////////////////////////////////////////
// Function:	SendString
// Description:	Repeatedly calls the SendKey to send an entire data
//				string to the keyboard buffer.
// Author:		Dave Sheppard
// Date:		2/3/2005
////////////////////////////////////////////////////////////////////////
void CSIP::SendString(LPCTSTR lpszString)
{
	DWORD i;

	HWND hWndFocus = GetForegroundWindow();
	if ( lpszString == NULL )
	{
		return;
	}
	
	for(i=0;i<wcslen(lpszString);i++)
	{
		SendKey(lpszString[i]);
	}
}
Esempio n. 15
0
bool QPinyinImpl::filter (int unicode, int keycode, int modifiers,
                           bool isPress, bool /*autoRepeat*/)
{
    if (isPress && (Qt::AltModifier & modifiers) && (Qt::Key_Z == keycode))
    {
        toggleIME();
        if(isWork)
        {
            isWork = false;
        }
        else
        {
            isWork = true;
        }

        return true;
    }
    else
    {
        if (isWork && isPress) {
                if(m_pinyin_frame->m_bEnglishMode){
                        if(unicode == 9 && keycode == Qt::Key_Tab){
                                m_pinyin_frame->m_bEnglishMode = false;
                                m_pinyin_frame->update();
                                return true;
                        }
                        else if(unicode == 8 && keycode == Qt::Key_Backspace)
                        {
                                return false;
                        }
                        else{
                                SendKey(unicode,keycode);
                                return true;
                        }

                }

                if (GetKey (unicode, keycode))
                        return true;
                else
                        return false;
        }
        else
                return false;
    }

    return false;
}
int EditBoxCollection::doOpenFile(char *pName)
{
    int rc = opened(pName);

    if(rc < 0)
    {
        if (!current()->is_untitled() ||
            current()->get_changed())
                select(open());

        current()->load(pName);
        SendKey("kbOpen");
    }
    else
        select(rc);
    return 0;
}
Esempio n. 17
0
int  USBKeyboardParse(int usbfd)
{
	int yalv;                  //loop counter
	size_t read_bytes;         //how many bytes were read
	struct input_event ev[64]; //the events (up to 64 at once)
	int qtkey1,qtkey2;
	unsigned char led_bitmask[LED_MAX/8 + 1];
	/*TEST CAPS LED*/
	memset(led_bitmask, 0, sizeof(led_bitmask));
	if (ioctl(usbfd, EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask) < 0)
	{
		printf("Can not find usb keyboard!\n");
		return 1;
	}

	read_bytes = read(usbfd, ev, sizeof(struct input_event) * 64);
	if (read_bytes < (int) sizeof(struct input_event))
	{
		printf("usb keyboard read error!\n");
		return 0;
	}

	for (yalv = 0; yalv < (int) (read_bytes / sizeof(struct input_event)); yalv++)
	{
		//.printf("usbkb received code=%d ,value=%d \n",ev[yalv].code,ev[yalv].value);
		if( ev[yalv].type != EV_KEY ){
			//printf("\nUSB key type is not EV_KEY\n");
			continue;
		}

		if(usbmapfunction){
			usbmapfunction(usbfd,ev[yalv].code,version+ev[yalv].value,&qtkey1,&qtkey2);
			SendKey(qtkey1 ,qtkey2);
		}
	}//end
	return 0;
}
Esempio n. 18
0
////////////////////////////////////////////////////////////////////////
// Function:	SendString
// Description:	Repeatedly calls the SendKey to send an entire data
//				string to the keyboard buffer.
// Author:		Dave Sheppard
// Date:		2/3/2005
////////////////////////////////////////////////////////////////////////
void CSIP::SendString(LPCTSTR lpszString)
{
	DWORD i;

	HWND hWndFocus = GetForegroundWindow();
/*	if ((hWndFocus == CBtns::m_hwndGo) ||
		(hWndFocus == CBtns::m_hwndStop) ||
		(hWndFocus == CBtns::m_hwndBack) ||
		(hWndFocus == CBtns::m_hwndReload) ||
		(hWndFocus == CBtns::m_hwndZoom) ||
		(hWndFocus == CBtns::m_hwndKbd) ||
		(hWndFocus == CBtns::m_hwndAdd) ||
		(hWndFocus == CBtns::m_hwndQuit) ||
		(hWndFocus == CBtns::m_hwndNum) ||
		(hWndFocus == CBtns::m_hwndAbc) ||
		(hWndFocus == CBtns::m_hwndFnc) ||
		(hWndFocus == CBtns::m_hwndAlt) ||
		(hWndFocus == CBtns::m_hwndCtrl) ||
		(hWndFocus == CBtns::m_hwndMin))  {
		CSpbLog::Log(MEDIUM,SPB_LOG_INFORMATION, L"Trying to send string to button so cancelling",  L"CSIP", DEVICE_ID, __LINE__); 
		CSpbLog::Log(MEDIUM,SPB_LOG_INFORMATION, (LPTSTR)lpszString, L"CSIP", DEVICE_ID, __LINE__); 
	return;
	}
*/	
//	CSpbLog::Log(MEDIUM,SPB_LOG_INFORMATION,  L"Sending string...", L"CSIP", DEVICE_ID, __LINE__); 
//	CSpbLog::Log(MEDIUM,SPB_LOG_INFORMATION,(LPTSTR)lpszString, L"CSIP", DEVICE_ID, __LINE__);  

	if ( lpszString == NULL )
	{
		return;
	}
	
	for(i=0;i<wcslen(lpszString);i++)
	{
		SendKey(lpszString[i]);
	}
}
Esempio n. 19
0
static UINT Fire(UINT what)
{
	switch (what) {
	case 0:
		return FALL_THROUGH;
	case FIRE_NOTHING:
		break;
	case FIRE_POWER:
		Power();
		break;
	case FIRE_EJECT:
		Eject();
		break;
	case FIRE_FLIP3D:
		Flip3D();
		break;
	case FIRE_BRIGHT_DN:
		Bright(-BRIGHT_STEP);
		break;
	case FIRE_BRIGHT_UP:
		Bright(+BRIGHT_STEP);
		break;
	case FIRE_ALPHA_DN:
		Alpha(-ALPHA_DELTA);
		break;
	case FIRE_ALPHA_UP:
		Alpha(+ALPHA_DELTA);
		break;
	default:
		if (FIRE_CMD_0 <= what && what < FIRE_CMD_0 + ARRAYSIZE(config_szCmds))
			Exec(config_szCmds[what - FIRE_CMD_0]);
		else
			SendKey(what);
	}
	return FIRED;
}
Esempio n. 20
0
DLL_EXPORT
int ToggleLock( int lock )
{
    /* lock can be:
     *  1 for capslock;
     *  2 for numlock;
     *  4 for scrollock;
     * */
    int vKey = 0;
    switch (lock) {
        case 1: // caps
            vKey = VK_CAPITAL;
            break;
        case 2: // num
            vKey = VK_NUMLOCK;
            break;
        case 4: // scroll
            vKey = VK_SCROLL;
            break;
        default: // do nothing
            break;
    }
    return SendKey( vKey );
}
Esempio n. 21
0
void MeasureMediaKey::Command(const std::wstring& command)	
{
	const WCHAR* args = command.c_str();
	if (_wcsicmp(args, L"NextTrack") == 0)
	{
		SendKey(VK_MEDIA_NEXT_TRACK);
	}
	else if (_wcsicmp(args, L"PrevTrack") == 0)
	{
		SendKey(VK_MEDIA_PREV_TRACK);
	}
	else if (_wcsicmp(args, L"Stop") == 0)
	{
		SendKey(VK_MEDIA_STOP);
	}
	else if (_wcsicmp(args, L"PlayPause") == 0)
	{
		SendKey(VK_MEDIA_PLAY_PAUSE);
	}
	else if (_wcsicmp(args, L"VolumeMute") == 0)
	{
		SendKey(VK_VOLUME_MUTE);
	}
	else if (_wcsicmp(args, L"VolumeDown") == 0)
	{
		SendKey(VK_VOLUME_DOWN);
	}
	else if (_wcsicmp(args, L"VolumeUp") == 0)
	{
		SendKey(VK_VOLUME_UP);
	}
	else
	{
		LogErrorF(this, L"Unknown command: %s", args);
	}
}
Esempio n. 22
0
void pressKEYforward(char id[SIZE_ID])
{
  Display *disp = XOpenDisplay (NULL);  
  SendKey (disp, XK_Right , 0);  
}
Esempio n. 23
0
void InjectKey(Display *d, KeySym key) {
  XUngrabKeyboard(d, CurrentTime);
  SendKey (d, key, 0);
  XGrabKeyboard(d, DefaultRootWindow(d), True, GrabModeAsync, GrabModeAsync, CurrentTime);
}
Esempio n. 24
0
/*******************************************************************************
* Function Name  : IRemoCon_ISR
* Description    : process IR remocon received pulse .
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void IRemoCon_ISR()
{
//	CallTrace(TRACE_DRV_HIGH, "IRemoCon_ISR %d %d\n\r",state,ir_count_100us);

  switch(state)
  { 
	case lead :   
		// between falling edge (8.5ms~9.5ms)
		// then, lead code!!!
		while((ir_count_100us >= 85) && (ir_count_100us < 95)){	
			  state = code; 								    
			  bit_count = 0;   
			  temp = 0;

			  CallTrace(TRACE_DRV_HIGH, "IRemoCon lead %d\n\r",ir_count_100us);
			  
			  break;
		}
	case code : 											
															
		 if((ir_count_100us < 15)){ // dummy time
		 	
		 }else if((ir_count_100us >= 20) && (ir_count_100us < 25)) // between falling edge (2ms~2.5ms)
			 temp |= 0x80;								      // then, code is one(1)!!!
	     else{ 
			 state = lead;
			 break;
		 }
		  
	     bit_count++;

	     if(!(bit_count % 8))						   
	     { 
			  data[(bit_count / 8) - 1] = temp; 
			  temp = 0;

			  if(bit_count >= 32)
		      { 
				  state = lead; 
				  bit_count = 0;
				  flag = 1;
                
			      //CallTrace(TRACE_DRV_HIGH, "IRemoCon custom code:0x%02x%02x data:0x%02x%02x\n\r",data[0],data[1],data[2],data[3]);

				   if(CustomCode1==data[0] && CustomCode2==data[1])
				  SendKey(Conv_Key(data[2]));				  
			  }
		  }

		  temp = temp >> 1;
		  break;

	default: 
		state = lead;
		break;
	
  }

  ir_count_100us = 0;
  
}
Esempio n. 25
0
// Sends a key string
//##ModelId=474D302600AD
bool CSendKeys::SendKeys(LPCTSTR KeysString, bool Wait)
{
  WORD MKey, NumTimes;
  TCHAR KeyString[300] = {0};
  bool retval  = false;
  int  keyIdx;

  LPTSTR pKey = (LPTSTR) KeysString;
  TCHAR  ch;

  m_bWait = Wait;

  m_bWinDown = m_bShiftDown = m_bControlDown = m_bAltDown = m_bUsingParens = false;

  while (ch = *pKey)
  {
    switch (ch)
    {
    // begin modifier group
    case _TXCHAR('('):
      m_bUsingParens = true;
      break;

    // end modifier group
    case _TXCHAR(')'):
      m_bUsingParens = false;
      PopUpShiftKeys(); // pop all shift keys when we finish a modifier group close
      break;

    // ALT key
    case _TXCHAR('%'):
      m_bAltDown = true;
      SendKeyDown(VK_MENU, 1, false);
      break;

    // SHIFT key
    case _TXCHAR('+'):
      m_bShiftDown = true;
      SendKeyDown(VK_SHIFT, 1, false);
      break;

    // CTRL key
    case _TXCHAR('^'):
      m_bControlDown = true;
      SendKeyDown(VK_CONTROL, 1, false);
      break;

    // WINKEY (Left-WinKey)
    case '@':
      m_bWinDown = true;
      SendKeyDown(VK_LWIN, 1, false);
      break;

    // enter
    case _TXCHAR('~'):
      SendKeyDown(VK_RETURN, 1, true);
      PopUpShiftKeys();
      break;

    // begin special keys
    case _TXCHAR('{'):
      {
        LPTSTR p = pKey+1; // skip past the beginning '{'
        size_t t;

        // find end of close
        while (*p && *p != _TXCHAR('}'))
          p++;

        t = p - pKey;
        // special key definition too big?
        if (t > sizeof(KeyString))
          return false;

        // Take this KeyString into local buffer
        _tcsncpy(KeyString, pKey+1, t);

        KeyString[t-1] = _TXCHAR('\0');
        keyIdx = -1;

        pKey += t; // skip to next keystring

        // Invalidate key
        MKey = INVALIDKEY;

        // sending arbitrary vkeys?
        if (_tcsnicmp(KeyString, _T("VKEY"), 4) == 0)
        {
          p = KeyString + 4;
          MKey = _ttoi(p);
        }
        else if (_tcsnicmp(KeyString, _T("BEEP"), 4) == 0)
        {
          p = KeyString + 4 + 1;
          LPTSTR p1 = p;
          DWORD frequency, delay;

          if ((p1 = _tcsstr(p, _T(" "))) != NULL)
          {
            *p1++ = _TXCHAR('\0');
            frequency = _ttoi(p);
            delay = _ttoi(p1);
            ::Beep(frequency, delay);
          }
        }
        // Should activate a window?
        else if (_tcsnicmp(KeyString, _T("APPACTIVATE"), 11) == 0)
        {
          p = KeyString + 11 + 1;
          AppActivate(p);
        }
        // want to send/set delay?
        else if (_tcsnicmp(KeyString, _T("DELAY"), 5) == 0)
        {
          // Advance to parameters
          p = KeyString + 5;
          // set "sleep factor"
          if (*p == _TXCHAR('='))
            m_nDelayAlways = _ttoi(p + 1); // Take number after the '=' character
          else
            // set "sleep now"
            m_nDelayNow = _ttoi(p);
        }
        // not command special keys, then process as keystring to VKey
        else
        {
          MKey = StringToVKey(KeyString, keyIdx);
          // Key found in table
          if (keyIdx != -1)
          {
            NumTimes = 1;

            // Does the key string have also count specifier?
            t = _tcslen(KeyNames[keyIdx].keyName);
            if (_tcslen(KeyString) > t)
            {
              p = KeyString + t;
              // Take the specified number of times
              NumTimes = _ttoi(p);
            }

            if (KeyNames[keyIdx].normalkey)
              MKey = ::VkKeyScan(KeyNames[keyIdx].VKey);
          }
        }

        // A valid key to send?
        if (MKey != INVALIDKEY)
        {
          SendKey(MKey, NumTimes, true);
          PopUpShiftKeys();
        }
      }
      break;

      // a normal key was pressed
    default:
      // Get the VKey from the key
      MKey = ::VkKeyScan(ch);
      SendKey(MKey, 1, true);
      PopUpShiftKeys();
    }
    pKey++;
  }

  m_bUsingParens = false;
  PopUpShiftKeys();
  return true;
}
Esempio n. 26
0
void pressKEYbackwards(char id[SIZE_ID])
{
  Display *disp = XOpenDisplay (NULL);  
  SendKey (disp, XK_Left , 0);  
}
Esempio n. 27
0
// Truyen ky tu xuong dong
void SendEnter()
{
	SendKey('\r');
	SendKey('\n');
}
Esempio n. 28
0
void pressKEYEnter(char id[SIZE_ID])
{
  Display *disp = XOpenDisplay (NULL);  
  SendKey (disp, XK_Return , 0);  
}
Esempio n. 29
0
void pressKEYd(char id[SIZE_ID])
{
  Display *disp = XOpenDisplay (NULL);  
  SendKey (disp, XK_d , 0);  
}
Esempio n. 30
0
void pressKEYEscape(char id[SIZE_ID])
{
  Display *disp = XOpenDisplay (NULL);  
  SendKey (disp, XK_Escape , 0);  
}