Multiple Document Interface (Help...)
Could someone explain to me the differences in code between SDI and MDI? I was really wondering this: In SDI, you have your hMainWnd, and one WNDCLASS(EX), and one MainWndProc. If wanted to do MDI, what would be the difference? im talking stuff like class names, and (ok, never mind all this. if you really want to help, could you show me some code that gets a window on screen, with a child window or two? the program doesn''t need to *do* anything, i just wanna see how its done. p.s. if you decide to help me, plz don''t do this: variable = value (#defined in another header file)... thats what the msdn library does and it''s so dang confusing.... anyway, i probably confused you as to what im asking for, but i would appreciate any help you could give me... thanks!
Jake
Yesterday is the past, tomorrow is the future. Today is a gift, that is why we call it the present.
MDI and SDI are different types of applications. MDI is Multiple Document Interface, and SDI is Single Document Interface. You can have more than one window present inside the "master" window (and in most cases be able to minimize, maximize, and resize the windows inside the "master") in an MDI, in an SDI you get only one window. An example of an SDI is wordpad, whereas Microsoft Word would be an MDI.
In an MDI, each view will have its own document... unless you route around it like I did in my last project for a number of reasons. In an SDI there is only a single document, as the name indicates. Basically on an MDI the CWinApp creates a CMultiDocTemplate, which creates a CDocument and CMDIChildWnd for each CView, if you use the wizard.
I would suggest you try playing with the appwizard while creating a new project... you will be able to make your own SDI''s and MDI''s very quickly. It''s usually a good idea to let the appwizard do that stuff for you, in fact, even when i was doing my multi-view-but-single-doc application I used the appwizard and then stripped out what I didn''t need.
Oh, and in case you didn''t catch this part... MDI and SDI are part of MFC. If you want a straight Win32 application, don''t use these.
-fel
In an MDI, each view will have its own document... unless you route around it like I did in my last project for a number of reasons. In an SDI there is only a single document, as the name indicates. Basically on an MDI the CWinApp creates a CMultiDocTemplate, which creates a CDocument and CMDIChildWnd for each CView, if you use the wizard.
I would suggest you try playing with the appwizard while creating a new project... you will be able to make your own SDI''s and MDI''s very quickly. It''s usually a good idea to let the appwizard do that stuff for you, in fact, even when i was doing my multi-view-but-single-doc application I used the appwizard and then stripped out what I didn''t need.
Oh, and in case you didn''t catch this part... MDI and SDI are part of MFC. If you want a straight Win32 application, don''t use these.
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
felisandria: I thought straight Win32 programs could do MDI, too? Anyway, Microsoft Word 2000 is now an SDI app that just creates multiple program windows for each document. If you know about multi-threading and similar topics, that''s the way to go. I like it because I don''t have to go to that Window menu everytime I want to switch docs. This way, they can use the taskbar the way it works best. The point is that the user doesn''t care which programs they have open -- the user now just sees the documents in the taskbar. From the things I saw in the docs, I think MDI is going the way of the dinosaurs...
- null_pointer
Sabre Multimedia
- null_pointer
Sabre Multimedia
Unsure. I''ve only ever seen it done as an MFC based application. I think that MDI in Win32 API, if it exists, would have to be REALLY painful.
There are uses for MDI apps, but I prefer SDI if possible.
-fel
There are uses for MDI apps, but I prefer SDI if possible.
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
MDI''s use is deprecated in the new data-centric model embraced by MS since Win95. MDI came about mostly due to resource limitations available to the total number of processes that could run in Win16.
It''s still used extensively in applications that control instruments. Mostly scientific applications that display more than one view of the data at a time.
MDI can definately be done in straight Win32.
MDI frame windows have to have slightly different windows procedures to handle the MDI messages. And to create a child window of an MDI application you call CreateMDIWindow() or send an WM_MDICREATE message to the MDI application or call CreateWindowEx with the WS_EX_MDICHILD fliag set.
It''s still used extensively in applications that control instruments. Mostly scientific applications that display more than one view of the data at a time.
MDI can definately be done in straight Win32.
MDI frame windows have to have slightly different windows procedures to handle the MDI messages. And to create a child window of an MDI application you call CreateMDIWindow() or send an WM_MDICREATE message to the MDI application or call CreateWindowEx with the WS_EX_MDICHILD fliag set.
hey guys, i really appreciate the help. but could you explain a couple more things for me? is there a difference between your main WNDCLASS in an SDI and your frame WNDCLASS in an MDI? are they the same thing, or do you need a main WNDCLASS as well as a frame, and then all your children? also, are there any members you need to set to something specific to create a frame or a child? it''s not that MDI is *so* important for me to learn, but it is something i would Really like to learn, just because i like it. anyway, thanks.
Jake
Jake
Yesterday is the past, tomorrow is the future. Today is a gift, that is why we call it the present.
In an MDI application you''ve actually got two (or more) separate window types. There will be one instance of the frame, which as far as I remember, can have just about any windows flags you want. (I haven''t programmed a MDI application manually since I got C++ Builder 1, which was about 4 years ago.) It''s WndProc has to handle the MDI window messages, as well as have special handlers for the Frame Window / Child Window menu overlap thing. The Child windows really aren''t very different except you create them with CreateMDIWindow() or CreateWindowEx() with WS_EX_MDICHILD set. The WndProc of the frame should handle the case where a child window is created by WM_MDICHILDCREATE. I feel sort of like I''m repeating my last post, but there really isn''t much more to it (that I remember).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement