Post by D.J.Peters on Jun 14, 2010 23:49:24 GMT 1
First test of the MS ScriptContol with GB32.
Joshy
"ScriptControlTest.g32"
Joshy
"ScriptControlTest.g32"
Global Const address = "http://www.microsoft.com/downloads/details.aspx?familyid=d7e31492-2595-49e6-8c02-1426fec693ac&displaylang=en"
Declare FunctionA ShellExecute Lib "shell32.dll" ( _
ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Dim Script As Object
'##E#
LoadForm frmMain
Do
Sleep
Loop Until IsNothing(Me)
Sub frmMain_Load()
Try
Set Script = CreateObject("ScriptControl")
Catch
If 6 = MsgBox( _
"Do you wish to download the missing script control ?", _
MB_APPLMODAL | MB_ICONHAND | MB_YESNO , _
"Error:CreateObject(""ScriptControl"")" )
ShellExecute(0, "Open", address, "", "", SW_SHOW)
End If
End
End Catch
Dim strCode = _
"Sub Main " #13#10 & _
" dim i,j " #13#10 & _
" frmMain.Caption = "#34"Caption set by script"#34 & #13#10 & _
" MsgBox ""Hallo Welt"",,""Message from Script!"" " & #13#10 & _
"End Sub" & #13#10
Code.Text = strCode
Script.AllowUI = True
Script.UseSafeSubset = False
Script.Language = "VBScript"
Script.AddObject "frmMain", frmMain, True
Try
Script.AddCode Code
Catch
MsgBox "error: AddCode ! " & Err$(Err)
Debug.Print "script error: " & Str$(Script.Error.Description)
EndCatch
End Sub
Sub frmMain_Close(Cancel?)
If !IsNothing(Script) Then
Set Script = Nothing
End If
End Sub
Sub cmdRun_Click()
Try
Script.Run "Main"
Catch
MsgBox "error: Run() ! " & Str$(Script.Error.Description)
EndCatch
End Sub
$DatFile
$FormVersion = 2
:{frmMain 193
EAAAQTVRAAzEFBAp1YEAoshRBBQFAIRpAAABNNFIThWZsxGIEx2ZAAAAAgAAAA4DAAAgAQVZzRHI
m9mcgM1YylGc0N0buRncvxGAAEAAHAAgAAwYtRmU15GADAAAlWUAAbcRAAglEBAAWQkFAEoc15GI
zNmcpBHdAAAAAAAAAEQAD9GZlBwCAAAtDFAAwNEAAAfRAgHtFpCABCAAAAQBAAAgRAPAAQwQvVnc
pVmcg4UZ3BAAAMAAAAQA+////BAAAA==
$ExeName = ScriptControlTest.Exe
$LanguageId = 0407
$DatFile