ljaques
asked on
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.
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.
The dialog base framework doesn't come with Menu support, and it's harder to add database support for it.
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.
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.
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=szHostNa me;
wcl.lpfnWndProc=Dlg1Proc;
wcl.style=0;
wcl.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1) );
wcl.hCursor=LoadCursor(NUL L,IDC_ARRO W);
wcl.lpszMenuName= "IDM_MENU1";
wcl.cbClsExtra=IDD_DIALOG1 ;
wcl.cbWndExtra=DLGWINDOWEX TRA ;
wcl.hbrBackground= (HBRUSH)GetStockObject(LTG RAY_BRUSH) ;
if(!RegisterClass (&wcl))return 0;
// in .rc file allocated menu IDM_MENU1 and
// accelerators IDM_MENU1 also
hAccel= LoadAccelerators(hInst,MAK EINTRESOUR CE(IDM_MEN U1));
hwnd= CreateDialog(hInst,MAKEINT RESOURCE(I DD_DIALOG1 ), hInst,0);
while (GetMessage (&msg,NULL,0,0))
{
if( !TranslateAccelerator (hwnd,hAccel, &msg))
{ TranslateMessage (&msg);DispatchMessage (&msg); }
}
use it in my simple applications, but probably it,s
possible also.
wcl.hInstance=hInst;
wcl.lpszClassName=szHostNa
wcl.lpfnWndProc=Dlg1Proc;
wcl.style=0;
wcl.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1)
wcl.hCursor=LoadCursor(NUL
wcl.lpszMenuName= "IDM_MENU1";
wcl.cbClsExtra=IDD_DIALOG1
wcl.cbWndExtra=DLGWINDOWEX
wcl.hbrBackground= (HBRUSH)GetStockObject(LTG
if(!RegisterClass (&wcl))return 0;
// in .rc file allocated menu IDM_MENU1 and
// accelerators IDM_MENU1 also
hAccel= LoadAccelerators(hInst,MAK
hwnd= CreateDialog(hInst,MAKEINT
while (GetMessage (&msg,NULL,0,0))
{
if( !TranslateAccelerator (hwnd,hAccel, &msg))
{ TranslateMessage (&msg);DispatchMessage (&msg); }
}
>>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.
>>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.
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"
......
//as a text in rc file it looks:
IDD_DIALOG1 DIALOGEX 0, 0, 309, 73
.....
CLASS "Some_your_class_name"
......
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=szHostNa me;
wcl.lpfnWndProc=Dlg1Proc;
wcl.style=0;
wcl.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1) );
wcl.hCursor=LoadCursor(NUL L,IDC_ARRO W);
wcl.lpszMenuName= "IDM_MENU1";
wcl.cbClsExtra=IDD_DIALOG1 ;
wcl.cbWndExtra=DLGWINDOWEX TRA ;
wcl.hbrBackground= (HBRUSH)GetStockObject(LTG RAY_BRUSH) ;
if(!RegisterClass (&wcl))return 0;
// in .rc file allocated menu IDM_MENU1 and
// accelerators IDM_MENU1 also
hAccel= LoadAccelerators(hInst,MAK EINTRESOUR CE(IDM_MEN U1));
hwnd= CreateDialog(hInst,MAKEINT RESOURCE(I DD_DIALOG1 ), hInst,0);
while (GetMessage (&msg,NULL,0,0))
{
if( !TranslateAccelerator (hwnd,hAccel, &msg))
{ TranslateMessage (&msg);DispatchMessage (&msg); }
}
use it in my simple applications, but probably it,s
possible also.
wcl.hInstance=hInst;
wcl.lpszClassName=szHostNa
wcl.lpfnWndProc=Dlg1Proc;
wcl.style=0;
wcl.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1)
wcl.hCursor=LoadCursor(NUL
wcl.lpszMenuName= "IDM_MENU1";
wcl.cbClsExtra=IDD_DIALOG1
wcl.cbWndExtra=DLGWINDOWEX
wcl.hbrBackground= (HBRUSH)GetStockObject(LTG
if(!RegisterClass (&wcl))return 0;
// in .rc file allocated menu IDM_MENU1 and
// accelerators IDM_MENU1 also
hAccel= LoadAccelerators(hInst,MAK
hwnd= CreateDialog(hInst,MAKEINT
while (GetMessage (&msg,NULL,0,0))
{
if( !TranslateAccelerator (hwnd,hAccel, &msg))
{ TranslateMessage (&msg);DispatchMessage (&msg); }
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.