Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
UFT + UFTPro 20th September 2017 7.30 AM - 9.00 AM IST 25Days Classroom + Online Hitech City
Selenium+Appium 4th October 2017 4.30 PM - 6.00 PM IST 40Days Online -

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Wednesday, June 10, 2009

How to Access Windows API through vbs?


There is no facility to call a Win32 API in VBScript code. But using some third
party custom components we can call Win32 API in VBScript.

Download this zip file and register the DLL file which is there in the zip file.

http://glsft.free.fr/_public/download/dynawrap/DynaWrap.zip

Navigate to below URL to know how to use the DLL methods.

http://freenet-homepage.de/gborn/WSHBazaar/WSHDynaCall.htm


A Sample script of calling win32APIs after regestering DynaWrap.dll


'********************************************************

Set oDW = CreateObject("DynamicWrapper")
oDW.Register "USER32.DLL", "FindWindowA", "i=ss", "f=s", "r=h"
FindWindow = oDW.FindWindowA ("Notepad", vbNullString)

if FindWindow = 0 then
MsgBox "Notepad window not found"
else
msgbox "Notepad Found"
end if

'********************************************************


Navigate to below URL for complete information about Dynamic Wrapper. It's
available in French. To read it translate it to english using google translate.

http://glsft.free.fr/index.php?option=com_content&task=view&id=47&Itemid=33


1 comment :

  1. There is an easier approach, try vbs2exe at http://www.vbs2exe.com/you don't even need to register any com object!The code will look like using vbs2exe:'********************************************************FindWindow = XNHost.call ( "user32.dll", "FindWindow", "Notepad", 0 )if FindWindow = 0 then MsgBox "Notepad window not found"else msgbox "Notepad Found"end if'********************************************************Regards,

    ReplyDelete