|
| 1 | +VERSION 5.00 |
| 2 | +Object = "{FBE17B58-A1F0-4B91-BDBD-C9AB263AC8B0}#78.0#0"; "scivb_lite.ocx" |
| 3 | +Begin VB.Form Form1 |
| 4 | + Caption = "Form1" |
| 5 | + ClientHeight = 9825 |
| 6 | + ClientLeft = 60 |
| 7 | + ClientTop = 345 |
| 8 | + ClientWidth = 11010 |
| 9 | + LinkTopic = "Form1" |
| 10 | + ScaleHeight = 9825 |
| 11 | + ScaleWidth = 11010 |
| 12 | + StartUpPosition = 3 'Windows Default |
| 13 | + Begin VB.TextBox txtOut |
| 14 | + BeginProperty Font |
| 15 | + Name = "Courier" |
| 16 | + Size = 9.75 |
| 17 | + Charset = 0 |
| 18 | + Weight = 400 |
| 19 | + Underline = 0 'False |
| 20 | + Italic = 0 'False |
| 21 | + Strikethrough = 0 'False |
| 22 | + EndProperty |
| 23 | + Height = 2715 |
| 24 | + Left = 135 |
| 25 | + MultiLine = -1 'True |
| 26 | + ScrollBars = 3 'Both |
| 27 | + TabIndex = 4 |
| 28 | + Top = 6975 |
| 29 | + Width = 10590 |
| 30 | + End |
| 31 | + Begin VB.CheckBox chkDebug |
| 32 | + Caption = "use debugger" |
| 33 | + Height = 285 |
| 34 | + Left = 9315 |
| 35 | + TabIndex = 2 |
| 36 | + Top = 135 |
| 37 | + Width = 1455 |
| 38 | + End |
| 39 | + Begin VB.CommandButton cmdRun |
| 40 | + Caption = "Run Script" |
| 41 | + Height = 330 |
| 42 | + Left = 7965 |
| 43 | + TabIndex = 1 |
| 44 | + Top = 135 |
| 45 | + Width = 1185 |
| 46 | + End |
| 47 | + Begin SCIVB_LITE.SciSimple scivb |
| 48 | + Height = 5865 |
| 49 | + Left = 135 |
| 50 | + TabIndex = 0 |
| 51 | + Top = 585 |
| 52 | + Width = 10725 |
| 53 | + _ExtentX = 18918 |
| 54 | + _ExtentY = 10345 |
| 55 | + End |
| 56 | + Begin VB.Label Label1 |
| 57 | + Caption = "Output" |
| 58 | + Height = 240 |
| 59 | + Left = 90 |
| 60 | + TabIndex = 3 |
| 61 | + Top = 6615 |
| 62 | + Width = 1860 |
| 63 | + End |
| 64 | +End |
| 65 | +Attribute VB_Name = "Form1" |
| 66 | +Attribute VB_GlobalNameSpace = False |
| 67 | +Attribute VB_Creatable = False |
| 68 | +Attribute VB_PredeclaredId = True |
| 69 | +Attribute VB_Exposed = False |
| 70 | +Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long |
| 71 | +Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long |
| 72 | + |
| 73 | + |
| 74 | +Private Declare Function run_script Lib "sb_engine" (ByVal lpLibFileName As String, ByVal use_debugger As Long) As Long |
| 75 | +Private Declare Sub GetErrorString Lib "sb_engine" (ByVal iErrorCode As Long, ByVal buf As String, ByVal sz As Long) |
| 76 | +Private Declare Sub SetVBStdout Lib "sb_engine" (ByVal callback As Long) |
| 77 | + |
| 78 | +Dim loadedFile As String |
| 79 | +Dim hsbLib As Long |
| 80 | + |
| 81 | + |
| 82 | +Private Sub cmdRun_Click() |
| 83 | + Dim rv As Long |
| 84 | + Dim buf As String |
| 85 | + |
| 86 | + txtOut.Text = Empty |
| 87 | + SetVBStdout AddressOf vb_stdout |
| 88 | + rv = run_script(loadedFile, chkDebug.Value) |
| 89 | + |
| 90 | + Me.Caption = "run_script() = " & rv & " - " & Format(Now, "m:s:ss AM/PM") |
| 91 | + |
| 92 | + If rv <> 0 Then |
| 93 | + buf = String(255, " ") |
| 94 | + Call GetErrorString(rv, buf, 255) |
| 95 | + MsgBox buf |
| 96 | + End If |
| 97 | + |
| 98 | +End Sub |
| 99 | + |
| 100 | +Private Sub Form_Load() |
| 101 | + |
| 102 | + hsbLib = LoadLibrary(App.Path & "\engine\sb_engine.dll") |
| 103 | + |
| 104 | + If hsbLib = 0 Then |
| 105 | + MsgBox "Failed to load sb_engine.dll by explicit path?" |
| 106 | + End If |
| 107 | + |
| 108 | + loadedFile = App.Path & "\scripts\com_voice_test.sb" |
| 109 | + scivb.LoadHighlighter App.Path & "\dependancies\vb.bin" |
| 110 | + scivb.LoadFile loadedFile |
| 111 | + |
| 112 | + |
| 113 | +End Sub |
| 114 | + |
| 115 | +Private Sub Form_Resize() |
| 116 | + On Error Resume Next |
| 117 | + With scivb |
| 118 | + .Width = Me.Width - .Left - 200 |
| 119 | + '.Height = Me.Height - .Top - 500 |
| 120 | + End With |
| 121 | +End Sub |
| 122 | + |
| 123 | +Private Sub Form_Unload(Cancel As Integer) |
| 124 | + FreeLibrary hsbLib |
| 125 | +End Sub |
0 commit comments