home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / msconf / cnftest / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-03  |  2.8 KB  |  113 lines

  1. /* ----------------------------------------------------------------------
  2.  
  3.  
  4.     CNFTEST sample for Microsoft ActiveX Conferencing
  5.  
  6.     Unpublished work.
  7.     Copyright (c) 1996, Microsoft Corporation
  8.     All rights reserved.
  9.  
  10.     MODULE: main.c
  11.  
  12.     PURPOSE:   Calls initialization functions and processes the message loop
  13.  
  14.     FUNCTIONS:
  15.     WinMain() - Calls initialization functions FInitApp() and FInitInstance(),
  16.     and processes message loop.
  17.     MsgLoop() - handles messages to this app.
  18.  
  19. ---------------------------------------------------------------------- */
  20.  
  21. #include "main.h"
  22.  
  23.  
  24. // Global Variables
  25.  
  26. HINSTANCE ghInst       = NULL;          // Current Instance
  27. HANDLE    ghAccelTable = NULL;          // Menu accelerators
  28. HMENU     ghMenu       = NULL;          // Main Menu
  29. HWND      ghwndMain    = hwndNil;       // Main Window
  30. HINSTANCE ghInstDll    = NULL;
  31.  
  32. HWND      ghwndSbar    = hwndNil;       // Status bar window
  33. HWND      ghwndMsg     = hwndNil;       // Message window
  34. HWND      ghwndEntry   = hwndNil;       // szEntry Edit control
  35. HFONT     ghfontEntry  = hfontNil;      // Font for edit control
  36.  
  37. PREF      gPref;                        // User preferences
  38. int       gdxWndMin    = 325;           // maximum size of window
  39. int       gdyWndMin    = 250;           // maximum size of window
  40.  
  41. DWORD     gdwFileId    = FileIdNil;     // ID of file being transferred
  42. int       giCount      = 0;             // number of hConfNotify in the system
  43.  
  44. HCONFNOTIFY grhConfNotify[10];          // array of handles to notification callback routines
  45.  
  46. /*  W I N  M A I N */
  47. /*-------------------------------------------------------------------------
  48.     %%Function: WinMain
  49.  
  50.     Main Windows entrypoint
  51.  
  52. -------------------------------------------------------------------------*/
  53. int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hInstPrev, LPSTR  lpszCmd, int nCmdShow)
  54. {
  55.     WPARAM wResult;
  56.  
  57.     ghInst = hInstance;
  58.  
  59.     if (!FInitApp(lpszCmd))
  60.     {
  61.         return 0;
  62.     }
  63.  
  64.     if (!FInitInstance(nCmdShow))
  65.     {
  66.         return 0;
  67.     }
  68.  
  69.     wResult = MsgLoop(fTrue /* fForever */);
  70.  
  71.     return wResult;
  72. }
  73.  
  74.  
  75.  
  76. /*  M S G  L O O P */
  77. /*-------------------------------------------------------------------------
  78.     %%Function: MsgLoop
  79.  
  80.     Main message loop
  81. -------------------------------------------------------------------------*/
  82. WPARAM MsgLoop(BOOL fForever)
  83. {
  84.     MSG   msg;
  85.  
  86.     for ( ; ; )
  87.     {
  88.         if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
  89.         {
  90.             // Acquire and dispatch messages until a WM_QUIT message is received.
  91.  
  92.             if (!GetMessage(&msg, NULL, 0, 0))
  93.             {
  94.                 break;        // WM_QUIT received
  95.             }
  96.                 
  97.             if (!TranslateAccelerator(msg.hwnd, ghAccelTable, &msg))
  98.             {
  99.                 TranslateMessage(&msg);
  100.                 DispatchMessage(&msg);
  101.             }
  102.         }
  103.         else if (fForever)
  104.         {
  105.             WaitMessage();
  106.         }
  107.         else
  108.         {
  109.             return 0;
  110.         }
  111.     }
  112.     return msg.wParam;
  113. }