多文档结构的工程 我在class CFtuDoc : public CDocument中建 了
一个文本打开的函数
现在想 在打开文本后发送一个消息给
class CChildFrame : public CMDIChildWnd CWnd * pParent
if(pParent != NULL )
::SendMessage(pParent->m_hWnd, MYWM_DISPLAYFTUVIEW, 0, 0);
SendMessage(NULL, MYWM_DISPLAYFTUVIEW, 0, 0);请问我要怎么样才能得出 CChildFrame 的句柄呢,
请大虾帮忙,在线等ing;
一个文本打开的函数
现在想 在打开文本后发送一个消息给
class CChildFrame : public CMDIChildWnd CWnd * pParent
if(pParent != NULL )
::SendMessage(pParent->m_hWnd, MYWM_DISPLAYFTUVIEW, 0, 0);
SendMessage(NULL, MYWM_DISPLAYFTUVIEW, 0, 0);请问我要怎么样才能得出 CChildFrame 的句柄呢,
请大虾帮忙,在线等ing;
CMainFrame *pMainFrame = pApp->GetMainFrame();
CChileFrame *pChildFrame = pMainFrame->GetActiveFrame();
OK!!
error C2039: 'GetMainFrame' : is not a member of 'CWinApp'再想想帮帮忙
CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd()
CMainFrame *pMainFrame = (CMainFrame *)AfxGetMainWnd();
CChileFrame *pChildFrame = pMainFrame->GetActiveFrame();
CChileFrame *pChildFrame = pMainFrame->GetActiveFrame();
MFC中用CWnd::GetDlgItem()取窗口句柄即可。
下述代码在你的App类的GetYourFrm(CMDIChildWnd* ),返回值PosFrm 为你的窗口类型指针
{
CMainFrame* PosFrmMain = (CMainFrame*)AfxGetMainWnd();
CString strTitle;
int i = 0;
PosFrm = PosFrmMain->MDIGetActive(NULL);
while(PosFrm!=NULL)
{
PosFrm->GetWindowText(strTitle);
if(strTitle=="你的文档窗口名")//用模糊的判断也比较好
return;
PosFrmMain->MDINext();
PosFrm = PosFrmMain->MDIGetActive(NULL);
i++;
if(i>你的文档窗口数)break;
}
}
就可以给他发消息了。
:)
!=NULL哦
祝你成功!