Consultor Eletrônico



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

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 GlobalDeleteAtom. This function decrements the reference
count of a global atom by one, deleting the atom entry from the
global atom table once the reference count equals zero. To avoid
memory leakage, GlobalDeleteAtom() must be called for every atom
created in the global atom table by GlobalAddAtom(). To avoid
causing problems for other applications, only call GlobalDeleteAtom()
as many times as GlobalAddAtom has been called by the application.

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


DEFINE VARIABLE intAtom AS INTEGER NO-UNDO.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.

PROCEDURE GlobalDeleteAtom EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER intAtom AS LONG.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.

RUN GlobalDeleteAtom (INPUT intAtom, OUTPUT intResult).

IF intResult = 0 THEN
MESSAGE "Atom Reference Count Decremented" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Function call failed, not sure why" VIEW-AS ALERT-BOX.

Progress Software Technical Support Note # 17145