Custom Search

Wednesday, November 21, 2012

work with the DLL's in QTP

'Declare FindWindow method

Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA", micString, micString

'Declare SetWindowText method

Extern.Declare micLong, "SetWindowText", "user32.dll", "SetWindowTextA", micHwnd, micString

'Get HWND of the Notepad window

hwnd = Extern.FindWindow("MicrosoftExcel", vbNullString)

if hwnd = 0 then

MsgBox "Notepad window not found"
else
msgbox hwnd

end if

'Change the title of the notepad window

res = Extern.SetWindowText(hwnd, "kuku")

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.