Monday 28 October 2013

Working with DotNetFactory in QTP!!!!

'create the .net screen
Set screen=DotNetFactory("System.Windows.Forms.Screen")

Set allscreens=screen.AllScreens

'msgbox "Total Availble screens---"& allscreens.length
'Get the enumerator for current array
Set enumScreen=allscreens.GetEnumerator()

While enumScreen.Movenext
Set oscreen=enumScreen.current
msgbox "Device Name--"+oscreen.devicename
msgbox "Bound---"&oscreen.Bounds.tostring()
msgbox "Type---"&oscreen.gettype().tostring()
msgbox "Working Area---"&oscreen.workingarea.tostring()
msgbox "Primary Screen---"&oscreen.primary.tostring()
msgbox vbnewline
Wend

**********************************************************************************
'Create .net audio object
Set obj=DotNetFactory("Microsoft.VisualBasic.Devices.Audio","Microsoft.VisualBasic")
'play the wav file
obj.play "C:\WINDOWS\Media\Windows XP Shutdown.wav"
set obj=nothing

No comments:

Post a Comment