Jump to content
Sign in to follow this  

help calling DLL.

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 ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Array.au3>

Global $hdll

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

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

;~      Return $aResult[0]
;~  EndIf

EndFunc   ;==>OmPlrOpen

Thanks in advance

Share this post

Link to post
Share on other sites

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...