How to statistic every button click in mfc using message loop mechanics?

50 Views Asked by At

I have a MFC application. I want to statistic every button click, including button ID and time. Can I do it in CWinApp::PreTranslateMessage(MSG* pMsg) or CWnd::PreTranslateMessage(MSG* pMsg)? And how?

1

There are 1 best solutions below

1
RonTLV On

For your own app catching WM_CHAR should do the job, but if you are looking to catch key strokes for the entire system a hook dll, using SetWindowsHookEx, is what you need.