Dialog-based vs. SDI: VC++

I am trying to figure out the advantages and disadvantages to Dialog-based and SDI frameworks of Visual C++ 6.

I am just beginning to use VC++ and it certainly isn't as polished as VB.  Under VB I always used regular forms to create whatever I needed.  There was no need to use SDI or MDI.  I've messed around in VC++ and have been able to place down toolbar controls, and status bar controls onto my Dialog based form but for menus, I've been unable to get accelerator keys to work under it.  How do I get accelerator keys to function under Dialog based mode in VC++?  

What are all the limitations to using the Dialog based frameworks?

Thanks.
ljaquesAsked:
Who is Participating?
 
nietodConnect With a Mentor Commented:
The choice of which framework to be used (dialog/SDI/MDI) is dicatated by the interface the application needs to present to the user.  You need to consider what the user will be doing and how they will be doing.  Then there should be no problem deciding between these options.  You migyht want to consult "The Windows Interface Guidlines for Software Desing" by Microsoft or "The Human Interface Guidelines".

The first questiohn to ask yourself is will the applicaiton be document based?  i.e. will the user be able to open and close files associated with the program.  for example a word processor, a paint program, a spread sheet are all document based.  They work on documents selected by the user.   However programs like calculators, accounting packages, simulators (maybe), games (maybe) are not document oriented.  The used does not interact with them in associates with documents/files.  (files might be used by the program, but the user does not "see" an interface where they are working with particular files.)  

If the interface is not document based, then the dialog framework is almost certainly appropriate.

If the interface is document based then you will want to use SDI/MDI or an MDI alternative.  You probably don't want SDI.  SDI is very restrictive to the user.  They may work on only one document at a time.  For some applications this might not be a problem, and might even be appropriate, but usually not.

Most likely you want MDI or an MDI alternative. These allow the user to wrok on more than one document at a time.  This tends to be best for users.  Then can be working on one task and switch to another without saving their work and loosing the place.  They can copy information from one documemtn to another or compare documents etc.
0
 
AxterCommented:
The dialog base framework doesn't come with Menu support, and it's harder to add database support for it.
0
 
AxterCommented:
Also without the document/view architecture support, it's harder to setup your application for opening and closeing  files.
It's also harder to add ActiveX support, and Automation.

If you have a simple applications that does not require menus, opening and closeing documents, ActiveX, and database support, a Dialog base application would be the better choice.

It's easier to setup, initialize, and debug.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
ua1zclCommented:
This is pice of WinMain in dialog based app where accelerators used and menu also, but no toolbar. I never
use it in my simple applications, but probably it,s
possible also.

  wcl.hInstance=hInst;
  wcl.lpszClassName=szHostName;
  wcl.lpfnWndProc=Dlg1Proc;
  wcl.style=0;
  wcl.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
  wcl.hCursor=LoadCursor(NULL,IDC_ARROW);
  wcl.lpszMenuName= "IDM_MENU1";
  wcl.cbClsExtra=IDD_DIALOG1;
  wcl.cbWndExtra=DLGWINDOWEXTRA ;
  wcl.hbrBackground= (HBRUSH)GetStockObject(LTGRAY_BRUSH);
  if(!RegisterClass (&wcl))return 0;
  // in .rc file allocated menu IDM_MENU1 and
  // accelerators IDM_MENU1 also
  hAccel= LoadAccelerators(hInst,MAKEINTRESOURCE(IDM_MENU1));
  hwnd= CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG1), hInst,0);
  while (GetMessage (&msg,NULL,0,0))
 {
  if( !TranslateAccelerator (hwnd,hAccel, &msg))
     { TranslateMessage (&msg);DispatchMessage (&msg); }
 }
0
 
AxterCommented:
>>never use it in my simple applications, but probably
>>it,s possible also.
It's possible to add almost all the stuff that is in the SDI.
The difference is that the SDI already comes with the support, and in the Dialog App, you have to add it.
0
 
ua1zclCommented:
Forgot, plase not forget to define a class string in dialog template.
//as a text in rc file it looks:
IDD_DIALOG1 DIALOGEX 0, 0, 309, 73
.....
CLASS "Some_your_class_name"
......
0
 
ua1zclCommented:
This is pice of WinMain in dialog based app where accelerators used and menu also, but no toolbar. I never
use it in my simple applications, but probably it,s
possible also.

  wcl.hInstance=hInst;
  wcl.lpszClassName=szHostName;
  wcl.lpfnWndProc=Dlg1Proc;
  wcl.style=0;
  wcl.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
  wcl.hCursor=LoadCursor(NULL,IDC_ARROW);
  wcl.lpszMenuName= "IDM_MENU1";
  wcl.cbClsExtra=IDD_DIALOG1;
  wcl.cbWndExtra=DLGWINDOWEXTRA ;
  wcl.hbrBackground= (HBRUSH)GetStockObject(LTGRAY_BRUSH);
  if(!RegisterClass (&wcl))return 0;
  // in .rc file allocated menu IDM_MENU1 and
  // accelerators IDM_MENU1 also
  hAccel= LoadAccelerators(hInst,MAKEINTRESOURCE(IDM_MENU1));
  hwnd= CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG1), hInst,0);
  while (GetMessage (&msg,NULL,0,0))
 {
  if( !TranslateAccelerator (hwnd,hAccel, &msg))
     { TranslateMessage (&msg);DispatchMessage (&msg); }
 }
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.