Jump to content

Swiss keyboard layout


Recommended Posts

Hello, helpful people

I have several Windows system with input configured as in the attached image:

- Default input language: Italian

- Keyboard: Swiss German

Italian

I need to run a Unix Virtual Machine and configure it passing the correct keyboard setting, this because in my company we have an application which only runs under Linux, and we can't afford to give the users two different systems, or forcing them to switch one another.

Apart from that, the main problem is that using the WinAPIEx.au3 _WinAPI_GetKeyboardLayout doesn't return the actual layout the keyboard is configured with. It's always returning the 00000410, which is the italian layout, even if the Swiss German layout is set.

I don't even understand where this actual layout is kept: in the registry, all I can see is:

HKEY_CURRENT_USER\Keyboard Layout\Preload 
1 = d0010410
2 = 00000410 (Italian)

and

HKEY_CURRENT_USER\Keyboard Layout\Substitutes 
d0010410 = 00000807 (German Swiss)

To be more explainful, here is the test I do:

- start with Language bar set to Italian

- run notepad.exe

- activate the notepad window and set the language to be Swiss German

- run the following script:

Opt("WinTitleMatchMode", 2)

Sleep(500)
$hWnd = WinGetHandle("Notepad")
MsgBox (0, "Keyboard code for window: " & $hWnd, _GetKeyboardLayout($hWnd))

Func _GetKeyboardLayout($hWnd)
    Local $ret = DllCall("user32.dll", "long", "GetWindowThreadProcessId", "hwnd", $hWnd, "ptr", 0)
          $ret = DllCall("user32.dll", "long", "GetKeyboardLayout", "long", $ret[0])
          Return "0000" & Hex($ret[0], 4)
EndFunc

I expect the script to return the German Swiss code (0000807). Instead, it return the italian one (00000410)

Does anybody have any hint?

Thanks in advance

stef

post-61624-0-43592500-1306853412_thumb.j

Edited by steff
Link to comment
Share on other sites

And @KBLayout OR _WinAPI_GetKeyboardLayout() in WinAPIEx.au3 by Yashied.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

And @KBLayout OR _WinAPI_GetKeyboardLayout() in WinAPIEx.au3 by Yashied.

Actually, they don't return the real keyboard layout: please read my initial post.

As MSDN states:

GetKeyboardLayout Function

Retrieves the active input locale identifier (formerly called the keyboard layout) for the specified thread.

So, if my input locale identifier is = Italian and my keyboard is Swiss German, _WinAPI_GetKeyboardLayout() returns the Italian code.

As far as I researched, with three different computer with different keyboard layout, the GetKeyboardLayoutName function always return the correct keyboard layout code .

Edited by steff
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...