In a Visual Studio MFC app, I have the following function:
BOOL CSomeDialog::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
{
...
// Get the window handle ...
const HWND hControl = (HWND)pNMHDR->idFrom;
...
}
Visual Studio's code analysis reports:
Warning C26462 The value pointed to by 'hControl' is assigned only once, mark it as a pointer to const (con.4).
I do like code analysis to report on variables that can be consts (I think it clarifies the code's intent), however I don't understand why the above code generates this message. I suspect I am declaring a const pointer rather than a pointer to a const, but I'm unsure of the fix (I've tried "HWND const hControl").
Thanks.