diff --git a/README.md b/README.md index 9ddffc7..f10fd48 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,23 @@ This small windowless program allow you swich keyboard layout with CapsLock key. While non-standard keyboard layout will bright Scroll Lock indicator. Usual Caps Lock function available via Shift + CapsLock key combination. I recommend set "To turn off Caps Lock -- SHIFT key" in Windows Advanced Key Settings. -Forked from [here](http://flydom.ru/capslang) +Fixed switching layouts in programs running on behalf of the administrator, +**to do this, run the program as an administrator.** + +Исправлено переключение раскладок в программах, запущенных от имени администратора, +**для этого запустите программу от имени администратора.** + +_Binaries compiled using mingw g++compiler_ + + +## Download +#### Toggles the standard layout ALT+SHIFT +#### Переключает стандартную раскладку ALT+SHIFT + +Download [mingw-caps-min.exe](https://github.com/steelswing/capslang/releases/download/2.0/mingw-caps-min.exe)\ +Download [mingw-capslang.exe](https://github.com/steelswing/capslang/releases/download/2.0/mingw-capslang.exe) + +Forked from [here](https://github.com/edanko/capslang) ## Complation You can compile it using Visual Studio or [lccwin32](https://lcc-win32.services.net/) @@ -13,7 +29,7 @@ Project file for lccwin32 included Copy caps-min.exe to your Startup (%AppData%\Microsoft\Windows\Start Menu\Programs\Startup) folder. ## Run -Just run caps-min.exe and enjoy +Just run mingw-caps-min.exe and enjoy ## Exit To close programm press Ctrl + Alt + L diff --git a/caps-min.c b/caps-min.c index 7e46454..1122e03 100644 --- a/caps-min.c +++ b/caps-min.c @@ -1,6 +1,10 @@ /* CapsLang by Ryurik 2003-11-12, updated 2006-10-24 - + + 11-04-2023 + Updated by LWJGL2 for correct work at startup from the administrator. + Updated by LWJGL2 для корректной работы при запуске от администратора. + This small windowless program allow you swich keyboard layout with CapsLock key. While non-standard keyboard layout will bright Scroll Lock indicator @@ -21,6 +25,7 @@ #include #include +#include #define WH_KEYBOARD_LL 13 typedef struct tagKBDLLHOOKSTRUCT { @@ -63,9 +68,11 @@ LRESULT CALLBACK KbdHook(int nCode,WPARAM wParam,LPARAM lParam) { if (wParam==WM_KEYDOWN) { HWND hWnd=GetCaretWindow(); if (hWnd) { - PostMessage(hWnd,WM_INPUTLANGCHANGEREQUEST,0,(LPARAM)HKL_NEXT); -// PostMessage(hWnd,WM_INPUTLANGCHANGEREQUEST,(WPARAM)INPUTLANGCHANGE_FORWARD,0); -// PostMessage(hWnd,WM_INPUTLANGCHANGEREQUEST,(WPARAM)INPUTLANGCHANGE_FORWARD,(LPARAM)HKL_NEXT); + // ALT + SHIFT для переключения + keybd_event(VK_MENU, 0, 0, 0); + keybd_event(VK_SHIFT, 0, 0, 0); + keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); + keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); return TRUE; } } diff --git a/capslang.c b/capslang.c index 860d0b0..f3d4bc3 100644 --- a/capslang.c +++ b/capslang.c @@ -1,5 +1,9 @@ /* CapsLang by Ryurik 2003-11-12, updated 2006-10-24 + + 11-04-2023 + Updated by LWJGL2 for correct work at startup from the administrator. + Updated by LWJGL2 для корректной работы при запуске от администратора. This small windowless program allow you swich keyboard layout with CapsLock key. While non-standard keyboard layout will bright Scroll Lock indicator @@ -21,6 +25,7 @@ #include #include +#include #define WH_KEYBOARD_LL 13 typedef struct tagKBDLLHOOKSTRUCT { @@ -56,7 +61,11 @@ LRESULT CALLBACK KbdHook(int nCode,WPARAM wParam,LPARAM lParam) { if (wParam==WM_KEYDOWN) { HWND hWnd=GetFocusWindow(); if (hWnd) { - PostMessage(hWnd,WM_INPUTLANGCHANGEREQUEST,0,(LPARAM)HKL_NEXT); + // ALT + SHIFT для переключения + keybd_event(VK_MENU, 0, 0, 0); + keybd_event(VK_SHIFT, 0, 0, 0); + keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); + keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); ToggleLight(); return TRUE; }