|
-
Oct 29th, 2002, 02:52 PM
#1
Thread Starter
New Member
Referencing a DLL programatically
Is this possible? I've been messing around with this for a bit, but haven't been able to successfully do this.
I have an Active-X DLL called "Rodac.dll". with a class called clsDateEntry, containing a function called UserSelectedDate (with several string variables).
I've successfully gotten it working by referencing the DLL, but I would prefer to remove this necessity.
The following is the code I've tried:
Declare Function UserSelectedDate Lib "C:\Rodac.dll" (ByVal strIncuType As String, ByVal strDate As String, ByVal strIncuNumber As String) As Integer
To call the function:
DateReturn = UserSelectedDate(strIncuType, strDate, strIncuNumber)
Any options? I would also eventually like to move the Declare outside the general statements area, as the actual path to the dll will change.
-
Oct 29th, 2002, 03:17 PM
#2
dim myobj as Object
set myobj = CreateObject("dllname.classname")
myobj is now your referenced object to your dll
-
Oct 29th, 2002, 04:45 PM
#3
Thread Starter
New Member
Originally posted by Cander
dim myobj as Object
set myobj = CreateObject("dllname.classname")
myobj is now your referenced object to your dll
I think I misphrased my question.
I'm not looking to dynamically assign a variable to an already referenced DLL.
I'm looking to reference out to an unreferenced DLL.
(ie, just put myDll.dll on the drive, and reference the location in code without having to register it)
-
Oct 29th, 2002, 04:51 PM
#4
"I'm looking to reference out to an unreferenced DLL."
No you phrased it correctly. That is exaclty what the code I gave you does.
"(ie, just put myDll.dll on the drive, and reference the location in code without having to register it)"
You CANNOT use an ActiveX DLL without registering. There is NO workaround for that.
-
Oct 29th, 2002, 05:06 PM
#5
About as close as you get to not having to register the dll is registering it via code but then you have to have the path. The easiest way is just to shell regsrv32 with the path to the dll. But other than that Cander is right there is no way to avoid registering the dll.
The Declare style you mentioned is for non COM dlls, which VB can't make. Also using Cander's code you don't need to have the dll referenced, just registered.
-
Oct 30th, 2002, 03:14 AM
#6
there is no way to avoid registering the dll
What about using an assembly dll in vb.net, they don't need registering do they? 
If you're using vb6, it's far more efficient to use an object reference rather than the CreateObject() method - your program will use less memory & operate faster.
-
Oct 30th, 2002, 09:25 AM
#7
Originally posted by alex_read
What about using an assembly dll in vb.net, they don't need registering do they? 
They surely do not, except in the case if they needed to be added to the Global Assembly Cache which is for all intents and purposes, registering, but that is of course, not necessary in many cases.
-
Nov 4th, 2002, 08:01 AM
#8
Frenzied Member
You CANNOT use an ActiveX DLL without registering. There is NO workaround for that.
Not strictly true - you could do the work of the SCM yourself - but I wouldn't recommend it . . .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|