473,612 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use the registry

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?
Aug 10 '08 #1
4 1130
"Steve Behman" <St*********@di scussions.micro soft.comwrote in message
news:B4******** *************** ***********@mic rosoft.com...
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?

Yes.

Some handy info on proper app data management:

Data and Settings Management
http://msdn.microsoft.com/en-us/library/ms995853.aspx
Mark

--
Mark Salsbery
Microsoft MVP - Visual C++
Aug 11 '08 #2
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.

"Mark Salsbery [MVP]" wrote:
"Steve Behman" <St*********@di scussions.micro soft.comwrote in message
news:B4******** *************** ***********@mic rosoft.com...
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?


Yes.

Some handy info on proper app data management:

Data and Settings Management
http://msdn.microsoft.com/en-us/library/ms995853.aspx
Mark

--
Mark Salsbery
Microsoft MVP - Visual C++
Aug 11 '08 #3
"Steve Behman" <St*********@di scussions.micro soft.comwrote in message
news:5B******** *************** ***********@mic rosoft.com...
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

--
Mark Salsbery
Microsoft MVP - Visual C++

>
"Mark Salsbery [MVP]" wrote:
>"Steve Behman" <St*********@di scussions.micro soft.comwrote in message
news:B4******* *************** ************@mi crosoft.com...
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?


Yes.

Some handy info on proper app data management:

Data and Settings Management
http://msdn.microsoft.com/en-us/library/ms995853.aspx
Mark

--
Mark Salsbery
Microsoft MVP - Visual C++
Aug 11 '08 #4
Steve Behman wrote:
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.

--
David Wilkinson
Visual C++ MVP
Aug 11 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2612
by: Rohit Santhanam | last post by:
As I am reading the .NET documentation, I get the feeling that Microsoft is trying to get rid of the registry. My understanding is that an application built using .NET does not use the registry at all. So, conceivably as applications are migrated to .NET, the registry could disappear in a future version of Windows. Does anybody out there agree with me? Of course, they might keep the registry for backward compatibility purposes.
0
354
by: vincemoon | last post by:
Below is an excerpt from my Registry Log, created by Redmon, showing the process whereby TweakUI added the compressed folder option to the new sub-menu in the right click context menu for open folders and desktop. I hope someone can help me to better understand what this log excerpt means, or point me to info sources that do a good job of explaining how to interpret exactly what the various phrases, words, and numbers in the log mean.
1
16317
by: rdavis7408 | last post by:
I have a database that has a form that opens a report using date parameters. I have been using it for six months and last week I began to get the following Error Message: "File sharing lock count exceeded. Increase MaxLocksPerFile registry entry." I checked in the Tools - Options - Advance. I have the database shared with no locks selected and record level locking selected.
8
5481
by: Al Kaufman | last post by:
I have a simple console app that uses: regSubKey = <some registry key> Dim reg As RegistryKey = Registry.ClassesRoot.OpenSubKey(regSubKey) Dim path As String path = CStr(reg.GetValue(""))
4
1381
by: Bob | last post by:
My question about how to add an assembly search path to VS.NET's IDE remains unanswered, but I'm still faced with a problem possibly associated with this: my exported registry is more than 67MB. This seems much too large to be normal, even for a developer's machine. I've read in places that "it's not recommended that you register assemblies in the GAC when developing addins", yet the instructions for adding a path the IDE configuration...
0
12030
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry key 'Temporary (volatile) Jet DSN for process
3
2085
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to create a registry key, but orphan it from the program that created it? Reason: Create a key, but not associate it with the program, so that the program can check for that key to see if the product has been installed and stop a second installation or illegal installation. If not orphan, can you encrypt the Key so that only your program can decrypt
3
1791
by: Aussie Rules | last post by:
Hi, I want to store some data in the registry, however I have not been able to do this, and think my logic maybe flawed. Firstly I try to open the registry and read in any existing values. Dim aKey As RegistryKey aKey = Registry.CurrentUser.OpenSubKey("software\myApplication") I then attempt to read in any existing values
6
1677
by: JOSII | last post by:
Getting a string of boolean value into and out of the registry is no problem. Here's the problem: Although you can place an object into the registry and retreive it, I need to place an ArrayList object with 10 string items into the registry and retreive them later. I tried this: key.SetValue("lstNSXitems", lstNSX.Items) where "lstNSXitems" is the name of the subkey, and lstNSX.Items is the
0
8422
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6081
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4047
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4110
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2554
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1699
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.