Results 1 to 5 of 5

Thread: API calls in VB .NET

  1. #1

    Thread Starter
    Member Penavin's Avatar
    Join Date
    Oct 2001
    Location
    Sisak, Croatia
    Posts
    42

    Question API calls in VB .NET

    Hi!

    When using API calls in .NET like in VB 6 I can't obtain the same result. Actually, there are no results at all!
    What is the problem?

    Here are functions I tryed to use:
    Code:
    Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" _
         (ByVal hKey As Long, _
          ByVal lpSubKey As String, _
          ByVal ulOptions As Long, _
          ByVal samDesired As Long, _
          ByRef phkResult As Long) As Long
    
    Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" _
         (ByVal hKey As Long, _
          ByVal lpValueName As String, _
          ByVal lpReserved As Long, _
          ByRef lpType As Long, _
          ByVal lpData As String, _
          ByRef lpcbData As Long) As Long
    
    Private Declare Function RegCloseKey Lib "advapi32" _
         (ByVal hKey As Long) As Long
    Thank you.
    Last edited by Penavin; Mar 27th, 2003 at 02:11 AM.
    Penavin

  2. #2
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456

    Re: API calls in VB .NET

    Originally posted by Penavin
    Hi!

    When using API calls in .NET like in VB 6 I can't obtain the same result. Actually, there are no results at all!
    What is the problem?

    Here are functions I tryed to use:
    Code:
    Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" _
         (ByVal hKey As Long, _
          ByVal lpSubKey As String, _
          ByVal ulOptions As Long, _
          ByVal samDesired As Long, _
          ByRef phkResult As Long) As Long
    
    Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" _
         (ByVal hKey As Long, _
          ByVal lpValueName As String, _
          ByVal lpReserved As Long, _
          ByRef lpType As Long, _
          ByVal lpData As String, _
          ByRef lpcbData As Long) As Long
    
    Private Declare Function RegCloseKey Lib "advapi32" _
         (ByVal hKey As Long) As Long
    Thank you.
    Check the API call support for .NET MSDN. They have changed the syntax for calling API's. Also you may not need to use APIs at all. They have wrapped up lot of APIs in the form of classes and most of the registry APIs are already available using .NET classes.

  3. #3
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    change longs to integers
    \m/\m/

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by PT Exorcist
    change longs to integers
    I don't think so , long is long . Forget about that and use Registery class and Win32 Class . It's more more eaiser .

  5. #5

    Thread Starter
    Member Penavin's Avatar
    Join Date
    Oct 2001
    Location
    Sisak, Croatia
    Posts
    42
    Hi!
    Yes, with Int32 is better, but I still can't obtain desired result. Function returns '2' and I am happy only with '0'
    Penavin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width