Consultor Eletrônico



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

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 code sample shows how to call the Win32 API function
called GlobalGetAtomName. This function retrieves the atom name that
is associated with the given global atom. This function copies the
atom name from the global atom table into the provided buffer. Its
primary use is for data communication, converting global atoms of
other applications to strings.

This code has been tested on Windows NT 4.0 Workstation only.


DEFINE VARIABLE chrAtomString AS CHARACTER NO-UNDO FORMAT "X(256)".
DEFINE VARIABLE intAtom AS INTEGER NO-UNDO.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.

PROCEDURE GlobalGetAtomNameA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER intAtom AS SHORT.
DEFINE OUTPUT PARAMETER chrAtomString AS CHARACTER.
DEFINE INPUT PARAMETER intBufferSize AS LONG.
DEFINE RETURN PARAMETER intResult AS SHORT.
END PROCEDURE.

ASSIGN chrAtomString = FILL(" ", 256).

RUN GlobalGetAtomNameA (INPUT intAtom,
OUTPUT chrAtomString,
INPUT 255,
OUTPUT intResult).

IF intAtom <> 0 THEN
MESSAGE chrAtomString VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Function call failed, not sure why" VIEW-AS ALERT-BOX.

Progress Software Technical Support Note # 17147