An error occurred in script '/home/yhr1ef23xez5/public_html/web2/app/model/bannerhit.php' on line 17:
Undefined index: HTTP_REFERER

    [type] => solution
    [name] => subroutine-script

WinWrap® | Call a Subroutine Macro
logo WinWrap®

Call a Subroutine Macro

WinWrap® Basic is an embedded macro language component available for .NET and COM 32/64 bit Windows applications. The WinWrap® Basic Component is an alternative to Visual Basic for Applications (VBA), ActiveX (e.g. VBScript, JScript, PerlScript, Rexx-based WSH engines and others), and VSTA for this purpose. The WinWrap® Basic Component is compatible with VBA, Sax Basic, VB.NET and Visual Basic 6.0 style scripts.

Run a Subroutine Macro Script from Your Windows Application

  • Users can code scripts to customize an application for their particular needs
  • Developers can extend an application without recompiling it
  • Installers can customize an application for a customer or group of customers
  • Capture interactive user input
  • Share information with external applications
  • Use any of thousands of .NET Framework Classes

Call a Script Subroutine

Calling a Subroutine Macro Script from Your Application

The steps for calling a subroutine macro script are straightforward and simple with the WinWrap® Basic's BasicIdeCtl scripting object:

  • Create a handler with the CreateHandler method
  • The subroutine handler is created before the script code is loaded with LoadModule
  • Load the script file containing the subroutine with the LoadModule method
  • Execute the handler's Call method
  • To edit the module script code
    • Set the BasicIdeCtl1 DesignModeVisible property to True
    • Use the EnterDesignMode/LeaveDesignMode events to manage module loading/unloading

Form1.vb - VB.NET Host Application Main Form Code

' Form1.vb - VB.NET Host Application Main Form Code Imports WinWrap.Basic Imports WinWrap.Basic.Classic Public Class Form1 ' A Handler object provides access to a single WinWrap Basic Sub or Function Private hSubHandler As Handler Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load ' Create a Handler that can invoke the module sub hSubHandler = BasicNoUIObj1.CreateHandler("Sub Hello()") If hSubHandler Is Nothing Then Debug.Print("CreateHandler failed") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Load the module by parsing it and preparing it for execution If Not BasicNoUIObj1.LoadModule("c:macrosMacro1.bas") Then Debug.Print("Load failed.") Else If hSubHandler IsNot Nothing AndAlso hSubHandler.Exists Then ' Call the module sub hSubHandler.Call() End If ' Unload the module If Not BasicNoUIObj1.UnloadModule("Macro1.bas") Then Debug.Print("UnloadModule failed") End If End Sub Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed If hSubHandler IsNot Nothing Then ' Release the unmanaged resources and optionally release the managed resources hSubHandler.Dispose() End If End Sub End Class

Macro1.bas - WWB.NET Script Code

' Macro1.bas - WWB.NET (VB.NET Compatible) Script Code '#Language "WWB.NET" Imports System ' Import the .NET Framework "System" Namespace into this macro Sub Hello() Handles .Hello ' Display message including .NET Framework values for Time and MachineName MsgBox "Hello at time " & & " from machine " & Environment.MachineName End Sub

Run the Host Application and Call Macro1.bas

Run the Script Subroutine

See the Following Links for Additional WinWrap® Basic Information

Support for .NET Host and 64-bit Host Applications

.NET Scripting Host
64-Bit Windows

Autocompletion Editor and Powerful Script Debugger

Script Debugger

VB.NET Compatible Scripting

Access .NET Classes and Objects with VB.NET Style Syntax Scripts

Display Custom WinForms from WinWrap® Basic Scripts

Custom WinForms

Globalization and Localization

Available in 16 Languages

Customize Applications

Customize an Application

Upgrade to WinWrap® Basic from Sax Basic or Microsoft Script Control

Sax Basic Compatibility
Upgrade from Microsoft ScriptControl

Copyright Polar Engineering, Inc.