ReactOS  0.4.12-dev-14-gd0c8636
kbsdll.c File Reference
#include "../kbswitch.h"
Include dependency graph for kbsdll.c:

Go to the source code of this file.

Functions

static VOID SendMessageToMainWnd (UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK WinHookProc (int code, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK ShellHookProc (int code, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI KbSwitchSetHooks (VOID)
 
VOID WINAPI KbSwitchDeleteHooks (VOID)
 
BOOL WINAPI DllMain (IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
 

Variables

HHOOK hWinHook = NULL
 
HHOOK hShellHook = NULL
 
HINSTANCE hInstance = NULL
 
HWND hKbSwitchWnd = NULL
 

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( IN HINSTANCE  hinstDLL,
IN DWORD  dwReason,
IN LPVOID  lpvReserved 
)

Definition at line 83 of file kbsdll.c.

Referenced by iso2022jp_flush(), and xmlCleanupThreads().

86 {
87  switch (dwReason)
88  {
89  case DLL_PROCESS_ATTACH:
90  {
91  hInstance = hinstDLL;
93  if (!hKbSwitchWnd)
94  {
95  return FALSE;
96  }
97  }
98  break;
99  }
100 
101  return TRUE;
102 }
HWND hKbSwitchWnd
Definition: kbsdll.c:13
HINSTANCE hInstance
Definition: kbsdll.c:12
#define TRUE
Definition: types.h:120
#define FindWindow
Definition: winuser.h:5643
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
DWORD dwReason
Definition: misc.cpp:154
smooth NULL
Definition: ftsmooth.c:416
TCHAR szKbSwitcherName[]
Definition: kbswitch.h:30

◆ KbSwitchDeleteHooks()

VOID WINAPI KbSwitchDeleteHooks ( VOID  )

Definition at line 76 of file kbsdll.c.

77 {
80 }
HHOOK hShellHook
Definition: kbsdll.c:11
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
HHOOK hWinHook
Definition: kbsdll.c:10

◆ KbSwitchSetHooks()

BOOL WINAPI KbSwitchSetHooks ( VOID  )

Definition at line 62 of file kbsdll.c.

63 {
66 
67  if (!hWinHook || !hShellHook)
68  {
69  return FALSE;
70  }
71 
72  return TRUE;
73 }
HINSTANCE hInstance
Definition: kbsdll.c:12
#define TRUE
Definition: types.h:120
#define WH_SHELL
Definition: winuser.h:40
LRESULT CALLBACK WinHookProc(int code, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:22
HHOOK hShellHook
Definition: kbsdll.c:11
#define WH_CBT
Definition: winuser.h:35
#define SetWindowsHookEx
Definition: winuser.h:5722
HHOOK hWinHook
Definition: kbsdll.c:10
LRESULT CALLBACK ShellHookProc(int code, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:47

◆ SendMessageToMainWnd()

static VOID SendMessageToMainWnd ( UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 16 of file kbsdll.c.

Referenced by ShellHookProc(), and WinHookProc().

17 {
19 }
HWND hKbSwitchWnd
Definition: kbsdll.c:13
WPARAM wParam
Definition: combotst.c:138
struct @1571 Msg[]
#define PostMessage
Definition: winuser.h:5698
LPARAM lParam
Definition: combotst.c:139

◆ ShellHookProc()

LRESULT CALLBACK ShellHookProc ( int  code,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 47 of file kbsdll.c.

Referenced by KbSwitchSetHooks().

48 {
49  switch (code)
50  {
51  case HSHELL_LANGUAGE:
52  {
54  }
55  break;
56  }
57 
59 }
WPARAM wParam
Definition: combotst.c:138
HHOOK hShellHook
Definition: kbsdll.c:11
#define WM_LANG_CHANGED
Definition: kbswitch.h:23
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
static VOID SendMessageToMainWnd(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:16
LPARAM lParam
Definition: combotst.c:139

◆ WinHookProc()

LRESULT CALLBACK WinHookProc ( int  code,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 22 of file kbsdll.c.

Referenced by KbSwitchSetHooks().

23 {
24  int id = GlobalAddAtom(_T("KBSWITCH"));
25 
26  switch (code)
27  {
28  case HCBT_SETFOCUS:
29  {
30  if ((HWND)wParam != NULL)
31  {
32  if ((HWND)wParam != hKbSwitchWnd)
33  {
35  }
36  }
37  }
38  break;
39  }
40 
41  GlobalDeleteAtom(id);
42 
44 }
HWND hKbSwitchWnd
Definition: kbsdll.c:13
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
#define HCBT_SETFOCUS
Definition: winuser.h:64
#define GlobalAddAtom
Definition: winbase.h:3672
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
#define _T(x)
Definition: vfdio.h:22
#define WM_WINDOW_ACTIVATE
Definition: kbswitch.h:24
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
HHOOK hWinHook
Definition: kbsdll.c:10
static VOID SendMessageToMainWnd(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:16
LPARAM lParam
Definition: combotst.c:139

Variable Documentation

◆ hInstance

HINSTANCE hInstance = NULL

Definition at line 12 of file kbsdll.c.

◆ hKbSwitchWnd

HWND hKbSwitchWnd = NULL

Definition at line 13 of file kbsdll.c.

◆ hShellHook

HHOOK hShellHook = NULL

Definition at line 11 of file kbsdll.c.

Referenced by KbSwitchDeleteHooks(), KbSwitchSetHooks(), and ShellHookProc().

◆ hWinHook

HHOOK hWinHook = NULL

Definition at line 10 of file kbsdll.c.

Referenced by KbSwitchDeleteHooks(), KbSwitchSetHooks(), and WinHookProc().