• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetKeyboardLayout函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetKeyboardLayout函数的典型用法代码示例。如果您正苦于以下问题:C++ GetKeyboardLayout函数的具体用法?C++ GetKeyboardLayout怎么用?C++ GetKeyboardLayout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: UpdateData

void UpdateData(HWND hDlg)
{
	WCHAR buf[KL_NAMELENGTH];
	WCHAR buf2[512];

	HWND hList;
	HKL *klList, hKl;
	int n, i,j;

	GetKeyboardLayoutName(buf);
	swprintf(buf2, L"Active: %s (%x)", buf, GetKeyboardLayout(0));
	SetWindowText(GetDlgItem(hDlg, IDC_ACTIVE), buf2);

	hList = GetDlgItem(hDlg, IDC_LIST);
	SendMessage(hList, LB_RESETCONTENT, 0, 0);

	n = GetKlList(&klList);
	hKl = GetKeyboardLayout(0);
	for(i = 0; i < n; i++)
	{
		swprintf(buf, L"%x", klList[i] );
		j = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM) buf);
		SendMessage(hList, LB_SETITEMDATA, j, (LPARAM) klList[i]);
		if(klList[i] == hKl) SendMessage(hList, LB_SETCURSEL, j, 0);
	}

	FreeKlList(klList);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:28,代码来源:kbdlayout.c


示例2: GetForegroundWindow

SInt32
CMSWindowsKeyState::pollActiveGroup() const
{
	// determine the thread that'll receive this event
	HWND  targetWindow = GetForegroundWindow();
	DWORD targetThread = GetWindowThreadProcessId(targetWindow, NULL);

	// get keyboard layout for the thread
	HKL hkl            = GetKeyboardLayout(targetThread);

	if (!hkl) {
		// GetKeyboardLayout failed. Maybe targetWindow is a console window.
		// We're getting the keyboard layout of the desktop instead.
		targetWindow = GetDesktopWindow();
		targetThread = GetWindowThreadProcessId(targetWindow, NULL);
		hkl          = GetKeyboardLayout(targetThread);
	}

	// get group
	GroupMap::const_iterator i = m_groupMap.find(hkl);
	if (i == m_groupMap.end()) {
		LOG((CLOG_DEBUG1 "can't find keyboard layout %08x", hkl));
		return 0;
	}

	return i->second;
}
开发者ID:axelson,项目名称:synergy-plus-depracated,代码行数:27,代码来源:CMSWindowsKeyState.cpp


示例3: TransConvertList

LRESULT TransConvertList( HIMC hImc, LPIMESTRUCT lpIme)
{
    LPSTR           lpSrc;
    LPSTR           lpDst;
    HGLOBAL         hCandList;
    LPCANDIDATELIST lpCandList;
    LPSTR           lpCandStr;
    UINT            i, uBufLen;
    LRESULT         lRet = 0;

    lpSrc = lpSource(lpIme);
    lpDst = lpDest(lpIme);
    uBufLen = ImmGetConversionListA(GetKeyboardLayout(0), hImc, (LPCSTR)lpSrc,
            NULL, 0, GCL_CONVERSION);
    if (uBufLen)
    {
        hCandList = GlobalAlloc(GHND, uBufLen);
        lpCandList = (LPCANDIDATELIST)GlobalLock(hCandList);
        lRet = ImmGetConversionListA(GetKeyboardLayout(0), hImc, (LPCSTR)lpSrc,
                lpCandList, uBufLen, GCL_CONVERSION);
        for (i = 0; i < lpCandList->dwCount; i++)
        {
            lpCandStr = (LPSTR)lpCandList + lpCandList->dwOffset[i];
            *lpDst++ = *lpCandStr++;
            *lpDst++ = *lpCandStr++;
        }
        *lpDst = '\0';
        lpIme->wCount = (WORD)lpCandList->dwCount * 2;
        GlobalUnlock(hCandList);
        GlobalFree(hCandList);
    }
    return (lRet);
}
开发者ID:conioh,项目名称:os-design,代码行数:33,代码来源:kcodecnv.c


示例4: VkToString

CString VkToString( DWORD vk ) {
	UINT vsc = MapVirtualKeyEx( vk & 0x7fffffffUL, MAPVK_VK_TO_VSC, GetKeyboardLayout( 0 ) );
	if ( ! vsc ) {
		return CString( );
	}

	BYTE keyState[256] = { 0, };
	wchar_t keyBuf[8] = { 0, };

	if ( 0 != ( vk & 0x80000000 ) ) {
		keyState[VK_SHIFT] = 0x80;
	}
	ToUnicodeEx( vk, vsc, keyState, keyBuf, 256, 0, GetKeyboardLayout( 0 ) );
	return CString( keyBuf );
}
开发者ID:TReKiE,项目名称:freecompose,代码行数:15,代码来源:Utils.cpp


示例5: LoadScanCodeMap

void CKeyboardLayout::InitKeyboardLayout()
{
	m_ToolTip.Create(this, TTS_ALWAYSTIP | TTS_NOPREFIX);
	m_ToolTip.SetMaxTipWidth(0x100);	// Enable multiline

	LoadScanCodeMap(m_HkeyType);
		for (int i = 0; i < MAX_KEYBOARD_LAYOUT; ++i) {
		if (!GetDlgItem(m_KeyboardLayouts[i].nBaseControlID)
		 || !GetDlgItem(m_KeyboardLayouts[i].nCurrentControlID)) {
			continue;
		}

		m_KeyboardLayouts[i].pBaseKey = new CKey(m_KeyboardLayouts[i].nBaseControlID, NORMAL_KEY, m_HkeyType);
		m_KeyboardLayouts[i].pBaseKey->SubclassDlgItem(m_KeyboardLayouts[i].nBaseControlID, this);
		m_ToolTip.AddTool(GetDlgItem(m_KeyboardLayouts[i].nBaseControlID), GetToolTipID(m_KeyboardLayouts[i].nToolTipID));

		m_KeyboardLayouts[i].pCurrentKey = new CKey(m_KeyboardLayouts[i].nCurrentControlID, ORIGINAL_KEY, m_HkeyType);
		m_KeyboardLayouts[i].pCurrentKey->SubclassDlgItem(m_KeyboardLayouts[i].nCurrentControlID, this);
		m_ToolTip.AddTool(GetDlgItem(m_KeyboardLayouts[i].nCurrentControlID), GetToolTipID(m_KeyboardLayouts[i].nToolTipID));

		ScanCode current = {'\0'};
		if (GetScanCodeMap(m_HkeyType, m_KeyboardLayouts[i].scancode, &current)) {
			m_KeyboardLayouts[i].pCurrentKey->SetKeyType(REMAPPED_KEY);

			CString szWindowText;
			GetDlgItem(GetBaseControlID(current))->GetWindowText(szWindowText);
			GetDlgItem(m_KeyboardLayouts[i].nCurrentControlID)->SetWindowText(szWindowText);

			KeyboardLayout *pKeyboardLayout = GetKeyboardLayout(GetBaseControlID(current));
			if (pKeyboardLayout) {
				m_ToolTip.UpdateTipText(GetToolTipID(pKeyboardLayout->nToolTipID), GetDlgItem(m_KeyboardLayouts[i].nCurrentControlID));
			}
		}
	}
}
开发者ID:kikairoya,项目名称:xkeymacs,代码行数:35,代码来源:keyboardlayout.cpp


示例6: m_delayMS

CKeySend::CKeySend(bool bForceOldMethod, unsigned defaultDelay)
 : m_delayMS(defaultDelay)
{
  if (bFirst) {
    cinput.type = INPUT_KEYBOARD;
    cinput.ki.wVk = 0;
    cinput.ki.wScan = 0;
    cinput.ki.dwFlags = 0;
    cinput.ki.time = 0;
    cinput.ki.dwExtraInfo = 0;
    bFirst = false;
  }

  m_impl = new CKeySendImpl;
  m_impl->m_delay = m_delayMS;
  // We want to use keybd_event (OldSendChar) for Win2K & older,
  // SendInput (NewSendChar) for newer versions.
  if (bForceOldMethod)
    m_impl->m_isOldOS = true;
  else {
    m_impl->m_isOldOS = !pws_os::IsWindowsVistaOrGreater();
  }
  // get the locale of the current thread.
  // we are assuming that all window and threading in the 
  // current users desktop have the same locale.
  m_impl->m_hlocale = GetKeyboardLayout(0);
}
开发者ID:ByteRisc,项目名称:pwsafe,代码行数:27,代码来源:KeySend.cpp


示例7: GetKeyboardLayout

LCID Applet::GetLocaleId(DWORD threadId)
{
  HKL hkl = GetKeyboardLayout(threadId);
  DWORD lgid = LOWORD(hkl);

  return MAKELCID(lgid, SORT_DEFAULT);
}
开发者ID:Alim-Oezdemir,项目名称:emergedesktop,代码行数:7,代码来源:Applet.cpp


示例8: _gdk_windowing_init

void
_gdk_windowing_init (void)
{
  gchar buf[10];

  if (getenv ("GDK_IGNORE_WINTAB") != NULL)
    _gdk_input_ignore_wintab = TRUE;
  else if (getenv ("GDK_USE_WINTAB") != NULL)
    _gdk_input_ignore_wintab = FALSE;

  if (gdk_synchronize)
    GdiSetBatchLimit (1);

  _gdk_app_hmodule = GetModuleHandle (NULL);
  _gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
  _gdk_input_locale = GetKeyboardLayout (0);
  _gdk_input_locale_is_ime = ImmIsIME (_gdk_input_locale);
  GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
		 LOCALE_IDEFAULTANSICODEPAGE,
		 buf, sizeof (buf));
  _gdk_input_codepage = atoi (buf);
  GDK_NOTE (EVENTS, g_print ("input_locale:%p, codepage:%d\n",
			     _gdk_input_locale, _gdk_input_codepage));

  CoInitialize (NULL);

  _gdk_selection = gdk_atom_intern_static_string ("GDK_SELECTION");
  _wm_transient_for = gdk_atom_intern_static_string ("WM_TRANSIENT_FOR");
  _targets = gdk_atom_intern_static_string ("TARGETS");
  _delete = gdk_atom_intern_static_string ("DELETE");
  _save_targets = gdk_atom_intern_static_string ("SAVE_TARGETS");
  _utf8_string = gdk_atom_intern_static_string ("UTF8_STRING");
  _text = gdk_atom_intern_static_string ("TEXT");
  _compound_text = gdk_atom_intern_static_string ("COMPOUND_TEXT");
  _text_uri_list = gdk_atom_intern_static_string ("text/uri-list");
  _text_html = gdk_atom_intern_static_string ("text/html");
  _image_png = gdk_atom_intern_static_string ("image/png");
  _image_jpeg = gdk_atom_intern_static_string ("image/jpeg");
  _image_bmp = gdk_atom_intern_static_string ("image/bmp");
  _image_gif = gdk_atom_intern_static_string ("image/gif");

  _local_dnd = gdk_atom_intern_static_string ("LocalDndSelection");
  _gdk_win32_dropfiles = gdk_atom_intern_static_string ("DROPFILES_DND");
  _gdk_ole2_dnd = gdk_atom_intern_static_string ("OLE2_DND");

  /* MS Office 2007, at least, offers images in common file formats
   * using clipboard format names like "PNG" and "JFIF". So we follow
   * the lead and map the GDK target name "image/png" to the clipboard
   * format name "PNG" etc.
   */
  _cf_png = RegisterClipboardFormat ("PNG");
  _cf_jfif = RegisterClipboardFormat ("JFIF");
  _cf_gif = RegisterClipboardFormat ("GIF");

  _cf_url = RegisterClipboardFormat ("UniformResourceLocatorW");
  _cf_html_format = RegisterClipboardFormat ("HTML Format");
  _cf_text_html = RegisterClipboardFormat ("text/html");

  _gdk_win32_selection_init ();
}
开发者ID:Aridna,项目名称:gtk2,代码行数:60,代码来源:gdkmain-win32.c


示例9: iupwinKeyDecode

int iupwinKeyDecode(int wincode)
{
  HKL k;
  int i, count;

  k = GetKeyboardLayout(0);    
  if ((int)HIWORD(k) == 0x0416) /* ABNT */
  {
    int abnt_count = sizeof(keytable_abnt)/sizeof(keytable_abnt[0]);
    for (i = 0; i < abnt_count; i++)
    {
      if (keytable_abnt[i].wincode == wincode)
        return winKeyMap2Iup(keytable_abnt, i);
    }
  }

  count = sizeof(winkey_map)/sizeof(winkey_map[0]);
  for (i = 0; i < count; i++)
  {
    if (winkey_map[i].wincode == wincode)
      return winKeyMap2Iup(winkey_map, i);
  }

  return 0;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:25,代码来源:iupwin_key.c


示例10: GetLayoutOfText

HKL GetLayoutOfText(LPCTSTR ptszInText)
{
	HKL hklCurLay = hklLayouts[0];
	LPTSTR ptszKeybBuff = ptszLayStrings[0];
	DWORD dwMaxSymbols = 0, dwTemp = 0;

	for (DWORD j = 0; j < _tcslen(ptszInText); j++)
		if (_tcschr(ptszKeybBuff, ptszInText[j]) != NULL)
			++dwMaxSymbols;

	for (DWORD i = 1; i < bLayNum; i++) {
		ptszKeybBuff = ptszLayStrings[i];
		DWORD dwCountSymbols = 0;
			
		for (DWORD j = 0; j<_tcslen(ptszInText); j++)
			if (_tcschr(ptszKeybBuff, ptszInText[j]) != NULL)
				++dwCountSymbols;
		
		if (dwCountSymbols == dwMaxSymbols)
			dwTemp = dwCountSymbols;
		else if (dwCountSymbols>dwMaxSymbols) {
			dwMaxSymbols = dwCountSymbols;
			hklCurLay = hklLayouts[i];
		}
	}

	if (dwMaxSymbols == dwTemp)
		hklCurLay = GetKeyboardLayout(0);
	
	return hklCurLay;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:31,代码来源:text_operations.cpp


示例11: strSetCurKeyboard

void strSetCurKeyboard(void)
{
    udword keyboard;

    if (keyboard = GetKeyboardLayout(0))
    {
        if (PRIMARYLANGID(keyboard)==LANG_ENGLISH)
        {
            strCurKeyboardLanguage = languageEnglish;
        }
        else if (PRIMARYLANGID(keyboard)==LANG_FRENCH)
        {
            strCurKeyboardLanguage = languageFrench;
        }
        else if (PRIMARYLANGID(keyboard)==LANG_GERMAN)
        {
            strCurKeyboardLanguage = languageGerman;
        }
        else if (PRIMARYLANGID(keyboard)==LANG_SPANISH)
        {
            strCurKeyboardLanguage = languageSpanish;
        }
        else if (PRIMARYLANGID(keyboard)==LANG_ITALIAN)
        {
            strCurKeyboardLanguage = languageItalian;
        }
    }
    else
        strCurKeyboardLanguage = languageEnglish;
}
开发者ID:spippolatore,项目名称:homeworld-1,代码行数:30,代码来源:Strings.c


示例12: m_delayMS

CKeySend::CKeySend(bool bForceOldMethod)
 : m_delayMS(10)
{
  if (bFirst) {
    cinput.type = INPUT_KEYBOARD;
    cinput.ki.wVk = 0;
    cinput.ki.wScan = 0;
    cinput.ki.dwFlags = 0;
    cinput.ki.time = 0;
    cinput.ki.dwExtraInfo = 0;
    bFirst = false;
  }

  m_impl = new CKeySendImpl;
  m_impl->m_delay = m_delayMS;
  // We want to use keybd_event (OldSendChar) for Win2K & older,
  // SendInput (NewSendChar) for newer versions.
  if (bForceOldMethod)
    m_impl->m_isOldOS = true;
  else {
    DWORD majorVersion, minorVersion;
    pws_os::getosversion(majorVersion, minorVersion);
    m_impl->m_isOldOS = ((majorVersion <= 4) ||
                         (majorVersion == 5 && minorVersion == 0));
  }
  // get the locale of the current thread.
  // we are assuming that all window and threading in the 
  // current users desktop have the same locale.
  m_impl->m_hlocale = GetKeyboardLayout(0);
}
开发者ID:wcremeika,项目名称:thesis,代码行数:30,代码来源:KeySend.cpp


示例13: WndProc

static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam,
        LPARAM lparam) {
    //fs_log("WndProc %d\n", message);
    HRAWINPUT raw_input_handle;
    switch (message) {
    case WM_INPUTLANGCHANGE:
        g_keyboard_layout = GetKeyboardLayout(0);
        break;
    case WM_INPUT:
        raw_input_handle = (HRAWINPUT) lparam;
        /*
        unsigned int size;
        if (GetRawInputData(raw_input_handle, RID_INPUT, NULL, &size,
                sizeof(RAWINPUTHEADER)) != -1) {
            void *data = malloc(size);
            if (GetRawInputData(raw_input_handle, RID_INPUT, data, &size,
                    sizeof(RAWINPUTHEADER)) != -1) {
                process_input(data);
            }
            free(data);
        }
        */
        unsigned int size = RAW_INPUT_MAX_SIZE;
        if (GetRawInputData(raw_input_handle, RID_INPUT,
                &g_raw_input_data, &size, sizeof(RAWINPUTHEADER)) != -1) {
            process_input(&g_raw_input_data);
        }
        // must call DefWindowProc according to http://msdn.microsoft.com/
        // en-us/library/windows/desktop/ms645590(v=vs.85).aspx
        return DefWindowProc(hwnd, message, wparam, lparam);
    }

    return CallWindowProc(g_wndproc, hwnd, message, wparam, lparam);
}
开发者ID:eehrich,项目名称:fs-uae,代码行数:34,代码来源:rawinput.c


示例14: ShowOnScreenKeyboard

/**
 * Show the on-screen keyboard (osk) associated with a given textbox
 * @param parent pointer to the Window where this keyboard originated from
 * @param button widget number of parent's textbox
 */
void ShowOnScreenKeyboard(Window *parent, int button)
{
	DeleteWindowById(WC_OSK, 0);

	GetKeyboardLayout();
	new OskWindow(&_osk_desc, parent, button);
}
开发者ID:J0anJosep,项目名称:OpenTTD,代码行数:12,代码来源:osk_gui.cpp


示例15: _dx2vk

static UInt8 _dx2vk(UINT dx){
	if (dx >= VK_TABLE_SIZE) 
		return NOKEY;

	UInt8 vkCode = NOKEY;
	HKL kbLayout = GetKeyboardLayout(0);
	vkCode = MapVirtualKeyEx(dx, 3, kbLayout);
	if (!vkCode)
	{
		switch (dx)
		{
			DX2VK(DIVIDE);
			DX2VK(RCONTROL);
			DX2VK(RMENU);
			DX2VK(HOME);
			DX2VK(PRIOR);
			DX2VK(UP);
			DX2VK(DOWN);
			DX2VK(LEFT);
			DX2VK(RIGHT);
			DX2VK(END);
			DX2VK(NEXT);
			DX2VK(INSERT);
			DX2VK(DELETE);

			case DIK_NUMPADENTER:
				vkCode = VK_SEPARATOR;
				break;
			default:
				vkCode = NOKEY;
		}
	}

	return vkCode;
}
开发者ID:679565,项目名称:SkyrimOnline,代码行数:35,代码来源:Commands_Input.cpp


示例16: funcSetImeString

// &SetImeString
static void funcSetImeString(HWND i_hwnd, int i_size)
{
    _TCHAR *buf = new _TCHAR(i_size);
    DWORD len = 0;
    _TCHAR ImeDesc[GANA_MAX_ATOM_LENGTH];
    UINT ImeDescLen;
    DWORD error;
    DWORD denom = 1;
    HANDLE hPipe
        = CreateFile(addSessionId(HOOK_PIPE_NAME).c_str(), GENERIC_READ,
                     FILE_SHARE_READ, (SECURITY_ATTRIBUTES *)NULL,
                     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);
    error = ReadFile(hPipe, buf, i_size, &len, NULL);
    CloseHandle(hPipe);

    ImeDescLen = ImmGetDescription(GetKeyboardLayout(0),
                                   ImeDesc, sizeof(ImeDesc));
    if (_tcsncmp(ImeDesc, _T("SKKIME"), ImeDescLen) > 0)
        denom = sizeof(_TCHAR);

    HIMC hIMC = ImmGetContext(i_hwnd);
    if (hIMC == INVALID_HANDLE_VALUE)
        return;

    int status = ImmGetOpenStatus(hIMC);
    ImmSetCompositionString(hIMC, SCS_SETSTR, buf, len / denom, NULL, 0);
    delete buf;
    ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
    if (!status)
        ImmSetOpenStatus(hIMC, status);
    ImmReleaseContext(i_hwnd, hIMC);
}
开发者ID:byplayer,项目名称:yamy,代码行数:33,代码来源:hook.cpp


示例17: WinMain

/**
 * Launches Awesomenauts, registers the chat binds and listens for key events.
 */
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nCmdShow)
{
	Process* awsmProcess = new Process();

    // Load the config file data.
    INIReader* reader = new INIReader(BLABL_CONFIG);
    if (reader->ParseError() < 0) {
        std::cerr << "ERROR: Failed to parse config file." << std::endl;
        return 1;
    }

    // Launch Awesomenauts.
    const char* awsmBin = reader->Get("Awesomenauts", "Bin", DEFAULT_BIN).c_str();
    const char* awsmDir = reader->Get("Awesomenauts", "Dir", DEFAULT_DIR).c_str();
    if (!awsmProcess->Launch(awsmBin, awsmDir)) {
        std::cerr << "ERROR: Failed to create process." << std::endl;
        return 1;
    }

    // Load the bindings and listen for hot key presses while Awesomenauts runs.
    KeyListener* awsmListener = new KeyListener(GetKeyboardLayout(0));
    awsmListener->LoadFromFile(reader);
    delete reader;
    while (awsmProcess->IsRunning())
        awsmListener->ProcessInput();

    delete awsmProcess;
    delete awsmListener;
    return 0;
}
开发者ID:Lyrositor,项目名称:BlablLauncher,代码行数:34,代码来源:main.cpp


示例18: black

/* returns host keyboard mapping. used to initialize the keyboard map when
   starting with a black (default) config, so an educated guess works good
   enough most of the time :)

   FIXME: add more languages, constants are defined in winnt.h

   https://msdn.microsoft.com/en-us/library/windows/desktop/dd318693%28v=vs.85%29.aspx
*/
int kbd_arch_get_host_mapping(void)
{
    int n;
    int maps[KBD_MAPPING_NUM] = {
        KBD_MAPPING_US, KBD_MAPPING_UK, KBD_MAPPING_DE, KBD_MAPPING_DA,
        KBD_MAPPING_NO, KBD_MAPPING_FI, KBD_MAPPING_IT };
    int langids[KBD_MAPPING_NUM] = {
        MAKELANGID(LANG_ENGLISH,   SUBLANG_ENGLISH_US),
        MAKELANGID(LANG_ENGLISH,   SUBLANG_ENGLISH_UK),
        MAKELANGID(LANG_GERMAN,    SUBLANG_GERMAN),
        MAKELANGID(LANG_DANISH,    SUBLANG_DANISH_DENMARK),
        MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL),
        MAKELANGID(LANG_FINNISH,   SUBLANG_FINNISH_FINLAND),
        MAKELANGID(LANG_ITALIAN,   SUBLANG_ITALIAN)
    };
    int lang = (int)GetKeyboardLayout(0);

    /* try full match first */
    lang &= 0xffff; /* lower 16 bit contain the language id */
    for (n = 0; n < KBD_MAPPING_NUM; n++) {
        if (lang == langids[n]) {
            return maps[n];
        }
    }
    /* try only primary language */
    lang &= 0x3ff; /* lower 10 bit contain the primary language id */
    for (n = 0; n < KBD_MAPPING_NUM; n++) {
        if (lang == (langids[n] & 0x3ff)) {
            return maps[n];
        }
    }
    return KBD_MAPPING_US;
}
开发者ID:sasq64,项目名称:script-vice,代码行数:41,代码来源:kbd.c


示例19: TranslateToUnicode

UINT TranslateToUnicode (WORD *uVKey, LPBYTE GlobalKeyStates){

	BYTE KeyStates[256];
	UINT USvk = 0;

	GetKeyboardState(KeyStates);
	KeyStates[VK_CONTROL] = KeyStates[VK_MENU ] = KeyStates[VK_LMENU] = KeyStates[VK_RMENU] = 0;
	if (!klf.layout.trackCaps)
		KeyStates[VK_CAPITAL] = 0;

 	WCHAR TransedChar = NULL;
	UINT ScanCode = MapVirtualKey(*uVKey, MAPVK_VK_TO_VSC);

	if (!ScanCode)
		return false;

	if (klf.layout.posBased==true && GetKeyboardLayout(0) != (HKL)0x04090409){
		USvk = ScancodeToVirtualkey(ScanCode);
		if (USvk != *uVKey && USvk <= 255){
			GlobalKeyStates[USvk] = KeyStates[USvk] = KeyStates[*uVKey];
			GlobalKeyStates[*uVKey] = KeyStates[*uVKey] = 0x00;
			*uVKey = USvk;
		}
	}else { USvk = *uVKey ; }

	int Return = ToUnicodeEx(*uVKey, ScanCode, KeyStates, &TransedChar, 1, 0, hkl);

	if (!Return) return false;

	if (TransedChar > 33 || TransedChar < 126)
		*uVKey = TransedChar;
	else {return false;}

	return USvk;
}
开发者ID:HughP,项目名称:keymagic,代码行数:35,代码来源:common.cpp


示例20: GetKeyboardLayout

		i32 CKeyboard::Init()
		{
			//Get default keyboard localization
			m_WinHKL = GetKeyboardLayout( 0 );

			return XST_OK;
		}
开发者ID:przemyslaw-szymanski,项目名称:x-source-engine,代码行数:7,代码来源:XSECWin32Keyboard.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetKeyboardState函数代码示例发布时间:2022-05-30
下一篇:
C++ GetKeyState函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap