pinvoke RegFlushKey

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having problems pinvoking the RegFlushKey function to flush my Hive registry, i keep getting a System.NotSupported Exception when i call it. Am i doing something wrong? Here is the code

Const HKEY_LOCAL_MACHINE = &H8000000
Private Declare Function RegFlushKey Lib "coredll.dll" (ByVal hKey As Long) As Lon

dim r as Long = RegFlushKey(HKEY_LOCAL_MACHINE)
 
I'm not sure what the problem is. It *is* in coredll.dll.

Paul T.

Dante said:
I am having problems pinvoking the RegFlushKey function to flush my Hive
registry, i keep getting a System.NotSupported Exception when i call it. Am
i doing something wrong? Here is the code:
 
In .net the hKey and return value are 32bit Integers:-
Private Declare Function RegFlushKey Lib "coredll.dll" (ByVal hKey As
Integer) As Integer

A Long is a 64bit integer and cannot be marshalled by value.

Peter
 
Of course! Both the parameter and the return value types are wrong. Nice
catch!

Paul T.
 
Back
Top