Extern object in UFT

Extern object is used to call the windows native API methods.
 
'Declare 2 windows native methods - FindWindow and SetWindowText
Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA", micString, micString 
Extern.Declare micLong, "SetWindowText", "user32.dll", "SetWindowTextA", micHwnd, micString 


'Get HWND of the Notepad window 
'You can use any of the below statements to find the window.
'FindWindow method takes 2 arguments - first is the class of the window, second is the title of the window
'hwnd = Extern.FindWindow("Notepad", null) 
hwnd = Extern.FindWindow(null,"Untitled - Notepad") 

if hwnd = 0 then 
	MsgBox "Untitled Notepad window not found" 
end if 

'Set the title of the window
Extern.SetWindowText hwnd, "UFT"

Web development and Automation testing

solutions delivered!!