The dwID argument does not appear to be documented correctly. If I select some text and right-click, dwID comes in as 0x04, which is the value of CONTEXT_MENU_TEXTSELECT documented in mshtmhst.h. However, this documentation says the value should be 0x10 which is incorrect.
Edit: The docs above have now been fixed.