Solved

Visual Basic DLL call from VBScript???

Posted on 2004-09-01
7
748 Views
Last Modified: 2013-11-25
Hi,

Does anyone know why a component (ActiveX EXE) created in Visual Basic 6.0 sp5 cannot be run directly from within IE6 or even directly from a .vbs file. OK, I know that IE6 is down to security reason, but what about the .vbs file?

I have code similar to this, where my main application is a ActiveX EXE and it exposes various methods, functions, properties and events. I have written similar code in VB6.0 and it works without any problems. If I run it within either one i.e. IE6 or .vbs, it tells me that my property does not exist when I know it does.

Code sample:

Dim myObj

Set myObj = CreateObject("MyApp.CMyApp")

msgbox MyApp.UID (This works!)
msgbox MyApp.Search.Text("My Field") = "TEST" (This does not work. Tells me that the property does not exists i.e. error 438)

yet this one will work, ok, I know they are different, but it still does not explain why the above work in vb6

msgbox MyApp.Search.Text.Count ' return 6

Appreciate any feedback.

Thanks.

T.
0
Comment
Question by:taf
  • 2
7 Comments
 
LVL 11

Expert Comment

by:SweatCoder
ID: 11954752
i've called dll's from vbs and it works fine. is the dll registered?
0
 
LVL 8

Accepted Solution

by:
mladenovicz earned 250 total points
ID: 11954846
You should use myObj instead of MyApp

Dim myObj

Set myObj = CreateObject("MyApp.CMyApp")

msgbox myObj.UID
msgbox myObj.Search.Text

........

Set myObj = Nothing
0
 

Author Comment

by:taf
ID: 12032359
Hi,

It is definitely registered as I mentioned, it can access the first level of the properties contains in my object i.e. obj.count will work, but not obj.lines.count for example.

Remember as well it is not a dll but a ActiveX Server (.EXE), so maybe that is the problem.

As for my naming convension, this was just for the sake of the example. I would never user MyApp or MyObj either way. That's not really the type of feedback I was looking for????

Thanks.

T.
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 12563908
I did not talk about your naming convention.  Your code uses variable that is not declared

Set myObj = CreateObject("MyApp.CMyApp")   '-- here is MyObj

msgbox MyApp.UID (This works!)
msgbox MyApp.Search.Text("My Field") = "TEST" '-- here is MyApp, but you declared myObj
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now