Word 97 Add-In (WLL)

B

Bill E

Can anyone tell me if it's possible to build a Word 97 Add-
In (WLL) using VB 6.0 instead of C++?
 
J

Jonathan West

As far as I know, it is not possible. I believe the WLL architecture uses
interfaces to Word which are not supported by VB.
 
B

Bill E

Thanks Jonathan. That's pretty much what I'm gathering
from Microsoft, but I'm still holding out hope.

VB 6.0 can build a dll file, so what's the difference
which language the dll is built in?

Bill
 
J

Jonathan West

VB6 can only build ActiveX (COM) DLLs, not the conventional C DLLs which the
Windows API and the earlier versions of Office use. You can build COM
add-ins using VB, but I believe they only work with Word 2000 or later.
 
B

Bill E

Well, that pretty much solved that. One more question,
could I write a C DLL wrapper that calls my VB ActiveX DLL?

Bill
 
L

Lars-Eric Gisslén

Bill,

VB can't create plain Win32 DLL's with exported functions that you call by a
function pointer, as far as I know. VB create ActiveX DLL's that you call
via Windows COM layer. Typically you call the IDispatch interface of the
ActiveX DLL.

To call a function (at low level) in a plain DLL the code would look
something like this:
pDLL := LoadLibrary("MyDLL.DLL")
pFunc := GetProcAddress(pDLL, "MyDLLFunction")
nResult := PCALL(pFunc, "Param1", Param2")

For an ActiveX DLL:
nResult := CoCreateInstance(pGUID,NULL_PTR,CLSCTX_INPROC_SERVER,pInterfId,
@pResult)
pResult will be the be a pointer to the Interface, IDispatch or IUnknown,
depending on that you pass in pInterfId

So, at low level there is a big difference between calling a plain DLL and
an ActiveX DLL.

Regards,
Lars-Eric
 
B

Bill E

Thanks Lars, did you see my other question about writing a
C DLL wrapper to call the com dll? Is that possible?

Bill
 
L

Lars-Eric Gisslén

Bill,

I wrote a WLL ones but that are several years ago now. If you have looked
into writing a WLL I think you have realized how complex it is call to the
one function interface to Word. If you have set up all the structures with
all unions and figured out how to set up the memory for retrieving responces
from Word, then I'm not sure you would win so much by using a WLL as proxy
to an ActiveX DLL. You have the worst job done anyway so I think you could
write it all in C. But, I think it would be possible, you instanciate the
ActiveX DLL in the WLL and use the WLL as a proxy to the ActiveX but the
ActiveX would call Word directly but I don't think you will get away from
the complex interface between Word and the WLL.

Regards,
Lars-Eric
 
C

Chango Valtchev

I'm stepping into the game a bit late...
We have a large project compiling into a WLL (written in VC++ 6, of course).
The COM Add-In interface is preferable, but if you must support Word 97, a
WLL will suffice too. It doesn't have any complex interface, hardly any
interface at all, hence some difficulties you might have, in particular
initially obtaining the Word.Application reference, but that's doable too. A
WLL is a regular Windows DLL plus two special functions: wdAutoOpen and
wdAutoRemove, which just let you do some setup/shutdown. No more, no less.
If VB can't produce regular Windows DLLs, you can definitely create a simple
C/C++ wrapper for your "ActiveX" DLL: You instantiate the COM object,
similarly to how Lars-Eric showed, and then delegate the actual handling to
it. In fact, it may suffice to do this only once, on startup, when you set
up toolbars, menus and/or Application/Document object events. The handlers
of all these commands/events can be directly in your VB DLL.
Good luck.

// Chango
 
L

Lars-Eric Gisslén

Chango,

When I did the WLL it was during the early 90's and was for Word 2.0 or
perhaps the early days of Word 6 (there was a big jump in version numbering
after 2.0, I guess it was because WordPerfect was on version 6 then.). The
WLL was mainly a databas interface but also a kind of mailmerge utility (and
some more) with connection to databases with Wizards and dialogs. We
actually controlled Word from the WLL and what I remember it was a lot of
trial and error when setting up the different structures and populating
different members with the correct data for different kind of calls to Word.
Also mapping the responses from Word to the correct structures could also be
something you easily made misstakes in. Well, that is almost forgotten days
now.

Regards,
Lars-Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top