How to use the registry

  • Thread starter Thread starter Steve Behman
  • Start date Start date
S

Steve Behman

I have a single integer that I wish to save from execution to execution of a
simple application.

Is there a way to save this persistent data in a registry key from a Visual
C++ program?
 
Mark, thanks for the response.

I was actually asking a more specific question:
What methods are available in Visual C++ to get and set a registry key
(value).

Searching the Visual C++ Express Edition help system produced no results
whatsoever. I know what the SDK level there is an API call that would do what
I want. I am still so new Visual C++ to know if there is access from .NET to
the "native" APIs.

Again thanks,

BTW: The only reason I picked on the registry as the repository for my one
word of data is that I could think of no other place to put it.
 
Steve Behman said:
Mark, thanks for the response.

I was actually asking a more specific question:
What methods are available in Visual C++ to get and set a registry key
(value).

Searching the Visual C++ Express Edition help system produced no results
whatsoever. I know what the SDK level there is an API call that would do
what
I want. I am still so new Visual C++ to know if there is access from .NET
to
the "native" APIs.


In Win32 APIs, the RegOpenKeyEx. RegQueryValueEx, RegSetValueEx,
RegCreateKeyEx etc. functions can be used.
In .NET, the Microsoft.Win32.Registry class can be used.

Again thanks,

BTW: The only reason I picked on the registry as the repository for my one
word of data is that I could think of no other place to put it.


Makes sense. The link does have info about important items though, like
where in the registry to put items depending on whether the data is
per-user, machine wide (local machine), etc.

Mark
 
Steve said:
I have a single integer that I wish to save from execution to execution of a
simple application.

Is there a way to save this persistent data in a registry key from a Visual
C++ program?

Steve:

If you are using C++/CLI then the easiest way to access the registry is surely
the same as it would be in C#. Your question is not one about Visual C++, but
rather about .NET.

I am no expert in .NET, but it seems that the RegistryKey class is what you want.
 
Back
Top