Set a registry value

It want to set a registry value under HKCU\Software\MyApplication

DWord: MyData
Value: 0xffff

What are the code I need to write to archieve this?
matchzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nihtilaCommented:
Hi!

In VB you can write to the registry with Savesetting command as:

SaveSetting Application, Section, Key, Your value

But it's limited to the section:

'VBA and VB settings'/your program name/...

If you want to write to other locations you must use Win32 API.
0
matchzAuthor Commented:
In fact, the program I am writing are going to modify the registry value that don't belong it, such as ICQ, or netscape, etc.
0
VbmasterCommented:
Here's a class I made to make registry editing really easy, it works as a wrapper around the registry API's..

http://www.cyd.liu.se/~freqv416/clsRegistry.cls
0
VbmasterCommented:
Humm.. maybe I should have added a example even if the class is really really easy to use. ,)

  Dim Registry As New clsRegistry
 
  Call Registry.CreateNewKey(HKEY_CURRENT_USER, "Software\MyApplication")
  Call Registry.SetKeyValue(HKEY_CURRENT_USER, "Software\MyApplication", "MyData", &HFFFF, REG_DWORD)

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
matchzAuthor Commented:
Thank for you library
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.