Kbase P46716: How to Call WIN32 API Function: FindWindow?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/10/2005 |
|
Status: Verified
GOAL:
How to Call WIN32 API Function: FindWindow?
GOAL:
How to call the FindWindow WIN32 API
FACT(s) (Environment):
Windows
FIX:
The following sample code shows how to call the Win32 API function called FindWindow. This function find a top-level window with a given class name and window name. Child windows are not searched.
This function is typically used to determine whether a specific application is currently running.
DEFINE VARIABLE intHwnd AS INTEGER NO-UNDO.
PROCEDURE FindWindowA EXTERNAL "USER32.DLL":U:
DEFINE INPUT PARAMETER intClassName AS LONG.
DEFINE INPUT PARAMETER chrCaption AS CHARACTER.
DEFINE RETURN PARAMETER intHandle AS LONG.
END PROCEDURE.
RUN FindWindowA (0, "Some Window Title", OUTPUT intHwnd).
IF intHwnd <> 0 THEN
MESSAGE "Yes, That Window Exists" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "No, That Window Does Not Exist" VIEW-AS ALERT-BOX.