
Note: I now have a complete open source js engine done in vb6/c

https://github.com/dzzie/js4vb

The active script interfaces however are built in to windows and require no dependancies
but they are only ES3 syntax.

--> MAKE SURE YOU REGISTER THE TLB FILE <--

If you down know how..google for "tlb reggie register" reggie is a free
tlb registration program you can find on the net..adds right click option 
for it.

This is a VB only implementation of IActiveScript which lets you integrate 
scripting support in your apps without the need for the MSScript control.

I started working on this because I wanted to work torwards adding full
IActiveScript support including debugging because the MS Script control
sometimes isnt enough.

Anyway, this is the first step. It may not be 100% perfectly implemented 
but it runs and works with objects you pass to it. 

You are free to use it in any commercial or non commercial applications 
as you so desire. Only a brief line "This product contains software written by
David Zimmer" is required.

Enjoy


ps - if you want to see a C activex control that you can use from VB with
debugging support check out ken fousts citrus debugger 

http://sandsprite.com/CodeStuff/CitrusDebugger.7z

For the brave of heart, I also started to try implementing the iActiveScript
debug interfaces directly in VB. You can get a copy here:

http://sandsprite.com/CodeStuff/vbActiveScript_wDbg_incomplete.zip

Currently I have ditched the MS Script engine completely and am now using
DukTape javascript engine 1mb self contained complete with debug support.
search my site or web for duk4vb.

____________________________________

calude review:

I found one definite bug:

**In `vbActiveScript_support.inc`, line 59:**
```c
BSTR dwHelpContext;   // WRONG
```

Should be:
```c
LONG dwHelpContext;   // CORRECT
```

The `dwHelpContext` field in `EXCEPINFO` is a `DWORD`/`LONG`, not a `BSTR`. This is a struct layout bug that will corrupt the structure alignment and cause problems when the script engine tries to read/write exception info.

---

**One other subtle issue** in `clsActiveScript.cls` line 111-133: In `GetItemInfo`, you're returning `ObjPtr(IDisp)` without an explicit `AddRef`. COM convention for `[out]` interface pointers requires the callee to AddRef before returning. VB6's implicit ref counting *usually* makes this work, but it's technically relying on timing. If you ever see random crashes or objects getting freed prematurely, this could be the culprit. A safer approach would be calling `AddRef` on the returned pointer explicitly (via a declared function), but in practice VB6 often gets away with this pattern.

----------------------

To compile the tlb <---

mktyplib /tlb vbActiveScript_3.tlb vbActiveScript_3.ODL

Or if using MIDL (newer):

midl /mktyplib203 vbActiveScript_3.ODL
The /mktyplib203 flag tells MIDL to behave like MKTYPLIB for compatibility with older ODL syntax.


