Consultor Eletrônico



Kbase P19018: How to Call WIN32 API Function: SetConsoleTitle
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   2/10/2003
Status: Unverified

GOAL:

How to Call WIN32 API Function: SetConsoleTitle

FACT(s) (Environment):

Windows

FIX:

The following sample code shows how to call the Win32 API function called SetConsoleTitle.  This function sets the title bar string for the current console window.  This function is only useful when running the 32-Bit Character Client (i.e. _PROGRES.EXE).


DEFINE VARIABLE chrTitle  AS CHARACTER NO-UNDO FORMAT "X(128)".
DEFINE VARIABLE intResult AS INTEGER   NO-UNDO.

PROCEDURE SetConsoleTitleA EXTERNAL "KERNEL32.DLL":
   DEFINE INPUT  PARAMETER chrConsoleTitle AS CHARACTER.
   DEFINE RETURN PARAMETER intResult       AS LONG.
END PROCEDURE.

RUN SetConsoleTitleA ("New Console Window Title", OUTPUT intResult).

IF intResult NE 0 THEN
   MESSAGE "Title was changed" VIEW-AS ALERT-BOX.
ELSE
   MESSAGE "Title change failed" VIEW-AS ALERT-BOX.