Jump to content

DdfInform

From EDM2


This function defines a hypertext inform link, which sends an HM_INFORM message to the application with a res= attribute. It also corresponds to the link tag with reftype=inform.

Syntax

DdfInform(hddf, pszText, resInformNumber)

Parameters

hddf (HDDF) - input
Handle to DDF returned by DdfInitialize.
pszText (PCSZ) - input
Hypertext phrase.
resInformNumber (ULONG) - input
Res number associated with this hypertext field.
Possible values are 1 to 64000; all other values are reserved.

Returns

rc (BOOL) - returns
Success indicator.
TRUE: Successful completion.
FALSE: Error occurred.

Errors

Possible returns from WinGetLastError:

  • HMERR_DDF_MEMORY (0x3001): Not enough memory is available.

Example Code

Declare:

#define INCL_DDF
#include <os2.h>

HDDF    hddf;            /* Handle to DDF returned by DdfInitialize. */
PCSZ    pszText;         /* Hypertext phrase. */
ULONG   resInformNumber; /* Res number associated with this hypertext field. */
BOOL    rc;              /* Success indicator. */

rc = DdfInform(hddf, pszText, resInformNumber);

After initializing a DDF buffer with DdfInitialize, the example uses DdfInform to create a hypertext inform link with another resource (corresponds to the IPF :link. tag with reftype=inform). For a more detailed example and discussion of initializing DDF, see the DdfInitialize sample.

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

PSZ   Text = "This text is a HYPERTEXT message.\n"; /* hypertext string  */

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

    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;
            }

            /* create hypertext inform link with resource 1 */
            if (!DdfInform(hDdf, (PSZ)Text, 1L))
            {
                return (MRESULT)FALSE;
            }

            return (MRESULT)hDdf;
    }
    return WinDefWindowProc(hwnd, ulMsg, mp1, mp2); /* Default processing for other messages */
}

Related Functions