正在阅读:实用!超强VC/MFC 常见问答收集实用!超强VC/MFC 常见问答收集

2004-07-15 10:04 出处:CSDN 作者:jiangsheng收集 责任编辑:linjixiong


{
  ESErrPrintProviderError(g_connection);
  ESErrPrintComError(e);
  return e.Error();
 }
 return S_OK;
}
STDMETHODIMP CEnumDataType::Clone(IEnumString** ppenum)
{
 if (!ppenum)
  return E_POINTER;
 
 CEnumDataType* pnew = new CEnumDataType(m_strDataType);
 pnew->AddRef();
 *ppenum = pnew;
 return S_OK;
}

 

  问:如何在MDI环境下枚举所有打开的窗口?
  答:
In MFC, each CMDIChildWnd created by the framework is managed as a child window of the MDIClient window. This MDIClient window is a child of the mainframe window and fills its client area. For MDI applications, the mainframe window is encapsulated by the CMDIFrameWnd class. This class has a public embedded HWND member (m_hWndMDIClient), which is the handle to the MDIClient window. For MDI applications, AppWizard derives the CMainFrame class from CMDIFrameWnd.

The MDIClient maintains an internal list of child windows. In an MFC application, these child windows are either a CMDIChildWnd object or an internal window used to display the title of an iconized window. Note that this is an internal list controlled by Windows; don't make assumptions about the ordering of children in the list after an API function is called.


//**mainfrm.h****************
class CMainFrame : public CMDIFrameWnd
{
...
public:
   CWnd  m_wndMDIClient;
   CWnd* m_pWndCurrentChild;
   CMDIChildWnd* GetNextMDIChildWnd();
   int GetCountCMDIChildWnds();
...
}

//**mainfrm.cpp**************
CMainFrame::CMainFrame():m_pWndCurrentChild(NULL)
{
  //.................
}

CMainFrame::~CMainFrame()

 


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:

键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品