Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Call Win32 API in VBScript ??

2,726 views
Skip to first unread message

QI

unread,
Jun 29, 2001, 1:37:57 AM6/29/01
to
In Visual Basic , we can call Win32API.
But in the vbscript, Has any way to call Win32API directly , like
PostMessage ...

Thanks in Advance....


Randy Hunt, MCSE

unread,
Jun 29, 2001, 1:43:30 AM6/29/01
to
QI says:

> In Visual Basic , we can call Win32API.
> But in the vbscript, Has any way to call Win32API directly , like
>PostMessage ...


In short: No.

In more detail: Absolutely not.
There is no way to "directly" access the Windows API using VBScript.
Your options are either a)create a COM object that accesses the API
and instantiate it in your script, or b)call "rundll32"

----------
Randy Hunt

http://www.serverscripting.com
http://www.wshscripting.com

Jane Alford

unread,
Jun 29, 2001, 6:31:14 AM6/29/01
to
you have the full capability of Win32 using Perl - have you thought of that
as a solution ?

--
Jane Alford
Software Engineer, Worldport Communications Inc
Dublin, Ireland


"QI" <je...@ms29.hinet.net> wrote in message
news:ezn0X2FABHA.996@tkmsftngp02...

mayayana1

unread,
Jun 29, 2001, 10:21:23 AM6/29/01
to
Is that true? How does Perl get around having only 3 data types?

--
--
Jane Alford <pep...@hotmail.com> wrote in message
news:#mjx4YIABHA.1628@tkmsftngp05...

jim_w

unread,
Jun 29, 2001, 1:59:15 PM6/29/01
to
hi QI,

Calling an api is not supported in "pure" script.

If you are courageous enough (or foolhardy enough) to use a third-party
control, then you can call an api using DynaWrap, which is available from
Clarence's or Guenter's websites, although you may prefer Guenter's as he
provides some doc to go along with the code.

Clarence:
http://cwashington.netreach.net/main_site/downloads/default.asp?topic=a-m

(then look for: DynaWrap.dll)

Guenter: http://www.borncity.de/WSHBazaar/WSHBazaar.htm

(click on DynaCall page)

Note: If you plan on doing something extremely complicated or grandiose,
then it may be advisable to write your own COM object (ActX: Exe, Dll, Ocx)
which is "scriptable", to "wrap" the api calls. The api declarations are
easier to deal with when coding in visual basic, and your script would look
a lot less messy. (And, your scripting friends would make a lot fewer
diaparaging remarks about you). If you have any interest in writing an ocx
"wrapper" for your api calls, then you might want to consider using vb5cce
(a.k.a. Microsoft's gift to scripters) at:

http://msdn.microsoft.com/downloads/tools/visualbasic/vbcce.asp

Better get it before Microsoft changes it's mind, and tries to sell you
vb.net instead.

cheers, jw

"QI" <je...@ms29.hinet.net> wrote in message
news:ezn0X2FABHA.996@tkmsftngp02...

Ron Grabowski

unread,
Jun 29, 2001, 2:27:07 PM6/29/01
to
> Is that true? How does Perl get around having only 3 data types?

Perl has more than three data types ( perldoc -f ref ):

REF
SCALAR
ARRAY
HASH
CODE
GLOB


Jane Alford

unread,
Jul 3, 2001, 4:01:45 AM7/3/01
to
Thanks Ron, I haven't been keeping up with this thread...

I've never found any limitations in the datatypes provided in Perl, between
6 or so available you can do pretty much anything, you can certainly louse
up your system as effectively as using any other language :-)

--
Jane Alford
Software Engineer, Worldport Communications Inc
Dublin, Ireland


"Ron Grabowski" <ron...@catlover.com> wrote in message
news:#T9jAkMABHA.1480@tkmsftngp03...

mayayana1

unread,
Jul 3, 2001, 11:40:41 AM7/3/01
to
It seems like you misunderstood the question, but I want to make sure I'm
not missing something.

Say you have an API call that takes 2 longs, one string and one byte
type. With my limited experience in Perl it seems those would all be scalar
variables, essentially variants, which could not be used to make the call.

--
--
Jane Alford <pep...@hotmail.com> wrote in message

news:Oka57X5ABHA.1768@tkmsftngp03...

0 new messages