Listing 1. Simple CDE GUI application

#include <stdlib.h>
#include <Xm/MessageB.h>
#include <Dt/Dts.h>
#include <Dt/Action.h>
void emailCB(Widget, XtPointer, XtPointer);
main(argc, argv)
   int   argc;
   char  **argv;
{
   Widget  topLevelShell, send, help, cancel;
   Arg   xargs[10];
   int   n;
   XmString title, greet, email;
   char *file = 2 == argc ? argv[1] :
      "/etc/motd";
   char *description;
topLevelShell = XtInitialize(argv[0], "DtSend",
      NULL, 0, &argc, argv);
/* CDE Initialization */
   DtInitialize(XtDisplay(topLevelShell),
      topLevelShell, argv[0], "DtSend");
   DtDbLoad();
   send = XmCreateMessageDialog(topLevelShell,
      "send", NULL, 0);
   /*Get CDE's "DESCRIPTION" of the file*/
   description = DtDtsFileToAttributeValue(file,
      "DESCRIPTION");
   title = XmStringCreateSimple("DtSend");
   greet = XmStringCreateLtoR(description);
   email  = XmStringCreateSimple("Email");
   XtVaSetValues(send,
      XmNdialogTitle,   title,
      XmNmessageString,     greet,
      XmNhelpLabelString,   email,
      NULL);
   XmStringFree(title);
   XmStringFree(greet);
   XmStringFree(email);
   cancel = XmMessageBoxGetChild(send,
      XmDIALOG_CANCEL_BUTTON);
   XtUnmanageChild(cancel);
   XtAddCallback(send, XmNokCallback, exit,
      NULL);
   XtAddCallback(send, XmNhelpCallback, emailCB,
      file);
   XtManageChild(send);
   XtMainLoop();
}
void
emailCB(w, client_data, call_data)
   Widget w;
   XtPointer client_data;
   XtPointer call_data;
{
   DtActionInvocationID actionId;
   DtActionArg actionArgs[] = { DtACTION_FILE,
      (char *)client_data };
   actionId = DtActionInvoke(XtParent(w),
      "Compose", /* action */
      actionArgs, 1, /* action arguments
             * & count */
      (char *) NULL, /* terminal options */
      (char *) NULL, /* execution host */
      (char *) NULL, /* context directory */
      True, /* "use indicator" */
      NULL, NULL);   /* action callback &
             * client data */
}