当前位置: 首页>>代码示例>>C++>>正文


C++ GetKeyboardLayout函数代码示例

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


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


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