views:

357

answers:

2

Hi,

I have a MFC application created by the MFC Project Wizard. I wanted to save/read application settings in the registry and so asked this question to find a C++ Registry wrapper as the Windows API is very messy. However, I have now heard that the MFC provides a way to do this. Is this true? If so, how can I read/write values, see whether a key exists and get a list of all the keys?

+3  A: 

Does this help?

Liz Albin
Yes it does. Thanks! Vote Up...
Kryten
+5  A: 

MFC provides an easy way to read/write Windows registry.

In your project you'll have a global CMyProjectName theApp; object.
CMyProjectName inherits CWinApp class which provides the SetRegistryKey() method.
That method sets theApp to write in the registry instead of an "ini" file.

In the documentation check out

CWinApp::GetProfileInt
CWinApp::GetProfileString
CWinApp::WriteProfileInt
CWinApp::WriteProfileString

methods on how to read and write integers and strings in the registry.

Nick D
Vote up for your answer too as it also helps...
Kryten