HOWTO: Use VB6 ActiveX dll in Lotus Notes R5?

How do you declare and use an ActiveX dll that was written in VB6 inside of notes?  Do you have to write the VB6 dll in a special way?  How do you declare the dll in Notes and access the functions in the dll?  Examples would be nice...
lduke68Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ghassan99Commented:
just use the following to declare the function:
Declare [ Public | Private ] { Function | Sub } LSname Lib libName [ Alias aliasName ]
          ( [ argList ] ) [ As returnType ]

ex:

Declare Function StrFun Lib "lib.dll" _
   (amLStr As LMBCS String) As String

Check the help in notes for more info, under 'Declare' keyword.
0
rammeriCommented:
Hi,

even though I'm not a notes-developer (yet ;)) I'm sure to know vb.

Of course you can't use "Declare Function ...." because you don't get a normal-DLL but an ActiveX-Dll.

Isn't there something like CreateObject("") in Notes?

Cheers,
Ingo
0
ghassan99Commented:
I created a DLL before in VC++, and declare worked.  Maybe u r right, in that aspect though.  CreateObject exists in notes to support OLE automation.

-Gus
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

rammeriCommented:
ghassan99: Of course you're right, because you did a standard-DLL. In Visual Basic you can ONLY create ActiveX-DLLs.

Therefore you can only access the Classes via

set x = createobject("<PROGID>")

whereas ProgID is for VB-Projects:
<PROJECTNAME>.<CLASSNAME>

fe.

set x = createobject("Project1.Class")

Then you should be able to do a
x.FooBar

(at least that's how it is accessed from VB-Like languages ... LotusScript-Syntax should be similar)

Cheers,
Ingo
0
ghassan99Commented:
yes u r right, ActiveX DLLs in VB are based on COM, and they need to be instantiated before using their methods.  Im not sure if your solution above will work in earlier Notes releases (although it is reasonable) but the new Notes release (502c I think) fully supports COM, I believe it will work.

-Gus
0
stampCommented:
Here my call from LotusScript in Release 4.6.3a which worked corrctly:
Set xlApp = CreateObject("Excel.application")
xlApp.Visible = False
xlApp.Workbooks.Add
..
..
..

More infos on this you can find here:
http://www.notes.net/today.nsf/f01245ebfc115aaf8525661a006b86b9/27e234ca2b0b30798525684e00574a54?OpenDocument

This link is to a good article from Iris about COM. There you can finde
a link to this toolkit for COM:
http://www.lotus.com/rw\dlcomtk.nsf/Kits/96C695FD78D851E2852568480077D889?OpenDocument

Regars,
stamp
0
maffud71Commented:
Create the activex dll using at least one class.  If you only need a function, just make it a method of the class.
Register the activex dll by using regsvr32 "activex.dll"

Then just instantiate the object using:
createobject("PROJECTID.CLASSNAME")
(note: projectID is defined in the project properties dialog.)

There is no need to "declare" the class.

e.g., if you named the project "myproject" and the class "myclass", your LotusScript code might look like this:

dim x as object
dim z as string
dim ans as string

z = "parameter"
set x = creatobject("myproject.myclass")

ans = x.myfunction(z)


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.