ReactOS 0.4.15-dev-8145-ga541a46
kbsdll.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Keyboard Layout Switcher
3 * FILE: base/applications/kbswitch/kbsdll/kbsdll.c
4 * PROGRAMMER: Dmitry Chapyshev <dmitry@reactos.org>
5 *
6 */
7
8#include "../kbswitch.h"
9
10HHOOK hWinHook = NULL;
14
15static VOID
17{
19}
20
23{
24 if (code < 0)
25 {
27 }
28
29 switch (code)
30 {
31 case HCBT_SETFOCUS:
32 {
33 HWND hwndFocus = (HWND)wParam;
34 if (hwndFocus && hwndFocus != hKbSwitchWnd)
35 {
37 }
38 }
39 break;
40 }
41
43}
44
47{
48 if (code < 0)
49 {
51 }
52
53 switch (code)
54 {
55 case HSHELL_LANGUAGE:
56 {
58 }
59 break;
60 }
61
63}
64
67{
70
71 if (!hWinHook || !hShellHook)
72 {
73 return FALSE;
74 }
75
76 return TRUE;
77}
78
81{
82 if (hWinHook)
83 {
85 hWinHook = NULL;
86 }
87 if (hShellHook)
88 {
91 }
92}
93
98{
99 switch (dwReason)
100 {
102 {
103 hInstance = hinstDLL;
105 if (!hKbSwitchWnd)
106 {
107 return FALSE;
108 }
109 }
110 break;
111 }
112
113 return TRUE;
114}
DWORD dwReason
Definition: misc.cpp:154
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1638 Msg[]
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
HANDLE HWND
Definition: compat.h:19
#define CALLBACK
Definition: compat.h:35
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT CALLBACK ShellHookProc(int code, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:46
HHOOK hShellHook
Definition: kbsdll.c:11
HINSTANCE hInstance
Definition: kbsdll.c:12
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: kbsdll.c:95
LRESULT CALLBACK WinHookProc(int code, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:22
static VOID PostMessageToMainWnd(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:16
HWND hKbSwitchWnd
Definition: kbsdll.c:13
HHOOK hWinHook
Definition: kbsdll.c:10
PKBSWITCHSETHOOKS KbSwitchSetHooks
Definition: kbswitch.c:32
PKBSWITCHDELETEHOOKS KbSwitchDeleteHooks
Definition: kbswitch.c:33
#define WM_WINDOW_ACTIVATE
Definition: kbswitch.h:24
TCHAR szKbSwitcherName[]
Definition: kbswitch.h:29
#define WM_LANG_CHANGED
Definition: kbswitch.h:23
static IN DWORD IN LPVOID lpvReserved
unsigned int UINT
Definition: ndis.h:50
Definition: inflate.c:139
#define IN
Definition: typedefs.h:39
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define FindWindow
Definition: winuser.h:5777
#define WH_SHELL
Definition: winuser.h:40
#define WH_CBT
Definition: winuser.h:35
#define SetWindowsHookEx
Definition: winuser.h:5856
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define HCBT_SETFOCUS
Definition: winuser.h:64
#define PostMessage
Definition: winuser.h:5832
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)