Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

win32api from vbscript ???

Posted on 2001-07-24
12
Medium Priority
?
412 Views
Last Modified: 2008-03-10
is it possible ? if so - what's the syntax. tried regular vb declaration :

Declare Function etc......

does not working.
0
Comment
Question by:AnswerTheMan
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6313235
Doesn't work from VBScript, you must call it from your MTS/COM+ object.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6313277
Dave is right, VBSCript doesn't allow direct access to API calls. You need to wrap these into an activex dll that you can instantiate a class from which makes the api calls for you. There are some functions available in WSHOM.ocx which are of use, it depends what you want from the api.
0
 
LVL 28

Expert Comment

by:Ark
ID: 6315114
Hi
Take a look on my sample at http://www.freevbcode.com/ShowCode.Asp?ID=1863

Make a class module from this code, compile it as activeX dll and use any API you want.

Cheers
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Expert Comment

by:Caseys95
ID: 6317022
AnswerTheMan,

There is a good article in the May issue of Access/VB/SQL Advisor magazine. It discusses the use of WMI (Windows Management Instrumentation)

Quotes:

"Thanks to the Windows Management Instrumentation, you may never need to directly access the Windows API again"

"WMI was originally designed for scripting languages, such as VBScript and JavaScript, but you can use almost all the programming interfaces and objects in any application that understands COM components."
0
 
LVL 5

Author Comment

by:AnswerTheMan
ID: 6322871
Dave Greene & TimCottee
--------------------------
yeah, that's what i was thinking.


ARK
----
i meant calling API from the script itself.
without instanciating any object that runs the api calls.


Caseys96
--------
i'll check that. do you have any URL ?
0
 
LVL 2

Expert Comment

by:Caseys95
ID: 6324008
http://advisor.com/Articles.nsf/aid/KIELD44

Not much help there though.

It will require using a COM object.
0
 
LVL 28

Expert Comment

by:Ark
ID: 6324683
Hi
It's not possible to call API from vbs without objects (note that WMI and WSHOM are objects too).
BTW, you even need no to make dll - smbd already did it:
http://home.att.net/~wshvbs/wshAPIToolkitObjectPage.htm

Cheers
0
 
LVL 5

Author Comment

by:AnswerTheMan
ID: 6331483
ok guys. it's not possible without objects, that is, you can call from VBS right to system dll by declaring it as in VB.
knew that, but wanted to be sure.
since didn't get any  fresh news - what you suggest to do with this Q ?
0
 
LVL 8

Accepted Solution

by:
Dave_Greene earned 200 total points
ID: 6331535
You should award the points if you have enough.  Even though proven to be impossible, much good information can be found in this thread!
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6345984
And definately beat up the experts on your way out...  I forgot to mention that, but I guess you have that one down pat.
0
 
LVL 28

Expert Comment

by:Ark
ID: 6346887
IMHO better 0 then C

Cheers
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6346891
yea, someone will really read this now... way to go!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

972 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