M
Mobile Boy 36
I'm trying to use the WinCE API's to write to the registry in VB.Net. I
keep getting the following error: "An unhandled exception of type
'System.NotSupportedException' occurred ".
I know that System.NotSupportedExteption is 99.9% of the time an incorrect
P/Invoke
declaration. Please does someone know how to resolve this?
The function worked fine in EVB, no problem at all...but not in VB.NET
This is my function definition:
Declare Function RegCreateKeyEx Lib "Coredll" Alias "RegCreateKeyExW" ( _
ByVal hkey As Long, _
ByVal lpSubKey As String, _
ByVal Reserved As Long, _
ByVal lpClass As String, _
ByVal dwOptions As Long, _
ByVal samDesired As Long, _
ByVal lpSecurityAttributes As Long, _
phkResult As Long, _
lpdwDisposition As Long) _
As Long
I also tried the .NET alternative declaration:
<DllImport("Coredll", Entrypoint:="RegCreateKeyExW", SetLastError:=True)> _
Private Function RegCreateKeyEx( _
ByVal hkey As Long, _
ByVal lpSubKey As String, _
ByVal Reserved As Long, _
ByVal lpClass As String, _
ByVal dwOptions As Long, _
ByVal samDesired As Long, _
ByVal lpSecurityAttributes As Long, _
ByVal phkResult As Long, _
ByVal lpdwDisposition As Long) _
As Long
End Function
Best regards,
Kevin
keep getting the following error: "An unhandled exception of type
'System.NotSupportedException' occurred ".
I know that System.NotSupportedExteption is 99.9% of the time an incorrect
P/Invoke
declaration. Please does someone know how to resolve this?
The function worked fine in EVB, no problem at all...but not in VB.NET
This is my function definition:
Declare Function RegCreateKeyEx Lib "Coredll" Alias "RegCreateKeyExW" ( _
ByVal hkey As Long, _
ByVal lpSubKey As String, _
ByVal Reserved As Long, _
ByVal lpClass As String, _
ByVal dwOptions As Long, _
ByVal samDesired As Long, _
ByVal lpSecurityAttributes As Long, _
phkResult As Long, _
lpdwDisposition As Long) _
As Long
I also tried the .NET alternative declaration:
<DllImport("Coredll", Entrypoint:="RegCreateKeyExW", SetLastError:=True)> _
Private Function RegCreateKeyEx( _
ByVal hkey As Long, _
ByVal lpSubKey As String, _
ByVal Reserved As Long, _
ByVal lpClass As String, _
ByVal dwOptions As Long, _
ByVal samDesired As Long, _
ByVal lpSecurityAttributes As Long, _
ByVal phkResult As Long, _
ByVal lpdwDisposition As Long) _
As Long
End Function
Best regards,
Kevin