OH NO!S!1 I'll have a look when I get a chance. Most of my "bugfixes" have just been hacks on existing code, so I'll take the time to rewrite it in the next few days.
Oh, I'm really sorry to bother you, but it's definitely unreal to run MSVC++ on my p1-166. There's no need to rewrite, just several fixes.
There are definitely better/easier ways to do it. Posting messages to the main foobar window is pretty dodgy.
Then let's take away all those hooks!
patch can be as following, although I can't check it
*** foo_lirc.cpp.old Tue Jun 29 15:40:42 2004
--- foo_lirc.cpp Tue Aug 03 23:55:22 2004
***************
*** 32,38 ****
bool config_mode;
HWND hConfigWindow;
HWND hMainWindow;
- HHOOK lirc_hook;
static HWND status_wnd;
--- 32,37 ----
***************
*** 129,135 ****
}
else
{
! SendMessage(hMainWindow, WM_REMOTE_KEY, 0xDEAD, 0xFEED);
}
}
}
--- 128,134 ----
}
else
{
! g_actions.process_keypress(lirc.key_name);
}
}
}
***************
*** 331,348 ****
static cfg_action g_actions("Assigned actions");
- LRESULT CALLBACK LircHook(int nCode, WPARAM wp, LPARAM lp)
- {
- PCWPSTRUCT msg;
- msg = (PCWPSTRUCT)lp;
-
- if (nCode == HC_ACTION && msg->message == WM_REMOTE_KEY &&
- msg->wParam == 0xDEAD && msg->lParam == 0xFEED)
- {
- g_actions.process_keypress(lirc.key_name);
- }
- return CallNextHookEx(lirc_hook, nCode, wp, lp);
- }
bool StartLircClient()
{
--- 330,335 ----
***************
*** 355,366 ****
return false;
}
- lirc_hook = SetWindowsHookEx(WH_CALLWNDPROC, LircHook, NULL, GetCurrentThreadId());
- if(lirc_hook == NULL) {
- MessageBox(hMainWindow, "Failed to set Hook", szAppName, MB_OK);
- return false;
- }
-
lirc.thread_id = _beginthread(LircClient, 0, &lirc.socket);
if(lirc.thread_id == -1) {
MessageBox(NULL, "Failed to create thread, foo_lirc will be disabled.", szAppName, MB_OK);
--- 342,347 ----
***************
*** 371,377 ****
void StopLircClient()
{
- UnhookWindowsHookEx(lirc_hook);
lirc.client_running = false;
}
--- 352,357 ----