home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / S12659.ZIP / SRVRMAIN.C < prev    next >
Text File  |  1989-01-06  |  2KB  |  49 lines

  1. /*
  2.  *  Graphics Exchange example OS/2 PM DDE Server program - Source Code
  3.  *
  4.  *  The Graphics Exchange server application creates a picture using
  5.  *  GPI graphics orders and transmits changes to this picture through
  6.  *  a permanent DDE data link.  The server application simulates a
  7.  *  phone messaging system, which displays phone messages in a listbox
  8.  *  and updates its picture as the number of messages increases.  The
  9.  *  actual receiving of messages is not demonstrated in this program.
  10.  *  Instead, the timer is used to simulate the arrival of phone messages
  11.  *  at a constant interval.
  12.  */
  13.  
  14. #include "os2.h"
  15. #include "st.h"
  16. #include "server.h"
  17.  
  18. /*
  19.  *  Graphics Exchange server main program & message processing loop
  20.  *
  21.  *  This main routine controls the Presentation Manager
  22.  *  initialization and termination as well as implementing the main
  23.  *  polling loop for the server application.
  24.  */
  25.  
  26. HAB  hab;
  27.  
  28. int cdecl main()
  29. {
  30.     QMSG   qmsg;         /* input message structure definition       */
  31.     HMQ    hmq;          /* message queue handle                     */
  32.     HWND   hFrame;       /* frame window handle                      */
  33.  
  34.     hab = WinInitialize(NULL);
  35.     hmq = WinCreateMsgQueue(hab,0);
  36.  
  37.     if((hFrame = PhoneInit()) == 0)             /* srvrini.c */
  38.        return(FALSE);
  39.  
  40.     /* Poll messages from event queue */
  41.     while(WinGetMsg(hab, (PQMSG)&qmsg, (HWND)NULL, 0, 0)) {
  42.           WinDispatchMsg(hab, (PQMSG)&qmsg);
  43.     }
  44.  
  45.     WinDestroyWindow(hFrame);
  46.     WinDestroyMsgQueue(hmq);
  47.     WinTerminate(hab);
  48. }
  49.