Link to home
Avatar of bpl5000
bpl5000

asked on

Easiest way to modify and remove registry keys

I would like to modify and remove registry keys using vb6.  What would be the easiest way to do this?  Here's what I want to do:

[HKEY_CURRENT_USER\Control Panel\Desktop]
"ScreenSaveActive"="0"
"SCRNSAVE.EXE"=-

I want to do the modifications within VB6, not from a regfile.

Thanks,
BPL
Avatar of rettiseert
rettiseert

ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of bpl5000

ASKER

EDDYKT, when I try your code, but I get the following error:

Run-time error '424':
Object required

Maybe I need to reference something?  I tried Microsoft Scripting Runtime and WSHControllerLibrary, but neither helped.  What am I missing?

Thanks,
BPL
Avatar of bpl5000

ASKER

It is working correctly, I must have typed something wrong.  Here is my code to remove a screen saver:

Set WshShell = CreateObject("Wscript.Shell")
WshShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveActive", 0, "REG_SZ"
WshShell.RegDelete "HKCU\Control Panel\Desktop\SCRNSAVE.EXE"
Set WshShell = Nothing