CVBGnuPlot Class

This class it's intended to ease  the interface between a VB program and Gnuplot software.

CVBGnuplot class do all the communication between the VB code and gnuplot executable. The communication is made by windows API function PostMessage , something similar of visual basic command SendKeys, although this class encapsulate all API windows function, automatically run and shutdown gnuplot plot executable and find  gnuplot  main command window. All the communication is made as the user was typing inside gnuplot command window. This kind of interprocesses communication it's little bit outdated in windows programming, but in the future windows version of gnuplot can implement a COM interface and this class will not be needed.

Remarks

Each instance of CVBGnuplot class run another instance of gnuplot executable. You must enable error handling (On Error Goto ... ) before calling CVBGnuplot  methods because this class can raise exceptions if something wrong happened.

This class does not capture any errors that gnuplot displays, the only way to know if you sent an invalid command to gnuplot is to open gnuplot command window.

Properties

GnuPlotFileName 

Data type: String

Complete path and file name of gnuplot executable.

IsRunning

Data type: Boolean

This property returns true if gnuplot is running.

Remarks

This property works only if the same executable that was opened during a call to StartGnuplot is running. If another instance of gnuplot is running this function returns False.

Methods

StartGnuPlot()

This method starts gnuplot executable. Set gnuplot executable file path before calling this function. This function do nothing if you alredy called this function once.

StopGnuPlot()

This method stops (closes)  gnuplot executable. This function is automatically called when the object is destructed.

Send(ByVal sText As String)

Use this method to send a gnuplot plot commad from your VB code.

sText - string with gnuplot command.

Example

Dim objVbGnuPlot  As  CVBGnuPlot

Set objVbGnuPlot = New CVBGnuPlot

objVbGnuPlot.GnuPlotFileName = "E:\math\gnuplot32\wgnupl32.exe"

objVbGnuPlot.StartGnuPlot 'initialize gnuplot executable

'This is basic function to send gnuplot commands.
objVbGnuPlot.Send "plot sin(x)"

objVbGnuPlot.StopGnuPlot ' you do not need to call this method if you wish that gnuplot executable reamains opened.

Set objVbGnuPlot = Nothing

    Home