home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / MSJV5-1.ZIP / ISAM.ARC / FIG19.C < prev    next >
Text File  |  1989-12-11  |  1KB  |  47 lines

  1.  
  2. /* Create the server's communications window. If successful
  3. returns window handle. If error returns NULL. */
  4.  
  5. HWND CreateCommWindow(
  6.     HANDLE hInstance,
  7.     HANDLE hPrevInstance )
  8. {
  9. /* Server's class and window name as defined by WinTrieve
  10. protocol specification. */
  11.  
  12.     static char    szCommName = "ISAM SERVER";
  13.  
  14.     WNDCLASS       wndclass;
  15.     HWND           hWnd;
  16.  
  17.     /* Only one instance of the server is allowed
  18.      * to run at any one time. Return error.
  19.      */
  20.     if (hPrevInstance)
  21.       return NULL;
  22.  
  23.     /* Register the server window class. Nothing special
  24. here. */
  25.     wndclass.style          = CS_HREDRAW | CS_VREDRAW;
  26.     wndclass.lpfnWndProc    = WndProc;
  27.     wndclass.cbClsExtra     = 0;
  28.     wndclass.cbWndExtra     = 0;
  29.     wndclass.hInstance      = hInstance;
  30.     wndclass.hIcon          = NULL;
  31.     wndclass.hCursor        = LoadCursor(NULL, IDC_ARROW);
  32.     wndclass.hbrBackground  = GetStockObject(WHITE_BRUSH);
  33.     wndclass.lpszMenuName   = NULL;
  34.     wndclass.lpszClassName  = szCommName;
  35.  
  36.     if (!RegisterClass(&wndclass))
  37.       return NULL;
  38.  
  39.  
  40.     /* Create server communications window. */
  41.     hWnd = CreateWindow(szCommName, szCommName,
  42.                         WS_OVERLAPPED|WS_SYSMENU,
  43.                         CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
  44.                         NULL, NULL, hInstance, NULL);
  45.    return hWnd;
  46. };
  47.