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

How do I call a sub within a DLL from a VbScript?

Ok, I have tried, but I can't get away from all my errors, and I think posting those is making it worse, So please, will soemone tell me the correct way to call a sub in a DLL from a VBScript.

I am not wroking on a web page, I have written all our file transfer scripts into a DLL because I was asked to.  Now in order to run just the one specified program, and not all 64 programs contained wtihint the DLL I need to call teh main function.  

The Project and DLL are named DCSJobs
The Module wtihin the DLL that contains the sub I am calling is Main
The sub I am calling is named Main_CISPAYPX

I am not even going to post what I wrote cause I don't want tot confuse things.
I have never worked with VBScript before, I have been trying to search and find out how to do this, but all I get is errors.  Please help, and please remember I do not know how to work with VB script at all, so please don't assume I know anything :-).
0
Wonderflub
Asked:
Wonderflub
  • 2
2 Solutions
 
EDDYKTCommented:
If you call from VBS make sure all the in and out parameters MUST be declare as variant



ie


public function aa(b as variant, v as variant) as variant
0
 
EDDYKTCommented:

I meant only OUT parameters, not in
0
 
avi247Commented:
I am calling the CreateTextFile function of the Scripting dll, File System ObjectClass. Copy and paste this code in Notepad. Rename the file to <filename>.vbs

VBS sends and receives all parameters as Variant types. Hence, as EDDYKT mentioned, the receiving DLL Method would need its parameters as Variant.
--------------------------------------------------------------------------------------------

Dim fso
Dim f1
Msgbox("Starting")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile("c:\Scan.txt", True)
f1.WriteLine("Hello world")
f1.Close
Msgbox("Ending")
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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