I'm having issues in getting thinCore.dll working with Visual Basic 6.0
Option Explicit
' Microsoft Visual Basic 6.0 (SP6)
' Windows 10 [Version 10.0.19045.3693] 22H2
'
' AddIn Used - Visual Basic 6 IDE Linker Addin
' - LinkSwitches /SUBSYSTEM:CONSOLE
' Ref: https://www.vbforums.com/showthread.php?866321-VB6-IDE-Linker-AddIn
'
' Ref: https://github.com/ErosOlmi/ThinBASIC_On_GitHub/blob/master/Lib/thinCore.INC
' thinCore.dll is in my App.Path folder
Declare Function thinBasic_Init Lib "thinCore.dll" (ByVal hWnd As Long, _
ByVal cInstance As Long, _
ByVal sKey As String) As Long
Declare Function thinBasic_Release Lib "thinCore.dll" (ByVal hScript As Long) As Long
Declare Function thinBasic_Run Lib "thinCore.dll" (ByVal hScript As Long, _
ByVal sBuffer As String, _
ByVal BufferType As Long, _
Optional ByVal Options As Long, _
Optional ByVal DebugMode As Long, _
Optional ByVal LogMode As Long, _
Optional ByVal ObfuscateMode As Long, _
Optional ByVal CallingProgram As Long, _
Optional ByVal DependancyMode As Long) As Long
Dim Con As New Console
Dim hScript As Long
Dim sScript As String
Dim hRun As Long
Const thinBasic_BufferType_IsFile = 0
Sub Main()
On Error GoTo CatchError
sScript = "E:\Documents\vb6\ThinBasic\Alert.tBasic"
Con.OutStd ("App.hInstance = " + Str$(App.hInstance))
Con.OutStd ("App.Path = " + App.Path)
Con.OutStd ("Init")
hScript = thinBasic_Init(0, App.hInstance, "")
Con.OutStd ("Run")
hRun = thinBasic_Run(hScript, sScript, thinBasic_BufferType_IsFile, 1 Or 2, False, False, False, 1, False)
'Program quits here
'From IDE: Run-time error '0'
'From EXE: No error, Alert.tBasic is not run
'
'Output:
'App.hInstance = 4194304
'App.Path = E:\Documents\vb6\ThinBasic
'Init
'Run
Con.OutStd ("Release")
thinBasic_Release (hScript)
Exit Sub
CatchError:
Con.OutStd (Err.Number)
Resume Next
Return
End Sub
The program quits when thinBasic_Run is called.
I have probably missed something in the translation of the Declare functions.
Constructive assistance would be appreciated.
Joe
Bookmarks