Home > Software engineering >  MFC dialog based engineering how to add a dockable floating window?
MFC dialog based engineering how to add a dockable floating window?

Time:11-03




As shown in figure, I want to be in based on the MFC dialog box is a slick implementation of a floating window can be docked, the implementation situation now is: in the main dialog call derived from CFrameWndEx MainFrame class and create, and then the main dialog box, MainFrame, at the same time

At this time should be the main dialog to hide or stick the MainFrame to the main dialog box? Could you tell me how to do this? For dialog also do other controls such as operation,
And close this program will be submitted to the many wrong, what should I do?
 
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ dlgcore CPP (136) : AppMsg - Warning: calling DestroyWindow in CDialog: : ~ CDialog --
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ dlgcore CPP (137) : AppMsg - OnDestroy or PostNcDestroy in derived class will not be called.
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ wincore CPP (815) : AppMsg - Warning: calling DestroyWindow in CWnd: : ~ CWnd. OnDestroy or PostNcDestroy in derived class will not be called.
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ wincore CPP (815) : AppMsg - Warning: calling DestroyWindow in CWnd: : ~ CWnd. OnDestroy or PostNcDestroy in derived class will not be called.
0 x10340f6c (mfc120ud. DLL) (DOCKDLG_DLG. Exe) at the first opportunity to exception: 0 xc0000005: while reading position 0 x00000001 access conflict,
0 x10340f6c (mfc120ud. DLL) (DOCKDLG_DLG. Exe) in untreated exception: 0 xc000041d: users encountered during callback without exception, processing,

 
HEAP [DOCKDLG_DLG. Exe] : Invalid address specified to RtlValidateHeap (011 f0000, 0104 efd8)
DOCKDLG_DLG. Exe has triggered a breakpoint,

The Debug an Assertion Failed!

Program: D: \ priject \ DOCKDLG_DLG \ Debug \ DOCKDLG_DLG exe
File: f: \ dd \ vctools \ CRT \ crtw32 \ misc \ dbgheap c
The Line: 1322

Expression: _CrtIsValidHeapPointer (pUserData)

For information on how your program can cause an an assertion
Failure, see the Visual c + + documentation on asserts.

(Press Retry to debug the application)
Detected the memory leaks!
Dumping objects - & gt;
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ afxvisualmanagerwindows CPP (35) : {266} client block at 0 x01212eb0, subtype c0, 348 bytes long.
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ dumpcont CPP (23) : atlTraceGeneral -a CMFCVisualManagerWindows object eb0 at $01212, 348 bytes long
D: \ priject \ dockdlg_dlg \ dockdlg_dlg \ dockdlg_dlg CPP (59) : {166} client block at 0 x011f6138, subtype c0, 12 bytes long.
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ dumpcont CPP (23) : atlTraceGeneral - a CObject object f6138 at $011, 12 bytes long
{165} client block at 0 x01207840, subtype c0, 204 bytes long.
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ dumpcont CPP (23) : atlTraceGeneral - a CObject object at $01207840, 204 bytes long
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ strcore CPP (156) : {159} normal block at 0 x01207610, 90 bytes long.
Data: & lt; $$& gt; A0 D7 B4 24 24 00 00 00 00 00 00 0 f 01 00 00 00
The Object dump complete.



Bosses implemented this feature? Can you give a source under study?


https://bbs.csdn.net/topics/398058778
This is my last post, reply, so also open a new post

CodePudding user response:

Or I would have this kind of want to based on the dialog box to add floating window can be wrong?

CodePudding user response:

The parent window is CMyframe dialog box, the size is smaller than the dialog box!

CodePudding user response:

refer to the second floor schlafenhamster response:
is the parent window in the CMyframe dialog box, the size than the dialog box!


 
if (! M_mainFrame. Create (NULL, _T (" TEST "), WS_OVERLAPPEDWINDOW, CRect (0, 0, 100, 100)))
{
TRACE0 (" failed to create output window/n ");
return FALSE;
}

Could you tell me the CMyframe Create how to Create a child window?

CodePudding user response:

M_pMyFrame=new CFrameWnd;
M_pMyFrame - & gt; Create (0, "", WS_CHILD, rc, this);

CodePudding user response:

reference 4 floor schlafenhamster response:
m_pMyFrame=new CFrameWnd;
M_pMyFrame - & gt; Create (0, "", WS_CHILD, rc, this);


 
CRect rectDlg;
GetClientRect (rectDlg);
MainFrame * m_pMyFrame=new MainFrame;
M_pMyFrame - & gt; Create (0, _T (" "), WS_CHILD, rectDlg, this);
M_pMyFrame - & gt; ShowWindow (SW_SHOW);


After I such a success


But when I drag a window when the second program interrupt (drag, double-click on the dock, drag again, to stop this normal; Only drag then drag once again interrupted), bosses look


Then the debugging information is
 
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ objcore CPP (76) : AppMsg - ASSERT_VALID fails with a NULL pointer.
The Debug an Assertion Failed!

Program: C: \ WINDOWS \ SYSTEM32 \ mfc120ud DLL
File: f: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ afxpane CPP
The Line: 129

For information on how your program can cause an an assertion
Failure, see the Visual c + + documentation on asserts.

(Press Retry to debug the application)
Detected the memory leaks!
Dumping objects - & gt;
F: \ dd \ vctools \ vc7libs \ ship \ atlmfc \ SRC \ MFC \ afxdragframeimpl CPP (122) : {663} client block at 0 x012bd408, subtype c0, 848 bytes long.
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related