Results 1 to 3 of 3

Thread: NullReferenceException When calling a API

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    13

    NullReferenceException When calling a API

    ASPI Declaration:

    Code:
    DWORD __stdcall SendASPI32CommandEx(LPSRB psrb)
    	{
                     // code
    	}
    VB Code:
    1. 'API Declaration
    2.     <DllImport("ASPIshim", EntryPoint:="SendASPI32CommandEx")> _
    3.     Public Function SendASPI32InquiryEx(ByVal hSRB As SRB_HAInquiry) As Integer
    4.     End Function

    VB Code:
    1. 'Calling----->
    2.  
    3.         MsgBox(modASPI.GetASPI32SupportInfoEx())
    4.  
    5.         Dim y As New modASPI.SRB_HAInquiry
    6.  
    7.         MsgBox(modASPI.SendASPI32InquiryEx(y)) '<---- NullReference Occurs here

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Does modASPI.SRB_HAInquiry return some sort of default value? y is declared but not set to a value.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    13
    VB Code:
    1. 'API Declaration
    2.     <DllImport("ASPIshim", EntryPoint:="SendASPI32CommandEx")> _
    3.     Public Function SendASPI32InquiryEx(ByVal hSRB As SRB_HAInquiry) As Integer
    4.     End Function

    should have been...

    VB Code:
    1. 'API Declaration
    2.     <DllImport("ASPIshim", EntryPoint:="SendASPI32CommandEx")> _
    3.     Public Shared Function SendASPI32InquiryEx(ByRef hSRB As SRB_HAInquiry) As Integer
    4.     End Function

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