After initializing a DDF buffer with DdfInitialize, the example uses DdfPara to start a new paragraph, DdfSetFont and DdfSetFontStyle to have the text displayed in a large, bold Courier font, DdfSetColor to change the text color, and DdfText to place text in the buffer. 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> MRESULT WindowProc( HWND hwnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2 ) { HWND hwndParent; HWND hwndInstance; /* help instance window */ 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 paragraph in DDF buffer */ if( !DdfPara( hDdf ) ) { return (MRESULT)FALSE; } /* Change to large (100 x 100 dimensions) Courier font */ if( !DdfSetFont( hDdf, "Courier", 100L, 100L ) ) { return (MRESULT)FALSE; } /* make the font BOLDFACE */ if( !DdfSetFontStyle( hDdf, FM_SEL_BOLD ) ) { return (MRESULT)FALSE; } /* make the text display as BLUE on a PALE GRAY background */ if( !DdfSetColor( hDdf, CLR_PALEGRAY, CLR_BLUE ) ) { return (MRESULT)FALSE; } /* Write data into the buffer */ if (!DdfText(hDdf, "Sample Text")) { return (MRESULT)FALSE; } return (MRESULT)hDdf; } return WinDefWindowProc( hwnd, ulMsg, mp1, mp2 ); }