Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

win32api from vbscript ???

Posted on 2001-07-24
12
Medium Priority
?
411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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

715 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