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
Selenium+Appium+Katalon 9th June 2018 9.30 AM - 11 AM IST 35 Days ClassRoom + Online Mind Q Madhapur

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.


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


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"
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.


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,