API found in C# but not VB?

Discussion in 'C#' started by iwdu15, Sep 29, 2006.

  1. iwdu15

    iwdu15 New Member

    Joined:
    Sep 29, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    i really hope im just overlooking something very simple bc i have an API call in VB.net that doesnt work, yet the same call in C# works....in VB i get an error saying the Entry Point cannot be found....code below
    Code:
    [DllImport("setupapi.dll", SetLastError=true)]
                    static extern  unsafe int SetupDiGetDeviceInterfaceDetail(
                            int  DeviceInfoSet,
                            ref SP_DEVICE_INTERFACE_DATA lpDeviceInterfaceData,
                            int* aPtr,
                            int detailSize,
                            ref int requiredSize,
                            int* bPtr);
    
                    [DllImport("setupapi.dll", SetLastError=true)]
                    static extern  unsafe int SetupDiGetDeviceInterfaceDetail(
                            int  DeviceInfoSet,
                            ref SP_DEVICE_INTERFACE_DATA lpDeviceInterfaceData,
                            ref PSP_DEVICE_INTERFACE_DETAIL_DATA                                                                                                                                                                         myPSP_DEVICE_INTERFACE_DETAIL_DATA,
                            int detailSize,
                            ref int requiredSize,
                            int* bPtr);
    
    SetupDiGetDeviceInterfaceDetail(
                                    hDevInfo,                                                      
                                    ref mySP_DEVICE_INTERFACE_DATA,        
                                    null,                                                          
                                    DeviceInterfaceDetailDataSize,          
                                    ref RequiredSize,                                      
                                    null);
    
    Friend Declare Function SetupDiGetDeviceInterfaceDetail Lib "setupapi.dll"
    (ByVal DeviceInfoSet As Integer, _
    
       ByRef lpDeviceInterfaceData As SP_DEVICE_INTERFACE_DATA, _
    
       ByRef myPSP_DEVICE_INTERFACE_DETAIL_DATA As
    PSP_DEVICE_INTERFACE_DETAIL_DATA, _
    
       ByVal detailSize As Integer, ByRef requiredSize As Integer, _
    
       ByRef bPtr As Integer) As Integer
    
        Friend Declare Function SetupDiGetDeviceInterfaceDetail Lib
    "setupapi.dll" (ByVal DeviceInfoSet As Integer, _
    
       ByRef lpDeviceInterfaceData As SP_DEVICE_INTERFACE_DATA, _
    
       ByRef aPtr As Integer, ByVal detailSize As Integer, _
    
       ByRef requiredSize As Integer, ByRef bPtr As Integer) As Integer
    
         Dim results As Integer = SetupDiGetDeviceInterfaceDetail(hDevInfo,
    myInfo, myPspInfo, DeviceInterfaceDetailDataSize, _
    RequiredSize, Nothing)
    --
    -iwdu15
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice