Показать сообщение отдельно
Старый 24.12.2017, 02:21   #205
duzzy
Гуру
 
Регистрация: 01.06.2013
Регион: 78, 98
Машина: SUBARU Impreza WRX
Сообщений: 1,766
duzzy has a reputation beyond reputeduzzy has a reputation beyond reputeduzzy has a reputation beyond reputeduzzy has a reputation beyond reputeduzzy has a reputation beyond reputeduzzy has a reputation beyond reputeduzzy has a reputation beyond reputeduzzy has a reputation beyond reputeduzzy has a reputation beyond repute
По умолчанию

Не помню выкладывал или нет скрипт смены языка клавиатуры.
Возможно кому то будет полезен.
Работает в режиме тогла, т.е. переключает с языка на язык при старте.
Скрипт не мой нашел на просторах сети

PHP код:
#NoTrayIcon

Global $Rus '00000419' Раскладка русского языка
Global $Eng '00000409' Раскладка английского языка

$hWnd 
WinGetHandle('''')

If 
_WinAPI_GetKeyboardLayout($hWnd) = $Rus Then
    _WinAPI_SetKeyboardLayout
($Eng$hWnd)
ElseIf 
_WinAPI_GetKeyboardLayout($hWnd) = $Eng Then
    _WinAPI_SetKeyboardLayout
($Rus$hWnd)
EndIf


Func _WinAPI_GetKeyboardLayout($hWnd)
    
Local $Ret DllCall('user32.dll''long''GetWindowThreadProcessId''hwnd'$hWnd'ptr'0)
    If (@
error) Or ($Ret[0] = 0Then
        
Return SetError(100)
    EndIf
    
$Ret DllCall('user32.dll''long''GetKeyboardLayout''long'$Ret[0])
    If (@
error) Or ($Ret[0] = 0Then
        
Return SetError(100)
    EndIf
    Return 
'0000' Hex($Ret[0], 4)
EndFunc   ;==>_WinAPI_GetKeyboardLayout

Func _WinAPI_SetKeyboardLayout
($sLayout$hWnd)
    If 
Not WinExists($hWndThen
        
Return SetError(100)
    EndIf
    
Local $Ret DllCall('user32.dll''long''LoadKeyboardLayout''str'StringFormat('%08s'StringStripWS($sLayout8)), 'int'0)
    If (@
error) Or ($Ret[0] = 0Then
        
Return SetError(100)
    EndIf
    
DllCall('user32.dll''ptr''SendMessage''hwnd'$hWnd'int'0x0050'int'1'int'$Ret[0])
    Return 
SetError(001)
EndFunc   ;==>_WinAPI_SetKeyboardLayout 
duzzy вне форума   Ответить с цитированием