Since these two are extremely different from one another, how do you balance effective cleanup of GDI objects and effective cleanup of the C++ object using the GDI object?

Destructor cleanup does not always work since if you call certain GDI functions when the object no longer exists (or is not an HWND) and/or cleanup GDI objects pre-maturely you get major issues (calling delete on a bitmap object when it is still selected into a device context).

I'm having major problems with this.

Suggestions?