1

I'm attempting to use CMFCCmdUsageCounter to track command usage in my program. This class requires I call AddCmd(ID_COMMAND); every time the ID_COMMAND is handled/sent.

Since my program has thousands of ID_COMMAND's, which are handled throughout millions of lines of code...This seems unfeasible.

I'm hoping there is some simple way to intercept ALL commands sent within my program. Is it possible to override the SendMessage()/PostMessage() functions?(not even sure this would get all commands) Maybe there is some MFC function that passes every command through my virtual function, before passing it on like normal.

I'm sorry my understanding of MFC/AFX messages is limited. Any help in attempting to track ID_COMMAND usage is welcome.

diox8tony
  • 348
  • 3
  • 13

1 Answers1

1

Take a look at SetWidowsHookEx. In particular, I would start with the WH_GETMESSAGE type hook. A combination of hooks may give you what you need.

rrirower
  • 4,338
  • 4
  • 27
  • 45