calling GetDesktopWindow() function in winuser.h instead of CWnd::GetDesktopWindow() in an MFC OnButtonClick function

  c++, mfc, visual-c++, visual-studio

For my own education, I am playing around with the code snippets of some on-line examples.
Early in these examples, there are the lines …
HWND hDesktopWnd = GetDesktopWindow();
HDC hDesktopDC = GetDC(hDesktopWnd);
For convenience reasons, I added a new button to my dialog-based demo MFC project, and the code I expect to test gets written into the ::OnBnClickedRuntest() function. This was working well in the past, with various other code snippets I studied, modified, and tested this way. For these lines however, I get a E0144 compile-time error: a value of type "CWnd *" cannot be used to initialize an entity of type "HWND".

I figured that I run into some sort of name-matching/visibility issue. As I am hoping to call GetDesktopWindow() and GetDC() defined in winuser.h, but apparently the CWnd class also has methods with these exact same names and different return types.

Obviously, my test code being placed in the OnButtonClicked function of an MFC dialog, GetDesktopWindow() and GetDC() prefers to call for the CWnd::GetDesktopWindow() and CWnd::GetDC() methods instead of the intended winuser.h functions.

How do I clarify to the compiler that instead of the CWnd methods, I want to use the winuser.h functions of the same name?

Source: Windows Questions C++