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

  1. /*
  2.  *  Routine PhoneInit registers the window classes for
  3.  *  the Graphics Exchange server application and creates the
  4.  *  frame and listbox windows.  Note that the DDE anchor
  5.  *  window uses the system default winproc.
  6.  */
  7.  
  8. #include "os2.h"
  9. #include "st.h"
  10. #include "server.h"
  11.  
  12. HWND   hStdLB;     /* listbox handle */
  13.  
  14. HWND PhoneInit()
  15. {
  16.  
  17.      HWND        hGrFrame, hGrClient;  /* frame and client window handles */
  18.      RECTL       rect;                 /* rectangle for positioning       */
  19.      ULONG       CtlData;              /* frame control bit field         */
  20.  
  21.      if(!WinRegisterClass(hab,(PSZ)"Graphics",(PFNWP)GraphicWndProc,CS_SIZEREDRAW, 4))
  22.          return(FALSE);
  23.      if(!WinRegisterClass(hab,(PSZ)"DDEConversation",(PFNWP)ConversationWndProc,(ULONG)NULL, 4))
  24.          return(FALSE);
  25.      if(!WinRegisterClass(hab,(PSZ)"DDEManager",(PFNWP)WinDefWindowProc,(ULONG)NULL, 0))
  26.          return(FALSE);
  27.  
  28.      CtlData = FCF_TITLEBAR | FCF_SYSMENU | FCF_MENU | FCF_SIZEBORDER | FCF_MINMAX;
  29.  
  30.      hGrFrame = WinCreateStdWindow(HWND_DESKTOP, (ULONG)NULL, &CtlData, (PSZ)"Graphics",
  31.                                    (PSZ)"Server", 0L, (HMODULE)NULL, ID_GRAPHICS,
  32.                                    (HWND FAR *)&hGrClient);
  33.      hStdLB = WinCreateWindow(hGrClient, WC_LISTBOX, NULL, WS_VISIBLE,0,0,0,0,
  34.                               hGrClient, HWND_TOP, ID_STD_LB, (PVOID)NULL, (PVOID)NULL);
  35.  
  36.      WinSetWindowPos(hGrFrame, HWND_TOP,100,5,500,340,SWP_SIZE|SWP_MOVE);
  37.      WinQueryWindowRect(hGrClient, &rect);
  38.      WinSetWindowPos(hStdLB, HWND_TOP, LOUSHORT(rect.xLeft), LOUSHORT(rect.yBottom),
  39.                      LOUSHORT(rect.xRight-rect.xLeft), LOUSHORT(rect.yTop-rect.yBottom),
  40.                      SWP_SIZE | SWP_MOVE);
  41.      WinShowWindow(hGrFrame,TRUE);
  42.      WinSetFocus(HWND_DESKTOP,hGrFrame);
  43.      return(hGrFrame);
  44. }
  45.