• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 552
  • Last Modified:

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...
0
lduke68
Asked:
lduke68
1 Solution
 
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
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
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

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now