Click here to Skip to main content
15,881,763 members
Articles / Programming Languages / Visual Basic
Alternative
Article

JumpTo RegEdit

Rate me:
Please Sign up or sign in to vote.
2.83/5 (4 votes)
9 Jul 2012CPOL1 min read 15.1K   217   10  
This is an alternative for "JumpTo RegEdit"

Introduction

This is just an alternate (VB.Net) version of "JumpTo RegEdit" located here: http://www.codeproject.com/Articles/20283/JumpTo-RegEdit

This version is updated to VS 2008 and then Converted to VB.NET using the online code converter from here http://converter.telerik.com/

Background

I have been looking for a way to add the Reg Jump in VB.NET for several of my programs so I converted the C# code to VB.NET.

Using the code

The complete test project is in the download zip file.

There have been very few changes to the code from the original article besides the conversion to VB.Net.

Some of the lines converted from C# converterd to DirectCast and had a type conversion error so I changed them CType and it works fine.

C# code:

C#
return Marshal.PtrToStringUni((IntPtr)(lpLocalBuffer.ToInt32() + Marshal.SizeOf(typeof(Interop.TVITEM))));

VB.NET code:

Change this in the converted code:

VB.NET
'Return Marshal.PtrToStringUni(DirectCast(lpLocalBuffer.ToInt32() + Marshal.SizeOf(GetType(Interop.TVITEM)), IntPtr))

To this:

VB.NET
Return Marshal.PtrToStringUni(CType(lpLocalBuffer.ToInt32() + Marshal.SizeOf(GetType(Interop.TVITEM)), IntPtr))

That was just one of a few lines that needed to be converted to CType.

When run under Windows Vista with UAC enabled it throws this error.

VB.NET
System.InvalidOperationException was unhandled
  Message="WaitForInputIdle failed.  This could be because the process does not have a graphical interface."

But when run as Admin it does not throw the error.

I added, ="requireAdministrator"

To get around the error in case a person forgets to "Run as Administrator"

Points of Interest

This conversion helped me learn more on using hte API functions and jumping to the Registry at a given point.

I hope it helps others.

History

Initial conversion 8 July 2012

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO PC's Xcetra
United States United States
My first experience with computers was when my mom gave a Timex Sinclair 1000 to me for Christmas some time in the late 70's (I still have it)There I learned to copy code from magazines to save to cassette tapes for playing games.

Since then I have dabbled in:
Basic,Qbasic,ruby,python,Java Script, HTML, CSS, C#, C++, Perl, and a few other I can't think of off hand.
Now I Mainly work with VB Script and VB.Net
I Prefer to build programs that make use of the GUI so I don't have to remember all of the syntax for console apps. I realy don't care much for HTML because of the way you build and then run to see if it looks right. Also the new WPF is to much like HTML so I steer clear of it for now.
Most of what I build is for getting information from a system to use in system repair.I make heavy use of the WMI classes. Why reinvent something.

Comments and Discussions

 
-- There are no messages in this forum --