For your first question, please see my comment to the question; see also:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd144871%28v=vs.85%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633504%28v=vs.85%29.aspx[
^].
Don't use MFC at this point. See the comment to the question by cariolihome: you can use scope operator '::', to indicate the use of the
global namespace:
http://www.cplusplus.com/doc/tutorial/operators[
^],
http://msdn.microsoft.com/en-us/library/5cb46ksf.aspx[
^],
http://www.cplusplus.com/doc/tutorial/namespaces[
^].
With MFC, you should have the instance of some window, so you don't need a HWND argument; instead, the instance "this" is used:
http://msdn.microsoft.com/en-us/library/71eseab0.aspx[
^].
(Do you understand how instance function calls work? You do have one extra (only one in this case) argument "this", which is implicit. It is used to pass the instance of the type to the method. And than, the implementation "knows" the HWND of this objects and uses it in the call to the Windows API's GetDC(HWND)
I referenced above. Please see also my past answer: Catch 22 - Pointers to interface objects die when function using them is made static.[^].)As to your second question…
Probably, you don't mean C++, but C++/CLI you could use with in .NET in general,
System.Windows.Forms
in particular. If so, you can use some unmanaged code in such project, too. The usual way is to use P/Invoke, but, with C++/CLI, you don't have to do it; it makes everything much simpler. You can create a mixed-mode (managed + unmanaged) project where you can freely combine .NET and unmanaged code. However, I would advise to keep some discipline. Separate your project in at least 3 distinct parts or layers: pure .NET (managed) part, pure unmanaged part, and the layer where you wrap unmanaged types in managed "ref" classes. Please see:
http://en.wikipedia.org/wiki/C%2B%2B/CLI[
^],
http://www.ecma-international.org/publications/standards/Ecma-372.htm[
^],
http://www.gotw.ca/publications/C++CLIRationale.pdf[
^].
—SA