Цитата m0nkrus:
язык ввода для активного окна »
|
код батника, который компилирует требуемый EXE (требуется .NET):
Код:
@if not exist "%~n0.exe" (
for /f "delims=" %%a in ('dir/s/a-d/b/od "%windir%\Microsoft.NET\Framework\vbc.exe"') do @set "vbc=%%a"
(echo Imports System.Runtime.InteropServices
echo Module Test
echo ^<DllImport^("user32.dll",SetLastError:=True^)^> Public Function GetForegroundWindow^(^) As IntPtr
echo End Function
echo ^<DllImport^("user32.dll",SetLastError:=True^)^> Public Function GetWindowThreadProcessId^(ByVal hwnd As IntPtr,ByRef lpdwProcessId As Integer^) As Integer
echo End Function
echo Public Declare Function GetKeyboardLayout Lib "user32" ^(ByVal idThread As UInteger^) As IntPtr
echo Sub Main^(^)
echo Console.WriteLine^(GetKeyboardLayout^(GetWindowThreadProcessId^(GetForegroundWindow^(^),0^)^).ToString^("X"^)^)
echo End Sub
echo End Module)>"%~n0.tmp"
call "%%vbc%%" "%~n0.tmp" /out:"%~n0.exe">nul
del "%~n0.tmp")
P.S. проверено на XP/2003