By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,881 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

Registry Help

P: n/a
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\Tc pip\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/de..._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
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


merc wrote:


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.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.