Accessing the registry through the .NET Framework shows 1 thing; Regedit shows another

0

I'm posting here because this question has nothing to do with how to program something and everything to do with a screwed up computer.

When I run the following line of VB .Net code in the Visual Studio 2010 Immediate Window:

MsgBox(My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Control Panel\Desktop\ProductName",                                               "SCRNSAVE.EXE", Nothing)) 

then I get the following message box:

---------------------------
Screensaver State Checker
---------------------------
C:\Windows\system32\PhotoScreensaver.scr
---------------------------
OK   
---------------------------

This makes no sense because the registry doesn't even have a SCRNSAVE.exe entry in the screenshot.

enter image description here

In fact, the current screensaver according to the Windows Control Panel is "(None)."

By the way, prior to this little exercise with VB .Net, I was having all sorts of problems trying to get the screensaver to turn on at the right times.

How can I fix this problem?

System Information:

  • ThinkPad T400
  • Windows 7 Ultimate 32-bit edition
  • More info upon request

Zian Choy

Posted 2012-07-29T05:24:24.520

Reputation: 1 394

Question was closed 2012-07-29T20:32:07.047

Your screenshot isn't looking in the right place. You need to look at the Product branch. – None – 2012-07-29T05:57:53.747

To add to what Randolph said, your code is looking at HKEY_CURRENT_USER\Control Panel\Desktop\ProductName, but your screenshot stops at the Desktop key. Drop the "\ProductName" from the code, as your screenshot is correct. – Patrick Seymour – 2012-07-29T12:21:06.673

Answers

1

Patrick S had the right answer:

your code is looking at HKEY_CURRENT_USER\Control Panel\Desktop\ProductName, but your screenshot stops at the Desktop key. Drop the "\ProductName" from the code, as your screenshot is correct.

Zian Choy

Posted 2012-07-29T05:24:24.520

Reputation: 1 394