ynon
ynon

Reputation: 11

Difference between message map and overriding windowproc

I whould like to ask, when i'm programming in MFC, what is the difference between message map, and overriding windowproc? In which cases I have to override windowproc?

For example, when do I have to use the message ON_WM_CHAR, and when do i have to override windowproc and catch the case of WM_CHAR?

Thanks

Upvotes: 1

Views: 992

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490348

For most practical purposes you'd always use ON_WM_CHAR rather than overriding its window proc.

You'd override its window proc primarily when you need to change the fundamental behavior of the message loop -- but that's quite rare (the only instances I can think of right off are some things like animated games, that need to execute code on a regular basis, so you modify the main loop to include (a call to) some screen-update code.

Upvotes: 4

Related Questions