AnsweredAssumed Answered

vrf VB 101

Question asked by VRFuser on Nov 12, 2003
> Any good examples?

The easiest thing to do is an Automation Library. Start a new project, and
pick ActiveX DLL from the wizard. In the Project Explorer, select Project1.
In the Properties window, select (Name) and type Adder. Next, in the Project
Explorer, click on Class1. In the Properties window, click on (Name) and
type AdderCls.

Now, over in the code window, type:

Public Function Add(Data() As Long) As Long

Hit the down arrow and add:

Dim i As Integer
For i = LBound(Data) To UBound(Data): Add = Add + Data(i): Next i

Click the floppy disk on the tool bar, pick a place for your files and hit
Enter. Then hit Alt-F k Enter. Congratulations, you've just made an
Automation Library. VB has already registered your library for you.

Open VEE and plop a Formula object down on the workspace. Get rid of the A
input and expand it to hold a few lines of code. Add an output terminal
named adder. Then type in the formula:

Set adder = CreateObject("Adder.AdderCls");
adder.Add([1, 2, 3, 4]);

Click on the workspace and press Ctrl-G, double click the Result pin and low
and behold, you see the value 10.

I remember reading somewhere about how to make a "regular" dll to, but I
can't remember the details now. You start with a standard exe, delete any
forms, set the startup object to your dll startup function and change a few
other things in the project properties. This is where memory is hazy.
Anyway, public functions wind up in the export table. They're all __stdcall
if I recall correctly, but I don't remember if the names wind up getting
mangled or not.
-SHAWN-


---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".

Outcomes