Hallo!
Ich versuche gerade, einen VBA-Code nach AutoIt umzuschreiben. Jedoch stoße ich hier an meine Grenzen. Wie müsste das in AutoIt aussehen?? Vielleicht kann man das auch ohne Excel umschreiben? SetCurrentDirectory und LoadLibrar sind kein Problem. Aber ab jabPic.InputString komme ich nicht weiter (da muss man ja Type jabDTO und Dim jabPic As jabDTO umschreiben können). Danke!
Code: VBA
Type jabDTO
InputString As String
FileName As String
ColorNumber As Long
SymbolNumber As Long
ModuleSize As Long
MasterSymbolWidth As Long
MasterSymbolHeight As Long
SymbolPositions() As Long 'Liste
SymbolPositionsNumber As Long
SymbolVersionsX As Long
SymbolVersionsY As Long
SymbolVersionsNumber As Long
SymbolEccLevels() As Long 'Liste
SymbolEccLevelsNumber As Long
ColorSpace As Long
End Type
Private Declare Function writeToTmpFile Lib "jabwrapper.dll" (ptrFoo As jabDTO) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal GetModuleHandle As String) As Long
Private Declare Function SetCurrentDirectoryA Lib "kernel32" (ByVal lpPathName As String) As Long
Sub CreateJABCode(strName As String, strText As String, Optional bolUF As Boolean = False, Optional lngModuleSize As Long = 8, _
Optional lngECCLevel As Long = 0, Optional lngColorNumber As Long = 8, Optional lngXPos As Long = 1, Optional lngYPos As Long = 1)
On Error GoTo Zwei
Start:
Dim strPicPath As String
Dim strPicName As String
Dim jabPic As jabDTO
Dim lb As Long
'Workaround wenn DLLs nicht registriert worden sind
#If Win64 And VBA7 Then
SetCurrentDirectoryA (ThisWorkbook.Path & "\jabcode\jabcodeWrapper\dlls64")
#Else
SetCurrentDirectoryA (ThisWorkbook.Path & "\jabcode\jabcodeWrapper\dlls32")
#End If
lb = LoadLibrary(ThisWorkbook.Path & "\jabcode\jabcodeWrapper\dlls32\jabwrapper.dll")
jabPic.InputString = strText
jabPic.FileName = ThisWorkbook.Path & "\images\jabcode\" & strName & ".png"
jabPic.ColorNumber = lngColorNumber
jabPic.ModuleSize = lngModuleSize
jabPic.SymbolVersionsX = lngXPos
jabPic.SymbolVersionsY = lngYPos
jabPic.SymbolEccLevelsNumber = lngECCLevel
strPicPath = writeToTmpFile(jabPic)
With Sheets("JAB-Code").Image1
.Picture = LoadImage(ThisWorkbook.Path & "\images\jabcode\" & strName & ".png")
.AutoSize = True
End With
Do Until lb = 0
FreeLibrary lb
If CBool(Err.LastDllError) Then
MsgBox "dll error" & " " & Err.LastDllError
Err.Clear
Exit Do
End If
lb = 0
lb = GetModuleHandle(ThisWorkbook.Path & "\jabcode\jabcodeWrapper\dlls32\jabwrapper.dll")
Loop
Ende:
Exit Sub
Zwei:
GoTo Start
End Sub
Alles anzeigen
JAB-Code-Projekt: https://github.com/jabcode/jabcode
Gruß, René