Solved

win32api from vbscript ???

Posted on 2001-07-24
12
403 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
Comment Utility
Doesn't work from VBScript, you must call it from your MTS/COM+ object.
0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
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 27

Expert Comment

by:Ark
Comment Utility
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
 
LVL 2

Expert Comment

by:Caseys95
Comment Utility
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
Comment Utility
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
Comment Utility
http://advisor.com/Articles.nsf/aid/KIELD44

Not much help there though.

It will require using a COM object.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 27

Expert Comment

by:Ark
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 27

Expert Comment

by:Ark
Comment Utility
IMHO better 0 then C

Cheers
0
 
LVL 8

Expert Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…
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…

728 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

9 Experts available now in Live!

Get 1:1 Help Now