Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The Registry


The registry is a series of files, stored on the local hard drive, that stores application specific information. The MFC application class CWinApp has a number of methods to communicate with the registry. It is possible to read or write an integer, a block of memory, or a string. The global MFC function AfxGetApp returns a pointer to the application class object. There can only be one such object. The stSection in the methods below is usually the name of the application and the stEntry is the name of the value.

GetProfileBinary returns true if the reading was successful. GetProfileInt and GetProfileString take a default value that is returned if the entry was not found. WriteProfileBinary, WriteProfileInt, and WriteProfileString all return true on successful writing.

UINT GetProfileInt(CString stSection, CString stEntry, int iDefault);
CString GetProfileString(CString stSection, CString stEntry,
                         CString stDefault);
BOOL GetProfileBinary(CString stSection...