Dec 142017
A Visual C ++ MFC sample program.
File PRIVDLG.ZIP from The Programmer’s Corner in
Category C++ Source Code
A Visual C ++ MFC sample program.
File Name File Size Zip Size Zip Type
DIALOGS.DLG 1295 632 deflated
LEGAL.TXT 1889 916 deflated
PRECOMP.CPP 22 22 stored
PRECOMP.H 21 21 stored
PRIVDLG.CPP 6503 2075 deflated
PRIVDLG.DEF 711 360 deflated
PRIVDLG.H 2608 836 deflated
PRIVDLG.ICO 766 275 deflated
PRIVDLG.MAK 3586 945 deflated
PRIVDLG.RC 608 322 deflated
README.TXT 2776 1207 deflated
RESOURCE.H 670 352 deflated
VCPRVDLG.MAK 2460 915 deflated

Download File PRIVDLG.ZIP Here

Contents of the README.TXT file

PRIVDLG Sample Application

This sample application uses the Microsoft Foundation Classes
for Windows, version 1.0 (shipped with Microsoft C/C++ 7.0) to
demonstrate the following techniques:

1. Using a dialog box as a main window. This technique is
documented on page 334 of the "Class Libraries User's Guide"
shipped with C/C++ 7.0.

2. Using private dialog class registration to attach a custom icon to
the main window dialog.

Written by Mark Bader, Windows Developer Support

(c) 1992, Microsoft Corporation, Developer Support
See the file LEGAL.TXT for the complete licensing agreement

Why do we need a private dialog class?

If you're creating a standard frame window and want a custom icon, the
only step required is to define an icon in your .RC file with the
constant AFX_IDI_STD_FRAME. When the MFC libraries register the
window class for your window, it will use this icon as the window's

Dialog boxes, on the other hand, are a bit different -- all
Windows dialog boxes use pre-registered window classes, and you cannot
simply define an icon using AFX_IDI_STD_FRAME if you use a dialog box
for your main window.

The solution is to register a private window class to be used for
your dialog box. Since the name of this window class must be
specified in the dialog template, the MFC function
AfxRegisterWndClass() function will not work because it creates a new
class name dynamically each time it is called.

The restrictions on registering your own private dialog class in MFC
are the same as in standard "C" Windows programming. Please query
the Knowledge Base with the keywords "private dialog class" for more
information on these restrictions.

This sample uses the following steps to register a private dialog
class with a custom icon:

1. Register a new private dialog class using the ::RegisterClass()
function with a unique class name. Fill in the custom icon for the
hIcon field of the WNDCLASS structure, and add the custom icon to
the .RC file.

Note that this class should only be registered once for the
appliation (no matter how many instances of our dialog box get
created). Be sure to follow the standard Windows rules for
registering a private dialog class (see the Microsoft Knowledgebase,
query on "private dialog class").

2. Add the CLASS "classname" directive to your dialog box resource
file, using the unique class name you registered in step 1. Make
sure your dialog contains the WS_MINIMIZEBOX style bit if you want to
allow the dialog to be minimized.

3. Create a dialog using the template from step 2.

This sample demonstrates the above tecnhiques.

 December 14, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>