LoadKeyboardLayout() Function does not work in VB 2010
I want to change my default keyboard Layout for a installed another Keyboard Layout using my VB application.I googled about this and find Function LoadKeyboardLayout() Function to do that.But Is this support in vb 2010.When I wrote below code and there is no syntax error.But when I run the program there is an error called "PInvokeStackImbalance was detected... " How can I solve this in vb 2010. Here is my code:
Private Const KLF_ACTIVATE As Long = &H1
Private Const KLF_NOTELLSHELL As Long = &H80
Private Const KLF_REORDER As Long = &H8
Private Const KLF_REPLACELANG As Long = &H10
Private Const KLF_RESET As Long = &H40000000
Private Const KLF_SETFORPROCESS As Long = &H100
Private Const KLF_SHIFTLOCK As Long = &H1开发者_运维知识库0000
Private Const KLF_SUBSTITUTE_OK As Long = &H2
Private Const KLF_UNLOADPREVIOUS As Long = &H4
Private Declare Function LoadKeyboardLayout _
Lib "user32.dll" _
Alias "LoadKeyboardLayoutA" ( _
ByVal pwszKLID As String, _
ByVal flags As Long) As Long
'Inside a button click event
LoadKeyboardLayout("00000409", KLF_ACTIVATE)
Can anyone help me...
I think all you have to do is switch the longs to integers...
Private Declare Function LoadKeyboardLayout Lib "user32.dll" _
Alias "LoadKeyboardLayoutA" ( ByVal pwszKLID As String, _
ByVal flags As Integer) As Integer
精彩评论