Kbase P24744: How to Call WIN32 API Function: BringWindowToTop
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
GOAL:
How to call the Win32 API function named BringWindowToTop?
GOAL:
How to bring a window to the top and superimpose it over other overlapping windows on the screen?
FACT(s) (Environment):
Windows 32 Intel
FIX:
The following code shows how to call the Win32 API function named BringWindowToTop. This function brings a window to the top and superimposes it over other overlapping windows on the screen. The window is activated if it is a pop-up or top-level window.
You will most commonly use BringWindowToTop() to bring pop-up windows in front
of other windows and activate them for user input.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.
DEFINE VARIABLE intHwnd AS INTEGER NO-UNDO.
PROCEDURE BringWindowToTop EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER intHwnd AS LONG.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.
PROCEDURE FindWindowA EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER intClassName AS LONG.
DEFINE INPUT PARAMETER intCaption AS CHARACTER.
DEFINE RETURN PARAMETER intHandle AS LONG.
END PROCEDURE.
RUN FindWindowA(0, "Some Window Title", OUTPUT intHwnd).
IF intHwnd <> 0 THEN
DO:
RUN BringWindowToTop(intHwnd, OUTPUT intResult).
IF intResult = 1 THEN
MESSAGE "Window Brought To Top" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Window Not Brought To Top" VIEW-AS ALERT-BOX.
END.
ELSE
MESSAGE "Could Not Find Window" VIEW-AS ALERT-BOX.