Registry Help

M

merc

C++ Guru's..

I need some help please. I've been reading the C++ in 21 days by
James Liberty. Currently I'm on Chapter 7 (looping). This knowledge
doesn't have anything really to do with my question; it's more to show
you that I'm a rookie learning C++.

I have an opportunity to write a simple application for my work and
I'd like to write my very first non-book tutorial application.

I need to be able to check to see if a particular key's value exists
and if not then write the key to the registery.

The Key I need to check for an existing value is:
KEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters

The DWORD Value I need to check for is:
DisableDHCPMediaSense with a value of 1

So, common sense tells me to go to the MSDN materials at Microsoft. I
found the registry api information here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry_functions.asp

However, I don't understand how to plug this into my programs logic?

For example.. I know how to form the IF and ELSE together, but I don't
understand how I take the Registry API and make it work the C++ within
my IF and ELSE.

In your reply, please don't suggest using another langaguage such as
VBScript or JavaScript. My goal is to learn C++. ;) Also, please do
not solve my problem but give me hints on how to apply it. The MSDN
information I've found hasn't given me a good enough hint yet or how
to put this all together.

Thanks for everyone's time!

Jon
 
K

Karl Heinz Buchegger

merc said:
For example.. I know how to form the IF and ELSE together, but I don't
understand how I take the Registry API and make it work the C++ within
my IF and ELSE.

In your reply, please don't suggest using another langaguage such as
VBScript or JavaScript. My goal is to learn C++. ;)

But your problem is not related to C++. Your problem is related
to: How do I program for the Windows Environment (in particular
the subsystem of Windows which handles the Registry). Thus
you need to ask in a newsgroup about Windows programming.
The Micorsoft newsserver holds such groups. ( point your
newsreader to msnews.microsoft.com)
The FAQ has additional information on finding informations:
http://snurse-l.org/acllc-c++/faq.html

Another hint: There are already code snippets available for simplifying
your problem. The encapsulate the registry access in a nicer and easier
to use way.

You might also want to search some dedicated web-sites for
windows programming and use them as a sort of source code
repository:
www.codeguru.com
www.codeproject.com

PS: The way your question is formulated makes me come up with
a warning: Programming Windows isn't that easy. You might continue
your studies on standard C++, until you feel confident in just the
plain language. Only then move on to the next step. Also: You definitly
will need a book on Windows programming, as you needed a book for C++
programming.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top