replacement for CDC::GetSafeHdc()

  • MarkD

    MarkD - 2009-01-04

    I need a method to replace the MFC CDC::GetSafeHdc() method used in existing code given CDC*?

    • David

      David - 2009-01-05

      Thanks for your comment. I'll add a GetDC method to CDC for the next version of Win32++.

      In the meantime, to get the HDC from a CDC you can use:
      HDC SomeHDC = MyDC;   // Where MyDC is a CDC object.

      This works because of operator overloading.
      If instead you have a pointer to a CDC object, you can dereference it.

      HDC SomeHDC = *pMyDC; // where pMyDC is a CDC pointer



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks