Food for thought....

When you get on to building more complex applications with context menus, you'll want to handle WM_CONTEXTMENU rather than WM_RBUTTONDOWN.

The reason is you can display a context menu with the SHIFT + F10 keyboard command. If you only handle a WM_RBUTTONDOWN, the context menu can't be invoked from the keyboard.

If you use WM_CONTEXTMENU, it will work for the right mouse click and keyboard.