Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Win API / November 2007



Tip: Looking for answers? Try searching our database.

Error Using OpenKeyRegEx Api

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
OliverD - 14 Nov 2007 07:07 GMT
Hello,

Using this Api always returns "error 87 Invalid parameters" ... And i don't
understand. I'm using VB2005EE and i'm very "newbee" :o)

Can anyone help me ? Thanks a lot !

Oliver

Here's the code :

Option Explicit On

Imports System

Imports System.IO

Imports System.Text

Public Class DetectMSDE

Private Declare Function RegOpenKeyEx Lib "advapi32.dll" _

Alias "RegOpenKeyExA" _

(ByVal hKey As Integer, _

ByVal lpSubKey As String, _

ByVal ulOptions As Integer, _

ByVal samDesired As Integer, _

ByVal phkResult As Integer) As Integer

Private Declare Function RegEnumValue Lib "advapi32.dll" _

Alias "RegEnumValueA" _

(ByVal hKey As Long, _

ByVal dwIndex As Long, _

ByVal lpValueName As String, _

ByVal lpcbValueName As Long, _

ByVal lpReserved As Long, _

ByVal lpType As Long, _

ByVal lpData As String, _

ByVal lpcbData As Long) As Long

Private Declare Function RegCloseKey Lib "advapi32.dll" _

(ByVal hKey As Long) As Long

Const HKEY_CLASSES_ROOT = &H80000000

Const HKEY_CURRENT_USER = &H80000001

Const HKEY_LOCAL_MACHINE = &H80000002

Const HKEY_USERS = &H80000003

Const ERROR_SUCCESS = 0&

Const SYNCHRONIZE = &H100000

Const STANDARD_RIGHTS_READ = &H20000

Const STANDARD_RIGHTS_WRITE = &H20000

Const STANDARD_RIGHTS_EXECUTE = &H20000

Const STANDARD_RIGHTS_REQUIRED = &HF0000

Const STANDARD_RIGHTS_ALL = &H1F0000

Const KEY_ALL_ACCESS = &H3F

Const KEY_QUERY_VALUE = &H1

Const KEY_SET_VALUE = &H2

Const KEY_CREATE_SUB_KEY = &H4

Const KEY_ENUMERATE_SUB_KEYS = &H8

Const KEY_NOTIFY = &H10

Const KEY_CREATE_LINK = &H20

Const KEY_READ = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or
KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))

Const REG_DWORD = 4

Const REG_BINARY = 3

Const REG_SZ = 1

Private Sub TestDirV9(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click

Dim lngKeyHandle As IntPtr

Dim lngResult As Long

Dim lngCurIdx As Long

Dim strValue As String

Dim lngValueLen As Long

Dim lngData As Long

Dim lngDataLen As Long

Dim strResult As String

lngResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance
Names\SQL", 0&, KEY_READ, lngKeyHandle)

If lngResult <> ERROR_SUCCESS Then

MsgBox("Impossible d'ouvrir la clé.")

Exit Sub

End If
Thorsten Albers - 14 Nov 2007 12:43 GMT
OliverD <o.drezet@lse.fr> schrieb im Beitrag
<uAs8J0oJIHA.3820@TK2MSFTNGP03.phx.gbl>...
> I'm using VB2005EE and i'm very "newbee" :o)

So as a newbee you have to learn now that VB isn't always VB...

Visual Basic 2005 is VB.NET which is an implementation of the programming
language BASIC depending on the MS .NET framework.
Like most of the VB newsgroups with only 'vb' in their name this newsgroup
is dealing with Visual Basic <= 6.0 also known as 'classic'. VB 'classic'
was abandonded by MS with the rising of .NET. Instead VB.NET was introduced
which has only few things in common with VB 'classic'.
Newsgroups dealing with VB.NET usually have the sequence 'dotnet' beside
'vb' in their names.

Signature

----------------------------------------------------------------------
THORSTEN ALBERS                       Universität Freiburg
                                               albers@
                                                      uni-freiburg.de
----------------------------------------------------------------------

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.