regopenkeyex

C# Signature:

[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
  public static extern int RegOpenKeyEx(
    UIntPtr hKey,
    string subKey,
    int ulOptions,
    int samDesired,
    out UIntPtr hkResult);

VB Signature:

Declare Auto Function RegOpenKeyEx Lib "advapi32.dll"  (
   ByVal hKey As IntPtr,
   ByVal lpSubKey As String,
   ByVal ulOptions As Integer,
   ByVal samDesired As Integer,
   ByRef phkResult As Integer
) As Integer

Notes:

public static UIntPtr HKEY_LOCAL_MACHINE = new UIntPtr(0x80000002u);
public static UIntPtr HKEY_CURRENT_USER  = new UIntPtr(0x80000001u);

Notes:

Tips & Tricks:

Sample Code (VB):

Sample Code (VB) to convert an IntPtr to a RegistryKey

Sample Code (C#) to read a string value

Working VB.net Code

Working VB.net Code

Working C#.NET Code + Usage

Working C#.NET Code + Usage

Microsoft .NET Framework 4.0

Microsoft .NET Framework 4.0

Microsoft .NET Framework 4.0 - how to get the above sample running

Última actualización