I'm looking for a way to intercept a GetMessage() call for WM_CHAR in an external process (only the active window, to be specific). I'm hesitant to use SetWindowsHookEx() - I want to make absolutely sure that the widest possible range of programs which may modify keyboard input have a chance to fire first. Does anyone have any suggestions?
Context: I'm building an application meant to generate a visual of the current keyboard layout. However, I'm looking to make it as compatible with third-party keyboard remapping software as possible (including user-made AutoHotkey scripts and the like). When triggered via hotkey, my program sends key-presses to the active window (scancodes + appropriate virtual keys), which should get processed by its window procedure... thus triggering both any remap software based on system-wide hooks and that which has been programmed to only remap keys within the active application... and then my program would intercept the resulting WM_CHAR / WM_UNICHAR / WM_DEADCHAR message, from which it reconstructs the keyboard layout. In effect, the character messages should never reach the active window for output. (I might replace them with no char messages of some kind for compatibility.)
P.S. Sorry, this is probably terrible etiquette - posting a question first thing after registering - but I've been researching this issue for many nights now, and I still haven't figured out an optimum solution! I'm working primarily from AutoHotkey, and I'm fully willing to share other methods I've considered for getting the true current keyboard layout, but they all have their limitations re: playing nice with remapping software.