Beispiel #1
2
void TritonIm(HWND hWindow, char* szMsg)
{
	HWND hLink = NULL;
	for(unsigned int i = 0; i < strlen(szMsg); ++i)
	{
		if (szMsg[i] == '[')
		{
			keybd_event(VK_CONTROL, 0, 0, 0);
			short sKey = VkKeyScan('l');
			keybd_event((unsigned char)sKey, 0, 0, 0);
			keybd_event((unsigned char)sKey, 0, KEYEVENTF_KEYUP, 0);
			keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
			do {
				hLink = FindWindowEx(NULL, hLink, "__oxFrame.class__", "Edit Hyperlink");
			} while(!IsWindow(hLink));
			FocusWindow(hLink);
		} else if (szMsg[i] == '+') {
			HitKey(VK_TAB, 1);
		} else if (szMsg[i] == ']') {
			HitKey(VK_TAB, 1);
			HitKey(VK_RETURN, 1);
			Sleep(250);
			FocusWindow(hWindow);
		} else {
			short sKey = VkKeyScan(szMsg[i]);
			if((sKey >> 8) & 1) keybd_event(VK_LSHIFT, 0, 0, 0);
			keybd_event((unsigned char)sKey, 0, 0, 0);
			keybd_event((unsigned char)sKey, 0, KEYEVENTF_KEYUP, 0);
			if((sKey >> 8) & 1) keybd_event(VK_LSHIFT, 0, KEYEVENTF_KEYUP, 0);
		}
	}
	FocusWindow(hWindow);
	HitKey(VK_RETURN, 1);
	Sleep(250);
}
Beispiel #2
1
void Fury::CombatStart()
{
	this->SetCombat(1);
	printf("Combat set to %d\n",this->GetCombat());
	FullKeyPress(VkKeyScan('w'));	// stop following
	this->target_ = "party1target";
	//this->spell_ = "attack";
}
Beispiel #3
0
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {

	hotkeys.push_back(HotKey(MOD_WIN, 0x41, 0x00e, VkKeyScan('A'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x43, 0x00f, VkKeyScan('C'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x56, 0x010, VkKeyScan('V'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x56, 0x011, VkKeyScan('V'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x54, 0x012, VkKeyScan('T'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x58, 0x013, VkKeyScan('X'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x57, 0x014, VkKeyScan('W'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x46, 0x015, VkKeyScan('F'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x52, 0x016, VkKeyScan('R'), VK_CONTROL, 0x9d));
  hotkeys.push_back(HotKey(MOD_WIN, 0x53, 0x017, VkKeyScan('S'), VK_CONTROL, 0x9d));
	hotkeys.push_back(HotKey(MOD_WIN, 0x53, 0x018, VK_TAB, VK_LMENU, 0xb8));
	hotkeys.push_back(HotKey(MOD_WIN, 0x20, 0x019, VK_SPACE, VK_LMENU, 0xb8));
	hotkeys.push_back(HotKey(MOD_WIN, 0x51, 0x020, VK_F4, VK_LMENU, 0xb8));
	hotkeys.push_back(HotKey(MOD_WIN, 0x8f, 0x021, VK_TAB, VK_LMENU, 0xb8));

	while (true) {
		MSG msg;
		while(GetMessage(&msg, NULL, 0, 0) > 0) {
			if (msg.message == WM_HOTKEY) {
				for (std::vector<HotKey>::iterator i = hotkeys.begin(); i != hotkeys.end(); ++i) {
					if ((*i).identifier() == msg.wParam) {
						(*i).press();
					}
				}
			}
		
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	return 0;
}
Beispiel #4
0
void ClickThread::run() {
    POINT pt;
    HWND hWnd;
    LPARAM lParam;

    keybd_event(VkKeyScan('c'), 0, 0, 0);
    keybd_event(VkKeyScan('c'), 0, KEYEVENTF_KEYUP, 0);

    Sleep(50);
    for(int i = 0; i < clicks.length(); i++) {
        pt.x = const_cast<Click*>(clicks.at(i))->getX();
        pt.y = const_cast<Click*>(clicks.at(i))->getY();

        hWnd = WindowFromPoint(pt);
        lParam = MAKELPARAM(pt.x, pt.y);

        if(const_cast<Click*>(clicks.at(i))->getAlt()) {
            keybd_event(VK_MENU, 0, 0, 0);
            Sleep(50);
        }

        PostMessage(hWnd, WM_RBUTTONDOWN, MK_RBUTTON, lParam);
        PostMessage(hWnd, WM_RBUTTONUP, MK_RBUTTON, lParam);

        if(const_cast<Click*>(clicks.at(i))->getAlt()) {
            Sleep(50);
            keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
            Sleep(50);
        }
    }

    Sleep(50);
    keybd_event(VkKeyScan('c'), 0, 0, 0);
    keybd_event(VkKeyScan('c'), 0, KEYEVENTF_KEYUP, 0);
}
static int _selectNextPhoto( lua_State *L )
{
	int retVal = 0;
	if( lua_gettop( L ) == 0 )
	{
/*		INPUT input[ 2 ] = {0};
		input[ 0 ].type = INPUT_KEYBOARD;
		input[ 0 ].ki.wVk = VK_RIGHT;
		input[ 0 ].ki.dwFlags = 0;

		input[ 1 ].type = INPUT_KEYBOARD;
		input[ 1 ].ki.wVk = VK_RIGHT;
		input[ 1 ].ki.dwFlags = KEYEVENTF_KEYUP;
		SendInput( sizeof( input ) / sizeof( input[ 0 ] ), 
				   input,
				   sizeof( INPUT ) );
*/
		keybd_event( VK_RIGHT, MapVirtualKey( LOBYTE( VkKeyScan( VK_RIGHT ) ), 0 ), 0, 0 );
		Sleep( 50 );
		keybd_event( VK_RIGHT, MapVirtualKey( LOBYTE( VkKeyScan( VK_RIGHT ) ), 0 ), 0, KEYEVENTF_KEYUP );

	} // if
	return( 0 );

} // _selectNextPhoto
Beispiel #6
0
int Fury::DoMove(Dots in){
	int				r1,g1,b1;
	int				combat=0;
	int				follow=0;
	int				forcedFollow=0;
	int				mounted=0;
	r1 = GetRValue( in.allDots_[0].color_ );
	g1 = GetGValue( in.allDots_[0].color_ );
	b1 = GetBValue( in.allDots_[0].color_ );
	
	combat = this->inCombat( g1 );
	forcedFollow = this->forcedFollowing( g1 );
	mounted = this->Mounted( g1 );
	if ( combat )
	{
		FullKeyPress(VkKeyScan( ';' ));
		if ( !forcedFollow)
		{
			FullKeyPress(VkKeyScan( ',' ));
		}
	}
	if ( mounted )
	{
	}
	return 1;
}
Beispiel #7
0
//=================================================================
// KeyBoardInputCheck : 키보드의 입력을 처리한다. 
// bIsIP - IP 입력의 여부
VOID S_ConnectToRoom::KeyBoardInputCheck(bool bIsIP)
{
	string str;

	if (bIsIP)
	{
		str = m_IP;
	}
	else
	{
		str = m_NickName;
	}

	// 키보드의 키
	char Alpabet[26] = { 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',
		'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l',
		'z', 'x', 'c', 'v', 'b', 'n', 'm' };

	// 키가 입력되었는지 검사한다.
	for (int i = 0; i < 26; i++)
	{
		if (KEYDOWN(VkKeyScan(Alpabet[i])))
		{
			m_bIsKeyBoardDown[i] = true;
		}
	}

	// 키가 들렸는지 검사한다.
	for (int i = 0; i < 26; i++)
	{
		if (m_bIsKeyBoardDown[i])
		{
			if (KEYUP(VkKeyScan(Alpabet[i])))
			{
				if (str.length() < 9)
				{
					str = str + Alpabet[i];
				}

				m_bIsKeyBoardDown[i] = false;
			}
		}
	}

	if (bIsIP)
	{
		m_IP = str;
	}
	else
	{
		m_NickName = str;
	}
}
Beispiel #8
0
void cleartext()
{
	keybd_event(VK_CONTROL,0,0 , 0);
	keybd_event(VkKeyScan('a'),0,0 , 0);
	keybd_event(VK_DELETE,0,0 , 0);

	keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP , 0);
	keybd_event(VkKeyScan('a'),0,KEYEVENTF_KEYUP , 0);
	keybd_event(VK_DELETE,0,KEYEVENTF_KEYUP , 0);

	return;
}
void EmulKeyBoard::PressKeyBoardNUM()
{

	for (unsigned int idx = 0; idx < vec_KeybdNumber.size(); ++idx)
	{
		int key = vec_KeybdNumber[idx];
		keybd_event(VkKeyScan(key), 0x9e, 0, 0); 
		keybd_event(VkKeyScan(key), 0x9e, KEYEVENTF_KEYUP, 0);
		
		if (isThreadExit == true) break;
		Sleep(keybdTime);
	}
	
}
Beispiel #10
0
void RmeTotalmix(RmeTotalmixCmd cmd)
{
	HWND hFirefaceWnd = FindWindow("Fireface Mixer Class 1", NULL);

	if(!hFirefaceWnd)
	{
		HWND hMainWnd = GetMainHwnd();
		MessageBox(hMainWnd, "RME Totalmix not found!", "Error", MB_OK);
		return;
	}

	BYTE vkKey;
	BYTE vkModKey = -1;
	switch(cmd)
	{
		case eTOTALMIX_LOADUSER1 : case eTOTALMIX_LOADUSER2 : case eTOTALMIX_LOADUSER3 : case eTOTALMIX_LOADUSER4 :
		case eTOTALMIX_LOADUSER5 : case eTOTALMIX_LOADUSER6 : case eTOTALMIX_LOADUSER7 : case eTOTALMIX_LOADUSER8 :
			vkModKey = VK_MENU;
			vkKey = (BYTE)VkKeyScan('1' + (cmd-eTOTALMIX_LOADUSER1));
		break;

		//! \bug Doesn't work: VK_CONTROL, VK_LCONTROL, VK_RCONTROL emulate 'alt' (VK_MENU) not 'ctrl'
		case eTOTALMIX_LOADFACT1 : case eTOTALMIX_LOADFACT2 : case eTOTALMIX_LOADFACT3 : case eTOTALMIX_LOADFACT4 :
		case eTOTALMIX_LOADFACT5 : case eTOTALMIX_LOADFACT6 : case eTOTALMIX_LOADFACT7 : case eTOTALMIX_LOADFACT8 :
			vkModKey = VK_CONTROL;
			vkKey = (BYTE)VkKeyScan('1' + (cmd-eTOTALMIX_LOADFACT1));
		break;

		case eTOTALMIX_MASTERMUTE :
			vkKey = (BYTE)VkKeyScan('M');
		break;
		
		default :
			return;
		break;
	}

	HWND hForegroundWnd = GetForegroundWindow();
	SetForegroundWindow(hFirefaceWnd);

	if(vkModKey != -1)
		keybd_event(vkModKey, 0, 0, 0);
	keybd_event(vkKey, 0, 0, 0);
	keybd_event(vkKey, 0, KEYEVENTF_KEYUP, 0);
	if(vkModKey != -1)
		keybd_event(vkModKey, 0, KEYEVENTF_KEYUP, 0);

	SetForegroundWindow(hForegroundWnd);
}
Beispiel #11
0
void RegHotkey(MCONTACT hContact, HWND hwnd)
{
	char szBuf[MAX_PATH] = { 0 };

	DBVARIANT dbv;
	if (db_get_s(hContact, MODULE, "Hotkey", &dbv)) return;
	strncpy(szBuf, dbv.pszVal, MAX_PATH - 1);
	db_free(&dbv);

	if (szBuf[0] != '\0') {
		UINT nModifiers = 0;
		char chKey = 0;
		char szMod[2][20] = { 0 };
		char szKey[20] = { 0 };

		sscanf(szBuf, "%[^'+']+%[^'+']+%[^'+']", szMod[0], szMod[1], szKey);

		for (int i = 0; i < 2; i++) {
			if (0 == strncmp(szMod[i], "ALT", 19))
				nModifiers = nModifiers | MOD_ALT;
			else if (0 == strncmp(szMod[i], "CTRL", 19))
				nModifiers = nModifiers | MOD_CONTROL;
			else if (0 == strncmp(szMod[i], "SHIFT", 19))
				nModifiers = nModifiers | MOD_SHIFT;
		}

		chKey = szKey[0];

		RegisterHotKey(hwnd, (INT_PTR)hwnd, nModifiers, VkKeyScan(chKey));
	}
}
Beispiel #12
0
static void RClearConsole(){
    if(!RConsole){
        fprintf(stderr, "R Console window ID not defined [RClearConsole]\n");
        fflush(stderr);
        return;
    }

    SetForegroundWindow(RConsole);
    keybd_event(VK_CONTROL, 0, 0, 0);
    keybd_event(VkKeyScan('L'), 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
    Sleep(0.05);
    keybd_event(VkKeyScan('L'), 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
    Sleep(0.05);
    PostMessage(RConsole, WM_NULL, 0, 0);
}
Beispiel #13
0
void Shaman::CombatEnd()
{
	this->SetCombat(0);
	printf("Combat set off %d\n",this->GetCombat());
	FullKeyPress(VkKeyScan('='));	// following
	//FullKeyPress('7');	// totem recal
}
Beispiel #14
0
void Priest::CombatEnd()
{
	this->SetCombat(0);
	this->target_ = "/clearfocus";
	printf("Combat set ggrdrgdto %d\n",this->GetCombat());
	FullKeyPress(VkKeyScan('='));	// start following
}
void SimulateKeyWithUnichar(MouseEvent event) {
	unsigned int charCode = event.value, mod = 0;
	short winKeycode = VkKeyScan(charCode);
	if (winKeycode != -1) {
		byte bKey = LOBYTE(winKeycode), bMod = HIBYTE(winKeycode);
		if (bKey == '\r')
			bMod = 0;
		if (bMod) {
			if (bMod & kWinModifierShift)
				keybd_event(VK_SHIFT, 0, 0, 0);
			if (bMod & kWinModifierControl)
				keybd_event(VK_CONTROL, 0, 0, 0);
			if (bMod & kWinModifierAlternate)
				keybd_event(VK_MENU, 0, 0, 0);
		}
		keybd_event(bKey, 0, 0, 0);
		if (bMod) {
			if (bMod & kWinModifierShift)
				keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
			if (bMod & kWinModifierControl)
				keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
			if (bMod & kWinModifierAlternate)
				keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
		}
		keybd_event(bKey, 0, KEYEVENTF_KEYUP, 0);
	} else {
		MessageBeep(MB_OK);
	}
	return;
}
Beispiel #16
0
int X11KeySymToKeycode(QString key)
{
    int tempcode = 0;
#if defined (Q_OS_UNIX)
    Display* display = X11Info::display();

    if (key.length() > 0)
    {
        tempcode = XKeysymToKeycode(display, XStringToKeysym(key.toUtf8().data()));
    }

#elif defined (Q_OS_WIN)
    if (key.length() > 0)
    {
        tempcode = WinInfo::getVirtualKey(key);
        if (tempcode <= 0 && key.length() == 1)
        {
            //qDebug() << "KEY: " << key;
            //int oridnal = key.toUtf8().constData()[0];
            int ordinal = QVariant(key.toUtf8().constData()[0]).toInt();
            tempcode = VkKeyScan(ordinal);
            int modifiers = tempcode >> 8;
            tempcode = tempcode & 0xff;
            if ((modifiers & 1) != 0) tempcode |= VK_SHIFT;
            if ((modifiers & 2) != 0) tempcode |= VK_CONTROL;
            if ((modifiers & 4) != 0) tempcode |= VK_MENU;
            //tempcode = VkKeyScan(QVariant(key.constData()).toInt());
            //tempcode = OemKeyScan(key.toUtf8().toInt());
            //tempcode = OemKeyScan(ordinal);
        }
Beispiel #17
0
  Keymapper()
  {
    for (int i = 0; i < sizeof(keymap) / sizeof(keymap_t); i++) {
      vkMap[keymap[i].keysym] = keymap[i].vk;
      extendedMap[keymap[i].keysym] = keymap[i].extended;
    }

	// Find dead characters for the current keyboard layout
  // XXX how could we handle the keyboard layout changing?
  BYTE keystate[256];
  memset(keystate, 0, 256);
  for (int j = 0; j < sizeof(latin1DeadChars); j++) {
    SHORT s = VkKeyScan(latin1DeadChars[j]);
    if (s != -1) {
      BYTE vkCode = LOBYTE(s);
      BYTE modifierState = HIBYTE(s);
      keystate[VK_SHIFT] = (modifierState & 1) ? 0x80 : 0;
      keystate[VK_CONTROL] = (modifierState & 2) ? 0x80 : 0;
      keystate[VK_MENU] = (modifierState & 4) ? 0x80 : 0;
      rdr::U8 chars[2];
      int nchars = ToAscii(vkCode, 0, keystate, (WORD*)&chars, 0);
      if (nchars < 0) {
        vnclog.Print(LL_INTWARN, "Found dead key 0x%x '%c'",
                   latin1DeadChars[j], latin1DeadChars[j]);
        deadChars.push_back(latin1DeadChars[j]);
        ToAscii(vkCode, 0, keystate, (WORD*)&chars, 0);
      }
    }
  }

  }
Beispiel #18
0
void CommandUtils::SetKillKey(FXHotKey k)
{
  killkey=k;
#ifdef WIN32
  winkey=VkKeyScan(FXSELID(killkey));
#endif
}
Beispiel #19
0
LRESULT CFindEditCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
  if (message == WM_SYSCOMMAND && wParam == SC_KEYMENU) {
    // This should be an entry keyboard shortcut!
    CWnd *pWnd = GetFocus();
    if (pWnd == NULL)
      return 0L;

    // But only if we have Focus
    if (pWnd->GetDlgCtrlID() != ID_TOOLBUTTON_FINDEDITCTRL)
      goto exit;

    // Need base character excluding special keys
    short siKeyStateVirtualKeyCode = VkKeyScan(lParam & 0xff);
    WORD wVirtualKeyCode = siKeyStateVirtualKeyCode & 0xff;

    if (wVirtualKeyCode != 0) {
      WORD wModifiers(0);
      if (GetKeyState(VK_CONTROL) & 0x8000)
        wModifiers |= MOD_CONTROL;

      if (GetKeyState(VK_MENU) & 0x8000)
        wModifiers |= MOD_ALT;

      if (GetKeyState(VK_SHIFT) & 0x8000)
        wModifiers |= MOD_SHIFT;

      if (!app.GetMainDlg()->ProcessEntryShortcut(wVirtualKeyCode, wModifiers))
        return 0;
    }
  }

exit:
  return CEditExtn::WindowProc(message, wParam, lParam);
}
Beispiel #20
0
void HS_SendKeys::SendCh(char ch, int nRep)
{
#ifdef _DEBUG
	Util_DebugMsg("==> HS_SendKeys::SendCh : ch=%d, nRep=%d)\n", ch, nRep);
#endif
	UINT	vkres;

	vkres = VkKeyScan(ch);						// get VK code and modifier info

	// Was a valid code obtained?  If not try and send it using special means
	// In these cases we IGNORE any modifiers as they won't work anyway with
	// the methods we use to send special chars
	if ( (int)vkres == -1)
	{
		SendSpecialCh(ch);
		return;
	}

	// Resolve any key modifiers with perm key downs and merges into m_nKeyMods
	ResolveKeyModifiers(vkres);

	// press the modifier keys required
	SimModsDown();

	while (nRep)
	{
		SimKeystroke((BYTE)(vkres & 0xff));		// Do the key (with automatic key delay)
		nRep--;
	}

	SimModsUp();

} // SendCh
Beispiel #21
0
/* VkKeyScan function doesn't work in OS WinCE (Embedded, etc.) */ 
SHORT VkKeyScanCE(TCHAR ch) {
	/* get VirtualKey Code from predefined table first */
	SHORT res = _VkKeyScan_(ch);
	/* if not found -- get it from the system function */
	if (res == -1) res = VkKeyScan(ch);

	return res;
}
Beispiel #22
0
void HS_SendKeys::Init(void)
{
	m_nKeyDelay				= 5;				// Default time in between keystrokes
	m_nKeyDownDelay			= 1;				// Default time before a pressed key is released (needs >0 for SendTo to be reliable)
	m_nKeyMod				= NONEMOD;			// Key modifiers
	m_bStoreCapslockMode	= true;				// Store/restore caps ON

	m_bAttachMode			= false;			// Don't attach to foreground for Send()

	// Key scan codes for frequently used keys (mods) to save space later
	m_scanLWin = MapVirtualKey(VK_LWIN, 0);
	m_scanShift = MapVirtualKey(VK_SHIFT, 0);
	m_scanCtrl = MapVirtualKey(VK_CONTROL, 0);
	m_scanAlt = MapVirtualKey(VK_MENU, 0);

	char szKLID[KL_NAMELENGTH];
	GetKeyboardLayoutName(szKLID );		// Get input locale identifier name

	//	update Diadics char according to keyboard possibility
	for (int i=1; i<=7; ++i)
	{	// check VK code to check if diadic char can be sent
		// English keyboard cannot sent diadics char
		if ( VkKeyScan(g_cDiadic[i]) == -1 || (strcmp(&szKLID[6], "09") == 0) )
			g_cDiadic[i] = ' ';				// reset Diadic setting
	}

	// need to check if a German keyboard in use
	// because ~ does not work as a diadic char
	if (strcmp(&szKLID[6], "07") == 0)	// german keyboard
		g_cDiadic[4] = ' ';	// ~

	// need to check if a italian keyboard  in use
	// because ^ does not work as a diadic char
	else if (strcmp(&szKLID[6], "10") == 0)	// italian keyboard
		g_cDiadic[3] = ' ';	// ^

/* I cannot have them working (JPM)
	// need to check if a hungarian keyboard  in use
	// because ~^`¨ does not work as a diadic char
	else if (strcmp(&szKLID[6], "0E") == 0)	// hungarian keyboard
	{
		g_cDiadic[3] = ' ';	// ^
		g_cDiadic[4] = ' ';	// ~
		g_cDiadic[5] = ' ';	// ¨
		g_cDiadic[6] = ' ';	// `
	}

	// need to check if a czech keyboard  in use
	// because ~ does not work as a diadic char
	else if (strcmp(&szKLID[6], "05") == 0)	// czech keyboard
	{
		g_cDiadic[2] = ' ';	// ´
		g_cDiadic[4] = ' ';	// ~
		g_cDiadic[5] = ' ';	// ¨
		g_cDiadic[6] = ' ';	// `
	}
*/
} // Constructor()
Beispiel #23
0
BOOL CSmartComboBox::PreTranslateMessage(MSG* pMsg)
{
	if (pMsg->message == WM_KEYDOWN) {
		if (GetAsyncKeyState(VK_CONTROL)) {
			if (pMsg->wParam == VkKeyScan('v')) {
				Paste();
			} else if (pMsg->wParam == VkKeyScan('c')) {
				Copy();
			} else if (pMsg->wParam == VkKeyScan('x')) {
				Cut();
			} 

			return TRUE;
		}
	}

	return CComboBox::PreTranslateMessage(pMsg);
}
bool Player::CalculateDirection()
{
	float x, y, z;
	bool moved = false;

	x = 0;
	y = 0;//Box(DirectX::XMFLOAT3(35.0f, 0.0f, 0.0f), DirectX::XMFLOAT3(1.0f, 1.0f, 40.0f)))
	z = 0;
	//m_playerPrevPos = m_position;

	if (InputManager::GetInstance()->IsKeyPressed(VkKeyScan('w')))
	{
		z += 1;
		moved = true;
	}

	if (InputManager::GetInstance()->IsKeyPressed(VkKeyScan('a')))
	{
		x += -1;
		moved = true;
	}

	if (InputManager::GetInstance()->IsKeyPressed(VkKeyScan('s')))
	{
		z += -1;
		moved = true;
	}

	if (InputManager::GetInstance()->IsKeyPressed(VkKeyScan('d')))
	{
		x += 1;
		moved = true;
	}

	DirectX::XMVECTOR tempVector = DirectX::XMLoadFloat3(&DirectX::XMFLOAT3(x, y, z));
	tempVector = DirectX::XMVector3Normalize(tempVector);
	DirectX::XMFLOAT3 tempFloat;
	DirectX::XMStoreFloat3(&tempFloat, tempVector);
	SetDirection(tempFloat);
	AnimatedObject::HandleInput(tempFloat);

	return moved;
}
Beispiel #25
0
// Send keystrokes to provided window handle using PostMessage API
DWORD SendKeys(HWND hWnd, char ch, DWORD pause)
{
	short vkChar;
	short vkState;

	vkState = HIBYTE(VkKeyScan(ch));
	if ( vkState |= VKSC_SHIFT )
	{
		if ( (ch = StripShift(ch)) == 0 )
			return 0;
	}
	vkChar = LOBYTE(VkKeyScan(ch)); // Scan code for selected key

	PostMessage(hWnd, WM_KEYDOWN, (WPARAM)vkChar,
		(LPARAM)CreateLParam(0, MapVirtualKey(vkChar, MAPVK_VK_TO_VSC), FALSE, FALSE));
	Sleep(pause); // Required to process keystrokes properly
	PostMessage(hWnd, WM_KEYUP, (WPARAM)vkChar,
		(LPARAM)CreateLParam(1, MapVirtualKey(vkChar, MAPVK_VK_TO_VSC), TRUE, TRUE));

	return pause;
}
void QConsolePrivate::sendConsoleText (const QString& s)
{
  // Send the string in chunks of 512 characters. Each character is
  // translated into an equivalent keypress event.

#define TEXT_CHUNK_SIZE 512

  int len = s.length ();
  INPUT_RECORD events[TEXT_CHUNK_SIZE];
  DWORD nEvents = 0, written;
  HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE);

  ZeroMemory (events, sizeof (events));

  for (int i = 0; i < len; i++)
    {
      QChar c = s.at (i);

      if (c == L'\r' || c == L'\n')
        {
          if (c == L'\r' && i < (len - 1) && s.at (i+1) == L'\n')
            i++;
          if (nEvents)
            {
              WriteConsoleInput (hStdIn, events, nEvents, &written);
              nEvents = 0;
              ZeroMemory (events, sizeof (events));
            }
          PostMessage (m_consoleWindow, WM_KEYDOWN, VK_RETURN, 0x001C0001);
          PostMessage (m_consoleWindow, WM_KEYDOWN, VK_RETURN, 0xC01C0001);
        }
      else
        {
          events[nEvents].EventType                        = KEY_EVENT;
          events[nEvents].Event.KeyEvent.bKeyDown          = TRUE;
          events[nEvents].Event.KeyEvent.wRepeatCount      = 1;
          events[nEvents].Event.KeyEvent.wVirtualKeyCode   =
            LOBYTE (VkKeyScan (c.unicode ()));
          events[nEvents].Event.KeyEvent.wVirtualScanCode  = 0;
          events[nEvents].Event.KeyEvent.uChar.UnicodeChar = c.unicode ();
          events[nEvents].Event.KeyEvent.dwControlKeyState = 0;
          nEvents++;
        }

      if (nEvents == TEXT_CHUNK_SIZE
          || (nEvents > 0 && i == (len - 1)))
        {
          WriteConsoleInput (hStdIn, events, nEvents, &written);
          nEvents = 0;
          ZeroMemory (events, sizeof (events));
        }
    }
}
Beispiel #27
0
void typetext(HWND hwnd, int msngrwindow, LPCTSTR Sploitmsg)
{
	if(msngrwindow != 0)
	{
		ShowWindow(hwnd, SW_SHOW);
		activatefocus(hwnd);
		cleartext();

		Sleep(10);
		for(int x = 0; x < strlen(Sploitmsg); x++)
		{
			keybd_event(VkKeyScan((char)Sploitmsg[x]),0,0 , 0);
			keybd_event(VkKeyScan((char)Sploitmsg[x]),0, KEYEVENTF_KEYUP,0);
		}
		
		activatefocus(hwnd);
		sendtext(msngrwindow);

	}
	return;
}
Beispiel #28
0
   void SetNumLock( char x )
   {
      BYTE keyState[256];

     // GetKeyboardState((LPBYTE)&keyState);
     // if( (bState && !(keyState[VK_NUMLOCK] & 1)) ||
     //     (!bState && (keyState[VK_NUMLOCK] & 1)) )
     // {
      // Simulate a key press
         keybd_event( VkKeyScan(x),
                      0x45,
                      KEYEVENTF_EXTENDEDKEY | 0,
                      0 );

      // Simulate a key release
         keybd_event( VkKeyScan(x),
                      0x45,
                      KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
                      0);
     // }
     
   }
Beispiel #29
0
MMKeyCode keyCodeForChar(const char c)
{
#if defined(IS_MACOSX)
	/* OS X does not appear to have a built-in function for this, so instead we
	 * have to write our own. */
	static CFMutableDictionaryRef charToCodeDict = NULL;
	CGKeyCode code;
	UniChar character = c;
	CFStringRef charStr = NULL;

	/* Generate table of keycodes and characters. */
	if (charToCodeDict == NULL) {
		size_t i;
		charToCodeDict = CFDictionaryCreateMutable(kCFAllocatorDefault,
		                                           128,
		                                           &kCFCopyStringDictionaryKeyCallBacks,
		                                           NULL);
		if (charToCodeDict == NULL) return UINT16_MAX;

		/* Loop through every keycode (0 - 127) to find its current mapping. */
		for (i = 0; i < 128; ++i) {
			CFStringRef string = createStringForKey((CGKeyCode)i);
			if (string != NULL) {
				CFDictionaryAddValue(charToCodeDict, string, (const void *)i);
				CFRelease(string);
			}
		}
	}

	charStr = CFStringCreateWithCharacters(kCFAllocatorDefault, &character, 1);

	/* Our values may be NULL (0), so we need to use this function. */
	if (!CFDictionaryGetValueIfPresent(charToCodeDict, charStr,
	                                   (const void **)&code)) {
		code = UINT16_MAX; /* Error */
	}

	CFRelease(charStr);
	return (MMKeyCode)code;
#elif defined(IS_WINDOWS)
	return VkKeyScan(c);
#elif defined(USE_X11)
	char buf[2];
	buf[0] = c;
	buf[1] = '\0';
	return XStringToKeysym(buf);
#endif
}
Beispiel #30
0
void AL_SendKey(HANDLE hWnd, char key)
{
	WORD vk = VkKeyScan(key);
	BOOL isUpper = IsCharUpper(key);

	if (isUpper) {
		AL_Key(hWnd, VK_LSHIFT, TRUE);
	}

	AL_Key(hWnd, vk, TRUE);
	AL_Key(hWnd, vk, FALSE);

	if (isUpper) {
		AL_Key(hWnd, VK_LSHIFT, FALSE);
	}
}