Navigation:Inplot <Root level>

ActiveX Pre Process

Send comments on this topic.

 

ActiveX Pre-Process DLL

An ActiveX DLL can be attached to the plot button so that as Inplot goes through the editor, each line can be processed before it is sent to Inplot to be plotted. Every line can be interpreted, changed, or modified -- so it is possible to make a pre-process control that will understand the special codes or variables in the program.

You attach this script to the plot button by putting the name of the control in the machine configuration syntax settings. Every time the plot button is pressed, the script is run for that line.

The ActiveX control must have three functions:

StartDll(S:String):integer;

Step(S:String):integer;

CloseDll:integer;

When Inplot loads the control it calls “Start” function with Class ID string of Inplot so the pre-processor can use it to call Inplot.

Inplot calls the step function with the current line as a parameter every time the Step button is pressed. Inplot does not plot or do anything with this line. The pre-processor would have to send it back to inplot with the “Plot” function to be plotted and processed.

Borland Delphi ActiveX Library Example:

var v:variant; // variable to hold application object

function TMaho.Step(const S: WideString): Integer;

begin

// put any processing of string here

 

// then send it back to Inplot to plot

v.plot(s);

result:=1;

end;

 

function TMaho.StartDll(const S: WideString): Integer;

begin

v:=createoleobject(s);

if vartype(v)=varempty then result:=0 else result:=1;

end;

 

function TMaho.CloseDll: Integer;

begin

application.terminate;

end;

 

Visual Basic ActiveX DLL Example:

Dim swApp As Object ' Define variable used to hold the application object

 

Public Function step(ByVal s As String)

    If swApp Is Nothing Then

       Exit Function

    Else

     ' do any processing of string here

    

     ' then send it back to inplot to plot

     swApp.plot (s)

      ' display it on the inplot prompt line

     swApp.prompt (s)

    End If

End Function

 

Public Function CloseDll()

' Release the object variable

Set swApp = Nothing

maho.Unload

End Function

 

Public Function StartDll(ByVal s As String)

    StartDll = 1

'  This will attach to current Inplot session or start up new session.

    Set swApp = CreateObject(s)

    If swApp Is Nothing Then

     MsgBox ("Pre-Processor Can't Link to Inplot")

     StartDll = 0

     maho.Unload

    End If

End Function

 

ActiveX Controls must be registered with the operating system in order for the programs to find them. Visual Basic will automatically register the DLL when it is made. If you move it to another location or computer, use Run on the start menu to run regsvr32 with the filename.

Example: regsvr32 c:\inplot\maho.dll

To unregister: regsvr32 /u c:\inplot\maho.dll

Entering the name in Configuration: Pre-Processor. For file made in VB, the program ID is in the format: projectname.modulename

For Delphi the program ID is in the format: typelibraryname.projectname

 

See Example Files at web site www.i-logic.com 

 

See Also, Script Pre-Process , OLE Server 

 

_________________________________________________________________

_________________________________________________________________


Copyright © 2020 i-Logic Software