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

Common dialogs

There are several types of common dialog available in windows operating system. Common dialogs are popup dialog windows available as components to take verious input parameters from users.

These are some functionalities common dialogs provide to users-

  • Selecting a file name with path in graphical environment for opening or saving a file.
  • Selecting a system font and size and other attributes with preview.
  • Selecting a color value for graphical or multimedia application
  • Printer selection for prining text or graphical output of the program
  • Pagesetup of the program output.
  • Find and or replace string and parameter input from user

These are built in dialog resources with their additional functionalities. Programmers need not to implement these from scratch but still can reuse these and extend the functionality in their application. These dialogs can be invoked via Win32 API calls directly. However MFC wraps these inside meaningful classes to maintain object oriented approach.

Common dialog pictures

  • GetOpenFileName

  • GetSaveFileName

  • ChooseFont

  • ChooseColor

  • PageSetupDlg

  • PrintDlg

  • FindText

  • ReplaceText


Common dialog Win32 APIs

Programmers need to include comdlg.h file in their C/C++ files and comdlg32.lib is the import library to include during link time.

  • GetOpenFileName: File Open dialog
  • GetSaveFileName: File Save dialog
  • ChooseFont: Font choose dialog
  • ChooseColor: Color picker dialog
  • PageSetupDlg: Printer page setup dialog
  • PrintDlg: Print dialog
  • FindText: File text find dialog
  • ReplaceText: File text replace dialog

Common dialog MFC classess

CCommonDialog is the base class for classes that encapsulate functionality of the Windows common dialogs. afxdlgs.h is the header file to include in MFC application. Following are the class name of the dialog:

  • CFileDialog: File Open/Save dialog
  • CFontDialog: Font choose dialog
  • CColorDialog: Color picker dialog
  • CPageSetupDialog: Printer page setup dialog
  • CPrintDialog: Print dialog
  • CFindReplaceDialog: File find/replace dialog

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 Sun 27 Apr/2014 13:59:36(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.


Your message goes here:

My Post:*
Secutiry Code: ******  *
Preview this compose before posting this in discussion forum.
  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.