CCreateContext context;
context.m_pNewViewClass=RUNTIME_CLASS( CMotionGalilView ); //类型是 CRuntimeClass*
context.m_pCurrentDoc=new CMotionScanPrjDoc();//CFrameWnd* ChildF;ChildF=new CFrameWnd();
context.m_pCurrentFrame = ChildF;ChildF->Create(NULL,"",WS_OVERLAPPEDWINDOW| WS_POPUPWINDOW,
rectDefault ,this,NULL,NULL,&context);通过这种方式创建的子窗体怎么接受到父窗体的自定义消息?试了各种方式,除了这种方式创建的窗体,别的方式就能响应父窗体分发的消息。我是在父窗体中通过SendMessageToDescendants 想子窗体传递的消息。MFCVC++
context.m_pNewViewClass=RUNTIME_CLASS( CMotionGalilView ); //类型是 CRuntimeClass*
context.m_pCurrentDoc=new CMotionScanPrjDoc();//CFrameWnd* ChildF;ChildF=new CFrameWnd();
context.m_pCurrentFrame = ChildF;ChildF->Create(NULL,"",WS_OVERLAPPEDWINDOW| WS_POPUPWINDOW,
rectDefault ,this,NULL,NULL,&context);通过这种方式创建的子窗体怎么接受到父窗体的自定义消息?试了各种方式,除了这种方式创建的窗体,别的方式就能响应父窗体分发的消息。我是在父窗体中通过SendMessageToDescendants 想子窗体传递的消息。MFCVC++
UINT gaFlags
);
Parametershwnd
[in] Handle to the window whose ancestor is to be retrieved. If this parameter is the desktop window, the function returns NULL.
gaFlags
[in] Specifies the ancestor to be retrieved. This parameter can be one of the following values.
GA_PARENT
Retrieves the parent window. This does not include the owner, as it does with the GetParent function.
GA_ROOT
Retrieves the root window by walking the chain of parent windows.
GA_ROOTOWNER
Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.
Return ValueThe return value is the handle to the ancestor window.
指明了WS_CHILD属性后,同样不响应消息,当然按照MSDN上的说明去掉了 WS_POPUPWINDOW 属性。
而且我在子窗体中通过GetParent->PostMessage 父窗体的PreTranslateMessage 能接收到
指明了WS_CHILD属性后,同样不响应消息,当然按照MSDN上的说明去掉了 WS_POPUPWINDOW 属性。
而且我在子窗体中通过GetParent->PostMessage 父窗体的PreTranslateMessage 能接收到
在子窗体中GetParent()->PostMessage();