BuiltIn.SetKeyboardLayout Method

Applies to TestComplete 14.30, last modified on November 21, 2019
This method is obsolete. See the Remarks section below.

Description

Use the BuiltIn.SetKeyboardLayout method to set the desired keyboard layout for any process running in the operating system. The method is a script wrapper for the LoadKeyboardLayout function of Win32 API.

Declaration

BuiltIn.SetKeyboardLayout(Param1Param2)

Param1 [in]    Required    Integer    
Param2 [in]    Required    String    
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Param1

Specifies the identifier of the process for which you are going to set the keyboard layout. You can obtain the process id using the Id property of the process object that corresponds to the desired process. If you use the process identifier shown in the Windows Task Manager, a call to SetKeyboardLayout will fail after you stop the process and run it again, since the next time you run the process, its identifier changes.

Param2

A string that contains the input layout identifier for the specified window in the hexadecimal form. The first four characters of the string indicate the device handler of the keyboard physical layout. The last four characters of the string indicate the language identifier: for example, the language ID of US English is 0409, German - 0407, French - 0407 and so on.

The full layout identifier string looks like “00000409” (US English), “00000407” (German), “0000040C” (French) and so on. Layout variant strings are slightly different (for example, “00100409” for the Dvorak layout for US English). For complete information on layout identifiers, see the description of the LoadKeyboardLayout function in Win32 API documentation.

You can also use MAKELANGID macros to get the language identifiers you need.

In order for the function to be able to change the layout successfully, the appropriate keyboard layout must be installed in the operating system. If the specified layout is not installed, the function will fail. To check if support for the desired language is installed, use the aqEnvironment.IsLanguageSupported function.

Result Value

If the keyboard layout has been changed successfully, the method returns True; else - False.

Remarks

This method is obsolete. It is supported for backward compatibility only. To change the keyboard layout, use the aqEnvironment.SetKeyboardLayout method.

See Also

aqEnvironment.SetKeyboardLayout Method
aqEnvironment.IsLanguageSupported Method
Keys Method
Keys Method
Keys Action
Simulating Keystrokes

Highlight search results