Solved

win32api from vbscript ???

Posted on 2001-07-24
12
406 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 100 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 65
Access 2013 combo box not working 3 56
which modules are active in VB6 project? 6 51
VBA: Insert New column with specific format type 12 52
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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

679 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