call 3rd parity dll with CreateObject
-
hiho, I've got 3rd parity dll and want to bind them in my code with "CreateObject". with "dim t as new dll.klasse" it runs but not with "CreateObject". The Code of the dll is not managed c++ code and i don't have the source code
CreateObject will NOT let you do something like
Dim t As New MyClass
. CreateObject is used for late-bound creation of objects. In order to create objects usingDim
, you have to add a reference to the .DLL and this will only work if the .DLL is COM-based. So, how you can use this .DLL depends entirely on the .DLL and the version of VB you're using. You can't just use it "the way you want to".Dave Kreskowiak Microsoft MVP - Visual Basic
-
CreateObject will NOT let you do something like
Dim t As New MyClass
. CreateObject is used for late-bound creation of objects. In order to create objects usingDim
, you have to add a reference to the .DLL and this will only work if the .DLL is COM-based. So, how you can use this .DLL depends entirely on the .DLL and the version of VB you're using. You can't just use it "the way you want to".Dave Kreskowiak Microsoft MVP - Visual Basic
-
sry, i mean wat u say.. i declare a variable with dim t as object and then i want to set the variable with Set t = CreateObject("mydll.myclass"). but it diddn't run
Is the .DLL a COM-based DLL and is it registered, using REGSVR32? If not, you can't use CreateObject. CreateObject can only be used to create COM-based objects. You can't just specify a .DLL filename and some name. You MUST use the COM-exposed name (ProgID) of the object in the library you want.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
Is the .DLL a COM-based DLL and is it registered, using REGSVR32? If not, you can't use CreateObject. CreateObject can only be used to create COM-based objects. You can't just specify a .DLL filename and some name. You MUST use the COM-exposed name (ProgID) of the object in the library you want.
Dave Kreskowiak Microsoft MVP - Visual Basic
yes the dll is registered. i've searched in the registry and found the clsid with progid.. but when i use them.. it dosen't run. The Name of the ProgID is "BARCODE.BarcodeCtrl.1" and the class name is "Barcode". When i call "Set myVar = CreateObject("BARCODE.BarcodeCtrl.1.Barcode")" then i get the error.. .. i've even tested without the class.. and it runs!! but i'm not sure with object i've get.. i hope it was the barcode-class object
-
yes the dll is registered. i've searched in the registry and found the clsid with progid.. but when i use them.. it dosen't run. The Name of the ProgID is "BARCODE.BarcodeCtrl.1" and the class name is "Barcode". When i call "Set myVar = CreateObject("BARCODE.BarcodeCtrl.1.Barcode")" then i get the error.. .. i've even tested without the class.. and it runs!! but i'm not sure with object i've get.. i hope it was the barcode-class object
You can only use the ProdID, without appending the class name:
Set myvar = CreateObject("BARCODE.BarcodeCtrl.1")
That should represent the COM object (class) that you're looking for.
Dave Kreskowiak Microsoft MVP - Visual Basic