Double click on a window based applications in QTP - listbox

I need to double click on a popup list in a window based application and we're using UFT. Tried so much online but couldn't get any info. Does anybody help what function to use? Also tried Dblclick function with X, Y values but didn't work.

Related

How to use MenuItemExecute() with AVDoc.OpenInWindowEx()

Is it possible to use Acrobat.MenuItemExecute('Copy'); command with
AVDoc.OpenInWindowEx(FFilename, Panel1.handle, 0, True, 0,0, 2, 0, 0, 0);
in Delphi 7 and Acrobat XI Pro?
If you help me with an example I'll be glad.
I think the answer to this is probably "no" because before calling Acrobat.MenuItemExecute('Copy'), it is necessary to call BringToFront on the window containing the text you want to copy, otherwise the call to MenuItemExecute('Copy') will fail, even when the document is hosted in one of Acrobat's own windows. I don't see how you could do that successfully when the document window is hosted in your app, rather than Acrobat.
However, there are a few things you could add to your q that might assist in getting a better answer. [...]
Update Please disregard my comments in an earlier version of this answer saying that I could not reproduce the behaviour that I could not select text in the window opened using OpenInWindowEx. In fact, I can now select text fine, what I had overlooked previously is that I had set the Enabled property of my TPanel to False.
Unfortunately, I have still not been able to successfully call Acrobat.MenuItemExecute('Copy') and I am beginning to think that there is no way to do this in a hosted window. I have not found a definitive list, but various comments by Adobe staffers that google found make it clear that many MenuItemExecute strings just to not work when using OpenInWindowEx.
However that may not be the only way to retrieve the selected text back into the Delphi app.
If you look at the hosted window using a tool like WinSpy or Window Detective you will see that contained within the panel window is a whole host of Acrobat windows, including an AVL_AVView one with the Window text "AVPageView" which I imagine is the actual window displaying the PDF text.
I think the key to a possible solution is your observation, which I've confirmed, that pressing Ctrl-C in the window copies the text to the clipboard. So far I have not been able to achieve the equivalent in code, using techniques like keybd_event calls, various Delphi "SendKeys" routines and sending a WM_COPY message to the AVPageView window. I'm sure it must be possible, but I haven't yet found a way.

Can I find out current typing co-ordinates in a notepad relative to desktop window

Is it possible for me to find out the typing co-ordinates (relative to desktop co-ordinates) in a notepad window from a Delphi application? For example, if we look at the below picture, I am typing on a notepad window. Can I find out the screen co-ordinates, where I am typing on notepad.
Edit
It would be helpful if someone can suggest a generic solution. Answer no1 speaks about notepad. How about a console window? Is it possible to figure out the co-ordinates, if i am typing on a console window?
I guess, if UAC would not disable it, you can implement the following sequence:
you have to learn the windows structure of the notepad. Using tools like WinSpy++, WinSight or ProcFS for Total Commander or whatever. And then you have to get the handle (HWND) of the actual editbox window. The topic of enumerating or finding other applications windows was discussed many times already on StackOverflow and on Google.
Then you have to ask the main edit window for it coordinates. See Get{Client/Window}Rect functions, see http://msdn.microsoft.com/en-us/library/windows/desktop/ms633503.aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519.aspx Perhaps even better would be to SendMessage the EM_GETRECT custom message: http://msdn.microsoft.com/en-us/library/ms997530.aspx
Then you have to know the position of caret: like TMemo.SelEnd and TEdit.SelStart - again best way would be to just read how they are implemented in VCL. Probably that would be rooted in SendMessage(EM_GETSEL,...) - http://msdn.microsoft.com/en-us/library/ms997530.aspx - there is a ready example to do this
Then you would have to ask Widows for relative coordinates of that position - relative to the Client Rect you get in above steps. See EM_POSFROMCHAR message http://msdn.microsoft.com/en-us/library/windows/desktop/bb761631.aspx and Delphi sample at http://www.delphipages.com/forum/showthread.php?t=33707
However some claims that this does not always work reliably: http://vbcity.com/forums/t/14951.aspx so as last resort you can use hard-core string parsing, as described in version 1 of this answer.

how to get the coordinates of Browser?

I have created Firefox extension using XPCOM . I want to get coordinates of client area of browser?
How to get coordinates of client area of browser using XPCOM?
please help me.
thanks,
Nandkuamar
If you have a window variable for the content area in question, just use its screenX/screenY properties.
If you have a window variable for the browser in question, use its content property to access the current tab's window, and then follow step 1.
If you don't have a variable yet, you can ask the window mediator for one.

Google Chrome Extension: Print the page silently

I'm developing an internal Google Chrome Extension that needs a way to initiate print the current page to the printer. I do not want the default Print dialog to come up (so, javascript:window.print() is out of question).
As far as I understand, this is not possible just with the JS + HTML plug-in, so I'm also open to using the NPAPI plugin also (with a dummy mime-type). And I'm concerned for Windows platform only.
I'm also open for various hacks / workarounds if possible, though a standard solution would be nice.
If you think this is not possible, let me know if you know any feature request logged for it?
Any suggestions/clarifications are welcome..
In chrome (v18+) we have the --kiosk --kiosk-printing switches. One can print automatically to default printer without print confirmation.
You can see it from this video http://www.youtube.com/watch?v=D6UHjuvI7IE
Since NPAPI allows you to create native C++ plugins that you can interact with through an object tag (which you can use from an extension), that would probably be the way to do it.
The tricky bit is that I don't know of a good way to get the bits for printing the page. The only person I know of who has done something similar to this actually got the window handle for the browser (available through NPAPI) and scraped the bits off of it to print that way, but that won't take into account print stylesheets or anything. You could also try using automation events to try to control the print dialog, but I have no idea if that would work or not.
By design, the browsers try not to let you do something like this, as it could open some serious vulnerabilities if any website could just start printing things to your printer without confirmation...
Anyway, if you find a way to do it with C++ you can use FireBreath to ease the creation of the NPAPI plugin.
There are various extensions that take snapshots of the current web page (for example, this one); you could adapt one to send the image to a printer via an NPAPI plugin.
I've recently been looking for a similar ability, and it seems like it would be quite possible using Chrome's new native messaging api.
https://developer.chrome.com/extensions/nativeMessaging
There are plenty of examples of this with C#, but here is one quick example of troubleshooting Chrome native messaging with a basic C# application
Native messaging from chrome extension to native host written in C#
I realize this may be a day late and a dollar short, but in case anyone else comes across this question, this is the solution that worked for me. From inside a C# app, you can directly print to installed printers using the PrintDocument class. If you figured out a way to get the page image, this would be far easier than using firebreath or NPAPI.
Disable print preview in Google Chrome on Mac
Quit Google Chrome
Launch Terminal on your Mac. (Search “Terminal” using the Search box)
Type defaults write com.google.Chrome DisablePrintPreview -bool true
Close Terminal and open Google Chrome
Disable print preview in Google Chrome on Windows
Close Google Chrome
From your desktop, right click Google Chrome
Click Properties
In the dialog box, add ‘ –disable-print-preview‘ at the end of the Target field sans the apostrophe (make sure to include the space before –)
Click Apply
Disable print preview in Firefox on Mac
In the address bar type “about:config” and press Enter.
Right click on the page, hover over ‘New’ and click on ‘Boolean’
Type ‘print.always_print_silent’ as the preference name and click ‘OK’
Click on ‘true’ and click ‘OK’.
Close the about:config window.
Disable print preview in Firefox on Windows
In the address bar type “about:config” and press Enter.
Right click on the page, hover over ‘New’ and click on ‘Boolean’ Type
‘print.always_print_silent‘ as the preference name and click ‘OK’
Click on ‘true’ and click ‘OK’.
Close the about:config window.
https://support.dryfta.com/how-to-disable-print-preview-in-chrome-firefox-on-windows-mac/

Using Toolbar to submit SAS code from Editor

When submitting SAS code via the SAS Toolbar (eg cmjohns response) the compiler knows that the code is being "DM'd" and will not run certain code (eg %window).
Is there a way to trick SAS into believing that code submitted from the Toolbar is coming from the Editor, therefore allowing interfaces (using %window) to be triggered via point and click?
It isn't super clean, but this will do it. The only downside is a program editor window will be open after it runs. There's probably a way to close it when it's done but I don't know what that is off hand.
pgm; clear;include "C:\path\code.sas"; submit;
Basically, this says to open a new program editor window and make sure no other code is in it, then include the contents of code.sas into the editor, then submit all the code that's in the program editor.
As a side note, in addition to a toolbar button, I think you could map a function key to a command like this as well. Press F9 to pull up the current mapping. There is a limit to the length of the command mapped to a key though so no long paths.

Resources