home *** CD-ROM | disk | FTP | other *** search
- /* ----------------------------------------------------------------------
-
-
- CNFTEST sample for Microsoft ActiveX Conferencing
-
- Unpublished work.
- Copyright (c) 1996, Microsoft Corporation
- All rights reserved.
-
- MODULE: main.c
-
- PURPOSE: Calls initialization functions and processes the message loop
-
- FUNCTIONS:
- WinMain() - Calls initialization functions FInitApp() and FInitInstance(),
- and processes message loop.
- MsgLoop() - handles messages to this app.
-
- ---------------------------------------------------------------------- */
-
- #include "main.h"
-
-
- // Global Variables
-
- HINSTANCE ghInst = NULL; // Current Instance
- HANDLE ghAccelTable = NULL; // Menu accelerators
- HMENU ghMenu = NULL; // Main Menu
- HWND ghwndMain = hwndNil; // Main Window
- HINSTANCE ghInstDll = NULL;
-
- HWND ghwndSbar = hwndNil; // Status bar window
- HWND ghwndMsg = hwndNil; // Message window
- HWND ghwndEntry = hwndNil; // szEntry Edit control
- HFONT ghfontEntry = hfontNil; // Font for edit control
-
- PREF gPref; // User preferences
- int gdxWndMin = 325; // maximum size of window
- int gdyWndMin = 250; // maximum size of window
-
- DWORD gdwFileId = FileIdNil; // ID of file being transferred
- int giCount = 0; // number of hConfNotify in the system
-
- HCONFNOTIFY grhConfNotify[10]; // array of handles to notification callback routines
-
- /* W I N M A I N */
- /*-------------------------------------------------------------------------
- %%Function: WinMain
-
- Main Windows entrypoint
-
- -------------------------------------------------------------------------*/
- int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hInstPrev, LPSTR lpszCmd, int nCmdShow)
- {
- WPARAM wResult;
-
- ghInst = hInstance;
-
- if (!FInitApp(lpszCmd))
- {
- return 0;
- }
-
- if (!FInitInstance(nCmdShow))
- {
- return 0;
- }
-
- wResult = MsgLoop(fTrue /* fForever */);
-
- return wResult;
- }
-
-
-
- /* M S G L O O P */
- /*-------------------------------------------------------------------------
- %%Function: MsgLoop
-
- Main message loop
- -------------------------------------------------------------------------*/
- WPARAM MsgLoop(BOOL fForever)
- {
- MSG msg;
-
- for ( ; ; )
- {
- if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
- {
- // Acquire and dispatch messages until a WM_QUIT message is received.
-
- if (!GetMessage(&msg, NULL, 0, 0))
- {
- break; // WM_QUIT received
- }
-
- if (!TranslateAccelerator(msg.hwnd, ghAccelTable, &msg))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- else if (fForever)
- {
- WaitMessage();
- }
- else
- {
- return 0;
- }
- }
- return msg.wParam;
- }