How can I call a Win32 API in VBScript code?
You can't natively call a Win32 API in VBScript code, but several independent developers have created custom components that provide this capability. Perhaps the most popular components are Ton Plooy's DynaCall() function and Jeff Stong's DynaWrap automation component, which is based on the DynaCall() function.
To learn more about DynaCall(), read the Windows::Developer Journal article "A DynaCall() Function for Win32," http://www.windevnet.com. You can access this article online after you register, and you can download the article's code, which includes the dynacall.dll file, from ftp://ftp.wdj.com/pub/1998/aug98.zip.
Unfortunately, a Windows::Developer Journal article about DynaWrap, titled "An Automation Object for Dynamic DLL Calls," is no longer available online. However, you can still download the DynaWrap code from ftp://ftp.wdj.com/pub/1998/nov98.zip.
Several independent Web sites host additional information about DynaCall() and DynaWrap, including updated components and sample scripts. After a quick review, I've found the following Web sites to be the most useful: http://home.att.net/~wshvbs/wshAPIToolkitObjectPage.htm and http://ourworld.compuserve.com/homepages/guenter_born/wshbazaar/wshdynacall.htm.