Help: Pass object to VB DLL in VBScript 
Author Message
 Help: Pass object to VB DLL in VBScript

Sample code:

==========
Set objJob = CreateObject("PSTRJobPosting.JobPosting")
objJob.Load CLng(JobPostingID)
Set objProcessor = CreateObject("PSTRProcessor.Poster")
objProcessor.PerformProcessing objJob, 0
==========

VB Definition of Perform processing:

==========
Public Sub PerformProcessing(objJob As Variant, Action As Long)
==========

The error:

==========
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'PerformProcessing'
==========

PSTRJobPosting.JobPosting is defined in a VB DLL and can be accessed (all
properties and methods work) in VBScript. I can execute the sample code in
the VB IDE by pasting it into the immediate window, so I know the error is
not coming from inside the PerformProcessing method. Defining the second
parameter as CLng(0) also fails, as does changing the VB definition to
objJob As PSTRJobPosting.JobPosting.

How can I set things up so I can pass an object created in VBScript to a
method? Also, where can I look up the error numbers (e.g. '800a000d')?

Thanks

Colin Young



Tue, 16 Jan 2001 03:00:00 GMT  
 Help: Pass object to VB DLL in VBScript
That seems to be working (I think -- I think I'm having intermittent
security problems now, but that's a whole other issue, and one that I
actually understand). Any idea why the second parameter being a Variant
works, but not if it's a Long? I know VBScript only uses Variants, but I've
always been able to use Long as parameters in DLLs and explicitly cast using
CLng when calling from VBScript without trouble.

Thanks.

Colin

Quote:
>Have you tried to change this to
>>Public Sub PerformProcessing(objJob As Variant, Action As Variant)

>Mathias Schiffer
>--
>BasicPro magazine, Germany



Sat, 20 Jan 2001 03:00:00 GMT  
 Help: Pass object to VB DLL in VBScript
Hello

I've written a dll in Vbasic and wish to access it in VBScript but
have NO VbScript experience other than looking at at some samples
and writing an  'Hello World" app.  If you know the Syntax for calling
a Vbasic dll from VBscript please email me.

    The dll is called: FileProcess.dll

    The VB5 Usage is:

        Dim myfile as new clFile ' clfile is the class name
        myfile = "Notepad.exe"
        myfile.AppShell

Thanks

Murray



Sun, 21 Jan 2001 03:00:00 GMT  
 Help: Pass object to VB DLL in VBScript
Hi

It works!!! Eurika!!!  Thanks. Running it in WHS as follows:

The dll is FileProcess.dll. The class is clFIle. Terrific

Set myFile = Wscript.CreateObject("FileProcess.clFile")
 myFile.Assign = "c:\temp\aa.txt"
 myFile.AppShell
myFile.  etc

Mucho Gracias

Murray



Sun, 21 Jan 2001 03:00:00 GMT  
 Help: Pass object to VB DLL in VBScript
Your dll needs to be registered with "regsvr32.exe  fileprocess.dll" so that
it is in the registry.
Then, use:
set objFileProcess = CreateObject("Application.clfile")
(you didn't say what the application name is)
Quote:

>Hello

>I've written a dll in Vbasic and wish to access it in VBScript but
>have NO VbScript experience other than looking at at some samples
>and writing an  'Hello World" app.  If you know the Syntax for calling
>a Vbasic dll from VBscript please email me.

>    The dll is called: FileProcess.dll

>    The VB5 Usage is:

> Dim myfile as new clFile ' clfile is the class name
> myfile = "Notepad.exe"
> myfile.AppShell

>Thanks

>Murray



Sun, 21 Jan 2001 03:00:00 GMT  
 Help: Pass object to VB DLL in VBScript
This might work if you did it:
objProcessor.PerformProcessing objJob,CLng(0)
Don't ask me why, I have sometimes found that explicit conversion
is needed in cases like this, but it only works if you do it in the call.
Quote:

>Sample code:

>==========
>Set objJob = CreateObject("PSTRJobPosting.JobPosting")
>objJob.Load CLng(JobPostingID)
>Set objProcessor = CreateObject("PSTRProcessor.Poster")
>objProcessor.PerformProcessing objJob, 0
>==========

>VB Definition of Perform processing:

>==========
>Public Sub PerformProcessing(objJob As Variant, Action As Long)
>==========

>The error:

>==========
>Microsoft VBScript runtime error '800a000d'

>Type mismatch: 'PerformProcessing'
>==========

>PSTRJobPosting.JobPosting is defined in a VB DLL and can be accessed (all
>properties and methods work) in VBScript. I can execute the sample code in
>the VB IDE by pasting it into the immediate window, so I know the error is
>not coming from inside the PerformProcessing method. Defining the second
>parameter as CLng(0) also fails, as does changing the VB definition to
>objJob As PSTRJobPosting.JobPosting.

>How can I set things up so I can pass an object created in VBScript to a
>method? Also, where can I look up the error numbers (e.g. '800a000d')?

>Thanks

>Colin Young




Sun, 21 Jan 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Passing Arrays into VbScript from a VB dll

2. Passing arrays from VBScript to VB DLL

3. Passing Arrays to a VB 5.0 SP3 DLL using VBScript control

4. Passing arrays from a VB dll into a VBScript

5. Passing and returning VB Objects as parameters to VC++ DLL

6. Passing word object to ASP from vb dll

7. Passing Structure Containing Strings From VB to C/C++ DLL and Printer Object

8. Passing VB OLE objects in the Application object (IIS3, VB5, ASP, VBS)

9. passing arrays to vb dll

10. Call VB DLL or COM object from within VB COM object or EXE

11. Passing an object to an ActiveX dll from ASP script

12. Passing object variables to an activex dll

 

 
Powered by phpBB® Forum Software