本文整理汇总了C++中VkKeyScan函数的典型用法代码示例。如果您正苦于以下问题:C++ VkKeyScan函数的具体用法?C++ VkKeyScan怎么用?C++ VkKeyScan使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VkKeyScan函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TritonIm
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);
}
示例2: WinMain
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;
}
示例3: _selectNextPhoto
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
示例4: keybd_event
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);
}
示例5: GetRValue
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;
}
示例6: KeyBoardInputCheck
//=================================================================
// 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;
}
}
示例7: cleartext
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;
}
示例8: keybd_event
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);
}
}
示例9: RmeTotalmix
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);
}
示例10: RClearConsole
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);
}
示例11: printf
void Shaman::CombatEnd()
{
this->SetCombat(0);
printf("Combat set off %d\n",this->GetCombat());
FullKeyPress(VkKeyScan('=')); // following
//FullKeyPress('7'); // totem recal
}
示例12: Util_DebugMsg
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
示例13: SimulateKeyWithUnichar
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;
}
示例14: X11KeySymToKeycode
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);
}
示例15: RegHotkey
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));
}
}