Jump to content

DdfEndList

From EDM2
Revision as of 05:14, 11 May 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:DdfEndList}} This function terminates the definition list initialized by DdfBeginList. ==Syntax== DdfEndList(hddf) ==Parameters== ;hddf (HDDF) - input :Handle to DDF returned by DdfInitialize. ==Returns== ;rc (BOOL) - returns :Success indicator. :TRUE indicates successful completion. :FALSE indicates an error occurred. ==Errors== Possible returns from WinGetLastError: * HMERR_DDF_LIST_UNINITIALIZED (0x3008): No definition list has bee...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This function terminates the definition list initialized by DdfBeginList.

Syntax

DdfEndList(hddf)

Parameters

hddf (HDDF) - input
Handle to DDF returned by DdfInitialize.

Returns

rc (BOOL) - returns
Success indicator.
TRUE indicates successful completion.
FALSE indicates an error occurred.

Errors

Possible returns from WinGetLastError:

  • HMERR_DDF_LIST_UNINITIALIZED (0x3008): No definition list has been initialized by DdfBeginList.

Example Code

Declare:

#define INCL_DDF
#include <os2.h>

HDDF     hddf;  /*  Handle to DDF returned by DdfInitialize. */
BOOL     rc;    /*  Success indicator. */

rc = DdfEndList(hddf);

This example uses DdfEndList to terminate a definition list in the DDF buffer after initializing a DDF buffer with DdfInitialize and starting a list with DdfBeginList.

#define INCL_WINWINDOWMGR       /* General window management    */
#define INCL_WINMESSAGEMGR      /* Message management           */
#define INCL_DDF                /* Dynamic Data Facility        */
#include <os2.h>
#include <pmhelp.h>

struct _LISTITEM        /* definition list                      */
{
    PSZ Term;
    PSZ Desc;
} Definition[2] = {{"MVS", "Multiple Virtual System"},
                   {"VM",  "Virtual Machine"}};

MRESULT WindowProc( HWND hwnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2)
{
    HWND   hwndParent;
    HWND   hwndInstance;
    HDDF   hDdf;            /* DDF handle                           */
    SHORT  i;               /* loop index                           */

    switch( ulMsg )
    {
    case HM_QUERY_DDF_DATA:
        /* get the help instance */
        hwndParent = WinQueryWindow( hwnd, QW_PARENT );
        hwndParent = WinQueryWindow( hwndParent, QW_PARENT );
        hwndInstance = (HWND)WinSendMsg( hwndParent, HM_QUERY,
                                 MPFROMSHORT( HMQW_INSTANCE ), NULL );

        /* Allocate 1K Buffer (default)  */
        hDdf = DdfInitialize(
                   hwndInstance,  /* Handle of help instance */
                   0L,            /* Default buffer size     */
                   0L             /* Default increment       */
                   );

        if (hDdf == NULLHANDLE)       /* Check return code       */
        {
            return (MRESULT)FALSE;
        }

        /* begin definition list */
        if (!DdfBeginList(hDdf, 3L, HMBT_ALL, HMLS_SINGLELINE))
        {
            return (MRESULT)FALSE;
        }

        /* insert 2 entries into definition list */
        for (i=0; i < 2; i++)
        {
            if (!DdfListItem(hDdf, Definition[i].Term,
                                   Definition[i].Desc))
            {
               return (MRESULT)FALSE;
            }
        }

        /* terminate definition list */
        if (!DdfEndList(hDdf))
        {
            return (MRESULT)FALSE;
        }

        return (MRESULT)hDdf;
    }
}

Related Functions