EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+
 

#Previous question #Index of VC++/WIN32/MFC Questions #Next question

Dialog Boxes

People talk to other people and exchange their inputs via verbal dialogs. Dialog boxes are the medium to talk to its users and collect their inputs. A dialog box usually contains one or more controls/widgets with which the user enters text, chooses options, or directs the action of the command. Dialog boxes are primarily of two types - modal and modeless.

Modal dialogs

Modal dialog creates an UI thread and pops above parent window. This dialog gets curser focus on top of parent window and completely blocks parent. Parent windows cannot get focus until dialog closes. About box of any application is a good example of modal dialog.

About box Modal Dialog

DialogBox

DialogBox function which is basically a macro creates a modal dialog box from a dialog box template resource. DialogBox does not return control until the specified callback function terminates the modal dialog box by calling the EndDialog function. The DialogBox macro uses the DialogBoxParam function.

DialogBox API

int DialogBox(
  HINSTANCE hInstance,  /* handle to application instance */
  LPCTSTR lpTemplate,   /* identifies dialog box template */
  HWND hWndParent,      /* handle to owner window */
  DLGPROC lpDialogFunc  /* pointer to dialog box procedure */
);
int DialogBoxParam(
  HINSTANCE hInstance,     /* handle to application instance */
10    LPCTSTR lpTemplateName,  /* identifies dialog box template */
11    HWND hWndParent,         /* handle to owner window */
12    DLGPROC lpDialogFunc,    /* pointer to dialog box procedure */
13    LPARAM dwInitParam       /* dialog initialization parameter */
14  );

Modeless dialogs

Modeless dialog is one which opens on top of parent window but still parent can get focus and process events. Modeless dialog does not block parent window and this is needed when users need to enter frequent inputs and same time want to get the reflection in the parent window. Find/Replace dialog is a good example of modeless dialog.

Find Modeless Dialog

CreateDialog

CreateDialog macro creates a modeless dialog box from a dialog box template resource. The CreateDialog macro uses the CreateDialogParam function.

CreateDialog API

HWND CreateDialog(
  HINSTANCE hInstance,  /* handle to application instance */
  LPCTSTR lpTemplate,   /* identifies dialog box template name */
  HWND hWndParent,      /* handle to owner window */
  DLGPROC lpDialogFunc  /* pointer to dialog box procedure */
);
HWND WINAPI CreateDialogParam(
  HINSTANCE hInstance,         /* handle to application instance */
  LPCTSTR lpTemplateName,      /* identifies dialog box template name */
10    HWND hWndParent,             /* handle to owner window */
11    DLGPROC lpDialogFunc,        /* handle to owner window */
12    LPARAM dwInitParam           /* dialog initialization parameter */
13  );

You have viewed 1 page out of 109. Your VC++ learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

#Programming Windows, Fifth Edition (Developer Reference)
#Programming Applications for Microsoft Windows (Microsoft Programming Series)
#Programming Windows with MFC, Second Edition
#Visual C++ Programming
#Programming Microsoft Visual C++, Fifth Edition

* #1 webmaster Sat 26 Apr/2014 23:21:49(GMT)  Like 0 Unlike 0

Dear Users,

We are pleased to inform you that a forum/blog has been incorporated with www.mybestnotes.co.in. You are welcomed to add your comments, requests, codes, solutions and feedback to it. Please login(if already a member) or signup(for free) to avail to this facility.

Regards,
Webmaster

Your message goes here:

Name:Guest
Email:anonymous@unknown.com
My Post:*
Secutiry Code: ******  *
Preview this compose before posting this in discussion forum.
 
Note:
  1. Use [Sxx] code to show smiles. Example [S02]
  2. Use [URL ], example [URL http://www.google.com/]
  3. To display code or un formatted text use [CODE] [/CODE]. Example: [CODE] printf("Hello world"); [/CODE]
 [S01]   [S02]   [S03]   [S04]   [S05]   [S06]   [S07]   [S08] 
 [S09]   [S10]   [S11]   [S12]   [S13]   [S14]   [S15]   [S16] 
 [S17]   [S18]   [S19]   [S20]   [S21]   [S22]   [S23]   [S24] 

Note: Only members are allowed, * fields are mandatory.