return to first page linux journal archive
keywordscontents

Listing 2. C ``Hello World'' Source

#include <stdlib.h>
#include <Xm/MessageB.h>
main(argc, argv)
        int argc;
        char **argv;
{
       Widget topLevelShell, hello, help, cancel;
       Arg xargs[10];
       int n;
       XmString title, greet;
topLevelShell = XtInitialize(argv[0], "DtHello",
       NULL, 0, &argc, argv);
hello = XmCreateMessageDialog(topLevelShell, 
	"hello", NULL, 0);
title = XmStringCreateSimple("DtHello");
greet = XmStringCreateLtoR("Hello\nWorld");
XtVaSetValues(hello,
      XmNdialogTitle,title,
      XmNmessageString,greet,
      NULL);
XmStringFree(title);
XmStringFree(greet);
help = XmMessageBoxGetChild(hello, XmDIALOG_HELP_BUTTON);
XtUnmanageChild(help);
cancel = XmMessageBoxGetChild(hello, XmDIALOG_CANCEL_BUTTON);
XtUnmanageChild(cancel);
XtAddCallback(hello, XmNokCallback, exit, NULL);
XtManageChild(hello);
XtMainLoop();
}