获得对象句柄、对象指针的函数

1、CWnd::GetSafeHwnd()返回窗口的句柄。函数原型:

HWND GetSafeHwnd( ) const;
      CDC::GetSafeHdc()返回DC的句柄。函数原型:

HDC GetSafeHdc( ) const;
      CGdiObject::GetSafeHandle()返回GDI对象(位图、画刷、画笔、字体、调色板等)的句柄。函数原型:

HGDIOBJ GetSafeHandle( ) const;
2、 CWnd::FromHandle()返回指向窗口的指针。函数原型:

static CWnd* PASCAL FromHandle(HWND hWnd);
      CDC::FromHandle()返回指向DC的指针。函数原型:

static CDC* PASCAL FromHandle(HDC hDC);
      CGdiObject::FromHandle()返回指向GDI对象的指针。函数原型:

static CGdiObject* PASCAL FromHandle( HGDIOBJ hObject);

你可能感兴趣的:(MFC)