Micro Focus QTP (UFT) Forums
Not able to record qtp from vb.NET - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Not able to record qtp from vb.NET (/Thread-Not-able-to-record-qtp-from-vb-NET)



Not able to record qtp from vb.NET - _IllusiveMan_ - 10-21-2011

Hi,

I am creating an application using vb.net which will launch and start recording qtp.

code snippet is below

Code:
qtpApp = CreateObject("QuickTest.Application")

            qtpApp.Launch()
            qtpApp.Visible = False

            'qtpApp.WindowState = "Minimized"
            qtpApp.ActivateView("ExpertView")
            qtpApp.Visible = False

            ' qtpApp.New()

            WScript.Sleep(1000)

            qtpApp.ActivateView("ExpertView")
            'qtApp.Visible = True
            WshShell = CreateObject("Wscript.Shell")
            WScript.Sleep(10000)
            qtpApp.Visible = True
            qtpApp.WindowState = "Maximized"
            WScript.Sleep(500)
            WshShell.SendKeys("{F3}")
            WScript.Sleep(100)
            WshShell.SendKeys("{enter}")

            qtpApp.WindowState = "Minimized"
            qtpApp.Visible = False

            WScript.Sleep(800)

            _blQTPLaunched = True

It is launching qtp, but sendkey is not working. What am i doing wrong here?


RE: Not able to record qtp from vb.NET - parminderdhiman84 - 10-21-2011

Try using this:
Code:
Set qtpApp = CreateObject("QuickTest.Application")
qtpApp.Launch()
qtpApp.Visible = False
'qtpApp.WindowState = "Minimized"
qtpApp.ActivateView("ExpertView")
qtpApp.Visible = False
' qtpApp.New()
WScript.Sleep(1000)
qtpApp.ActivateView("ExpertView")
'qtApp.Visible = True
Set WshShell = CreateObject("Wscript.Shell")
WScript.Sleep(10000)
qtpApp.Visible = True
qtpApp.WindowState = "Maximized"
WScript.Sleep(500)
WshShell.SendKeys("{F3}")
WScript.Sleep(100)
WshShell.SendKeys("{enter}")
qtpApp.WindowState = "Minimized"
qtpApp.Visible = False
WScript.Sleep(800)



RE: Not able to record qtp from vb.NET - Acharya_silu@yahoo.com - 10-21-2011

Ans:

Hi,

You have missed Set Keyword i,e
Code:
Set WshShell = CreateObject("Wscript.Shell")
should be used.

Thanks


RE: Not able to record qtp from vb.NET - _IllusiveMan_ - 10-21-2011

Thanks for the reply

It says Let and Set are no longer supported. I am developing WPF application in Visual studio 2010.