[Win] Sửa lỗi phím tắt không hoạt động sau khi mở khóa màn hình#317
Open
uponatime2019 wants to merge 2 commits intotuyenvm:masterfrom
Open
[Win] Sửa lỗi phím tắt không hoạt động sau khi mở khóa màn hình#317uponatime2019 wants to merge 2 commits intotuyenvm:masterfrom
uponatime2019 wants to merge 2 commits intotuyenvm:masterfrom
Conversation
Vấn đề: Sau khi unlock màn hình, các phím tắt (Ctrl+Shift+Z, v.v.) không hoạt động nữa. Nguyên nhân: Khi Windows unlock, các keyboard hooks có thể bị invalidate, và biến _lastFlag vẫn giữ giá trị modifier key cũ, gây ra checkHotKey() fail. Giải pháp: 1. Thêm wtsapi32.h và wtsapi32.lib 2. Đăng ký WTS session change notification 3. Khi unlock (WTS_SESSION_UNLOCK), reinitialize hooks 4. Reset _flag, _lastFlag, _keycode, _isFlagKey về 0 Thay đổi files: - stdafx.h: Thêm #include <wtsapi32.h> - OpenKey.vcxproj: Thêm wtsapi32.lib dependency - SystemTrayHelper.cpp: Thêm WM_WTSSESSION_CHANGE handler - OpenKey.cpp: Thêm OpenKeyReinitHooks() reset modifier state - OpenKeyManager.h/.cpp: Thêm reinitHooks() method Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Vấn đề: Keyboard shortcuts và gõ Tiếng Việt randomly bị stuck, nhưng click icon system tray vẫn toggle được EN/VI được. Nguyên nhân: Keyboard hooks bị Windows remove/invalidate, khiến không nhận được keyboard events. Giải pháp: Thêm timer 10s để tự động reinitialize hooks, giống như khi lock/unlock màn hình.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vấn đề: Sau khi unlock màn hình, các phím tắt (Ctrl+Shift+Z, v.v.) không hoạt động nữa.
Nguyên nhân: Khi Windows unlock, các keyboard hooks có thể bị invalidate, và biến _lastFlag vẫn giữ giá trị modifier key cũ, gây ra checkHotKey() fail.
Giải pháp:
Thay đổi files:
Author: Glm 🤪 | đã test, lỗi phím tắt EN/VI sau khi lock screen đã được fix ✅