Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

interop - Import WinAPI Function in *.VBS File

Using visual basic in say Excel, I am able to declare WinAPI functions using the DECLARE keyword - e.g.

Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" ( _
    ByVal Locale As Long,
    ByVal LCType As Long,
    ByVal lpLCData As String
) As Boolean

However when using this syntax in a *.VBS file - it fails with a compile error.

Can anyone tell me what I need to do to run WinAPI functions from *.VBS files?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can't run WinAPI functions from VBScript without some extra third-party support.

I believe there used to be vendor of a COM component which allowed VBScript to call into a standard dll but I can't remember what it was called and its quite possible that my imagination is playing tricks on me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...