Login   /   Register

What is the last window opened?

Rate this article
     1 votes, average: 2 out of 51 votes, average: 2 out of 51 votes, average: 2 out of 51 votes, average: 2 out of 51 votes, average: 2 out of 5
Loading ... Loading ...
April 1st, 2008 by daniva

Sometimes applications display reports, when the window title depends on server, ip, date an time, report type etc.

you can’t predict what will be the window title, only during runtime. I met this issue when an application display several reports types after selecting a menu item. my task is to verify that the window was opened.

The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.

API syntax : HWND GetForegroundWindow(VOID);

Return Value : Handle to the window or zero otherwise.

Extern.Declare micHWnd, "GetForegroundWindow", "user32.dll", "GetForegroundWindow" 
hwnd = Extern.GetForegroundWindow()
title = Window("hwnd:=" & hwnd ).GetROProperty( "title" )

Posted in Windowing

3 Responses to “What is the last window opened?”

  1. Sengupta Amitava Says:

    [-]

    Dani a bit correction is required…..2nd line should be Extern.GetForegroundWindow()…otherwise it will throw an error

  2. daniva Says:

    [-]

    Yes…you right
    it wa a copy-paste mistake
    it will be fixed soon

  3. Anil Says:

    [-]

    Mr Dani which book should i refer to learn window api like the above one??

Leave a Reply

You must be logged in to post a comment.

This article was viewed 542 times