Thank you very much. I know little C/C++ and tried. But failed. Could you please help more in details? Thank you in advance.
I tried to write a DLL like this, but The WndProc() never get be called. What is wrong?
// My DLL code:
extern DllExport int WINAPI HookMyWnd(HWND hWnd, HWND hNotify)
{
HINSTANCE hCurrInstance;
WNDCLASS cls;
hCurrInstance = (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE);
cls.hCursor = LoadCursor(NULL,IDC_ARROW);
cls.hIcon = NULL;
cls.lpszMenuName = NULL;
cls.lpszClassName = "Me";
cls.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
cls.hInstance = hCurrInstance;
cls.style = CS_DBLCLKS;
cls.lpfnWndProc = WndProc;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
if (!RegisterClass(&cls)) return FALSE;
// Keep notify window into my memory for notification
hNotifyWindow = hNotify;
return TRUE;
}
LONG FAR PASCAL WndProc(HWND hWnd, UINT Msg, WPARAM WP, LPARAM LP)
{
if(Msg == WM_LBUTTONDOWN)
{
MessageBox(NULL, "Mouse Clicked", "TEST", MB_OK);
SendMessage(hNotifyWindow, 123456, 0, 0);
}
return(DefWindowProc(hWnd, Msg, WP, LP));
}