Jump to content

help calling DLL.


devilyn
 Share

Recommended Posts

i need help calling DLL.

VB Example

VB Declaration (USBmAPI.bas)

Public Declare Function USBm_Version _
    Lib "USBm.dll" _
        (ByVal versionstring As String) _
    As Integer
VB Example

Dim strng As String * 255
Dim result As Integer

    result = USBm_Version strng
    frmStatus.lstDevices.AddItem "About the USBm DLL: " & strng

this is what i got up to now. but it's crashing every time i run it

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Array.au3>

Global $hdll
OpenAPI()
GetVer()

Func OpenAPI()
    $API = "USBm.dll"
    If $hdll <> 1 Then
        $hdll = DllOpen($API)
        ConsoleWrite($hdll&@CRLF)
        If $hdll = 1 Then
            ConsoleWrite("+ Dll Opened OK " & @CRLF)
            $DLLVersion = FileGetVersion($API)
            If $DLLVersion <> "6.1.0.0" Then
            ;MsgBox(16, "Warning", "This Program was created for API version 6.1.0.0 this may not work for you. "&"("&$DLLVersion&")")
            EndIf
        Else
            ConsoleWrite("! Error Opening OK " & @CRLF)
        EndIf
    EndIf
EndFunc   ;==>OpenOMAPI

Func GetVer()
Local $Return
    $aResult = DllCall($hdll, "str", "USBm_Version")
    _ArrayDisplay($aResult)
;~  If $aResult[0] = 0 Then
;~      ConsoleWrite("+ Handle = " & $aResult[3] & @CRLF)
;~      Return $aResult[3]
;~  Else

;~      Return $aResult[0]
;~  EndIf

EndFunc   ;==>OmPlrOpen

Thanks in advance

Link to comment
Share on other sites

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...