win32api from vbscript ???

is it possible ? if so - what's the syntax. tried regular vb declaration :

Declare Function etc......

does not working.
LVL 5
AnswerTheManAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Dave_GreeneConnect With a Mentor Commented:
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
 
Dave_GreeneCommented:
Doesn't work from VBScript, you must call it from your MTS/COM+ object.
0
 
TimCotteeHead of Software ServicesCommented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
ArkCommented:
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
 
Caseys95Commented:
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
 
AnswerTheManAuthor Commented:
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
 
Caseys95Commented:
http://advisor.com/Articles.nsf/aid/KIELD44

Not much help there though.

It will require using a COM object.
0
 
ArkCommented:
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
 
AnswerTheManAuthor Commented:
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
 
Dave_GreeneCommented:
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
 
ArkCommented:
IMHO better 0 then C

Cheers
0
 
Dave_GreeneCommented:
yea, someone will really read this now... way to go!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.