Consultor Eletrônico



Kbase 17253: How to Call WIN32 API Function: FindWindow
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
How to Call WIN32 API Function: FindWindow

DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes
only. If you have specific questions about which API calls would be
best suited to your design goals, please consult your Microsoft
documentation.

INTRODUCTION:
=============
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":
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.

Progress Software Technical Support Note # 17253