Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Postmessage function in QTP for simulating Printscreen key does not work
#4
Not Solved
instead of using this method i will send u the function and how to use that but this code i posted in the articles in the forum if u did not get it i will send u again

Code:
Public Sub CaptureScreenshot( ByRef Sender, ByVal micStatus, ByVal descriptionStr )  
Dim dateTimeNow, fileNameStr, divDesc, caption
Dim dicMetaDescription, qtp
dateTimeNow = DotNetFactory.CreateInstance( "System.DateTime" ).Now.ToString( "ddMMyyHHmmss" )    
fileNameStr = Reporter.ReportPath & "\" & dateTimeNow & ".png"    
Set qtp = CreateObject( "QuickTest.Application" )  
qtp.Visible = False
Wait 0, 500    
If IsObject( sender ) Then      
Sender.CaptureBitmap fileNameStr, True      
caption = Sender.ToString & " - Capture Bitmap"    
Else      
Desktop.CaptureBitmap fileNameStr, True      
caption = "Desktop - Capture Bitmap"    
End If
qtp.Visible = True
divDesc = "<table align='center' border='5' cellpadding='1' cellspacing='1' width='100%' title='" & fileNameStr & "' frame='hsides'>" & _              
               "<caption>" & caption & "</caption>" & _              
  "<thead><tr><th>Application Exception Description</th></tr></thead>" & _              
  "<tfoot><tr><td align='center'><img border='2px' src='" & fileNameStr & "' /></td></tr></tfoot>" & _              
  "<tbody><tr><td>" & descriptionStr & "</td></tr></tbody></table>"    
Set dicMetaDescription = CreateObject( "Scripting.Dictionary" )    
dicMetaDescription( "Status" ) = micStatus    
dicMetaDescription( "PlainTextNodeName" ) = "ApplicationException"    
dicMetaDescription( "StepHtmlInfo" ) = "<DIV align=center>" & divDesc & "</DIV>"  
dicMetaDescription( "DllIconIndex" ) = 205    
dicMetaDescription( "DllIconSelIndex" ) = 205
dicMetaDescription( "DllPAth" ) = EnVironment( "ProductDir" ) & "\bin\ContextManager.dll"  
Call Reporter.LogEvent( "User", dicMetaDescription, Reporter.GetContext )
End Sub
to use it in the script just keep the below lines at the top of your script
Code:
RegisterUserFunc "Page", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Browser", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Frame", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "Dialog", "CaptureScreenshot", "CaptureScreenshot"
RegisterUserFunc "swfWindow", "CaptureScreenshot", "CaptureScreenshot"
just place this line where you want to capture the screenshot
Code:
Browser("micclass:=Browser").Page("micclass:=Page").CaptureScreenshot micPass, "<h4 align = ""Center"">Page SuccessFully Displayed</h4>"

write the function which i have written above in a library function and add it to the script
Reply


Messages In This Thread
RE: Postmessage function in QTP for simulating Printscreen key does not work - by vinod123 - 07-11-2013, 03:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question what is the shortcut key used to switch between keyword view and expert view in qtp. shaileshanand86 5 11,274 02-13-2019, 03:58 AM
Last Post: zia003
  Calling a Function in Function Library when function is defined in an Action jitenderkkr 0 2,778 11-27-2014, 12:53 PM
Last Post: jitenderkkr
  Facing issue with Java Table to press Enter Key from Keyboard Nasir Ahmed 0 4,392 05-23-2014, 08:05 PM
Last Post: Nasir Ahmed
  unable to click webelement by holding shift key tanyamrz 1 3,363 09-14-2012, 05:21 AM
Last Post: kcn
  Send key method does not set value on webEdit object. sandeep arora 1 14,390 04-05-2012, 05:27 PM
Last Post: verma.vik6

Forum Jump:


Users browsing this thread: 1 Guest(s)