DLL Dialog
-
Hi all, i like to made a Multidocument .exe where i have the mainframe window with a childwindow and as a second childwindow i like to load a .dll which creates its own dialog. So, how can i fit this upcoming dialog into the MainFrame window as nice as the other child window is fitted in it? I like to have the childwindow dialog at the left and the dll dialog on the right... Thanks, Mark
-
Hi all, i like to made a Multidocument .exe where i have the mainframe window with a childwindow and as a second childwindow i like to load a .dll which creates its own dialog. So, how can i fit this upcoming dialog into the MainFrame window as nice as the other child window is fitted in it? I like to have the childwindow dialog at the left and the dll dialog on the right... Thanks, Mark
I cannot give you a direct code implementation, but I will discuss shortly on how a MDI program handles it's child windows. First, we have the frame window, derived from CMDIFrameWnd. Then, you have a set of CMDIChildWnd objects placed in there. The main frame window is a MDI Frame. The child windows function similarly as a CFrameWnd does, except they rarely have toolbar of their own. So, when in SDI application, a Frame window has one view, then in MDI application, a frame window has many child frames, which each have their own views. Do you understand this ? Following this logic, the easiest way would be to create a CMDIChildWnd object in the DLL, and create a Form View to fill this window's view. This way, you would have two valid MDI child windows, from which the first would have a normal view and the other one a form view. I would follow this approach, because I am unsure how a modeless dialog works when it is a child of a MDI frame window. I have never tested it myself. But using the CMDIChildWnd->FormView approach would give valid, working results, as both child windows would then be CMDIChildWnd objects, and would have all the necessary implementation ready for functioning as MDI childs. When the windows are created, you must position them appropriately using
SetWindowPos
member of CMDIChildWnd. Just get the client rectangle of the parent frame (CMDIFrameWnd::GetClientRect), divide it to half X-wise, and use these values to determine the size and position of both windows. First window should be from (0, 0) -> (X / 2, Y) and the other from (X / 2, 0) -> (X, Y), where X and Y are the width and height of the client area, respectively. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible. -
I cannot give you a direct code implementation, but I will discuss shortly on how a MDI program handles it's child windows. First, we have the frame window, derived from CMDIFrameWnd. Then, you have a set of CMDIChildWnd objects placed in there. The main frame window is a MDI Frame. The child windows function similarly as a CFrameWnd does, except they rarely have toolbar of their own. So, when in SDI application, a Frame window has one view, then in MDI application, a frame window has many child frames, which each have their own views. Do you understand this ? Following this logic, the easiest way would be to create a CMDIChildWnd object in the DLL, and create a Form View to fill this window's view. This way, you would have two valid MDI child windows, from which the first would have a normal view and the other one a form view. I would follow this approach, because I am unsure how a modeless dialog works when it is a child of a MDI frame window. I have never tested it myself. But using the CMDIChildWnd->FormView approach would give valid, working results, as both child windows would then be CMDIChildWnd objects, and would have all the necessary implementation ready for functioning as MDI childs. When the windows are created, you must position them appropriately using
SetWindowPos
member of CMDIChildWnd. Just get the client rectangle of the parent frame (CMDIFrameWnd::GetClientRect), divide it to half X-wise, and use these values to determine the size and position of both windows. First window should be from (0, 0) -> (X / 2, Y) and the other from (X / 2, 0) -> (X, Y), where X and Y are the width and height of the client area, respectively. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.