PluginAPIVBNet

Introduction

This is a Visual Basic .Net class that allows easy interfacing to the Swordfish Plugin API. It provides properties and methods, as well as events to handle messages from the Swordfish IDE. The class has been developed with Microsoft Visual Basic 2008 Express Edition. Download the class module below and then insert into your Visual Basic project (instructions below).

Download Class Module (right-click and 'Save Target As') »

Instructions

1. Add the class to your project by right-clicking on the project in the Solution Explorer and adding an existing item...

2. You should now have a copy of SwordfishIDEPlugin.vb in your project.

3. In your form code, add a reference to the plugin class, using 'Dim WithEvents SF As New SwordfishIDEPlugin' - use the WithEvents switch to allow access to the Swordfish IDE events.

4. To allow access to the IDE through the API, you need first to connect to the IDE. This could be done in the form load event. You need to pass the window handle to the Connect function, using 'SF.Connect(Me.Handle)'. Note that the class provides context help with use and parameters for each property, method and event.

5. You must also add code to disconnect from the IDE when your plugin closes.

6. Note that the plugin will not connect to the IDE if run from within the Microsoft Visual Studio development environment. Instead, the exe must be run from within the Swordfish IDE as a plugin. You will need to add your application to the IDE using the Plugin Editor in Swordfish.

7. To respond to Swordfish IDE messages, declare your own subroutines to handle an event, e.g. 'Private Sub PreCompile() Handles SF.PreCompile'.

Example

Download an example showing the use of all of the class properties, methods and events (written in Microsoft Visual Basic 2008 Express Edition).

Download Example Project »