示例#1
0
void xMain() 
{
  MSG msg;

  g_hEvent = CreateEvent(NULL, TRUE, FALSE, _T("_53_kana_led"));
  if (g_hEvent == NULL)
    failed(_T("CreateEvent()"));

  if (GetLastError() == ERROR_ALREADY_EXISTS) 
  {
    failed(_T("kana_led is already running!"));
  }

  if (SetTimer(NULL, 0, 500, TimerCallback) == 0)
    failed(_T("SetTimer()"));

  g_hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHook, GetModuleHandle(0), 0);
  if (!g_hHook)
    failed(_T("SetWindowsHookEx()"));

  OpenKeyboardDevice();
  
  while (GetMessage(&msg, 0, 0, 0)) 
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }

  CloseKeyboardDevice();

  UnhookWindowsHookEx(g_hHook);
  CloseHandle(g_hEvent);
  ExitProcess(0);
}
示例#2
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);

	GetWindowsVersion();
	OpenKeyboardDevice();
	hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);

	return 0;
}
示例#3
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);
	mir_getCLI();

	GetWindowsVersion();
	OpenKeyboardDevice();

	HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreshutdown);
	return 0;
}