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.
-
- ---------------------------------------------------------------------- */
-
- #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 ghwndTbar = hwndNil; // Toolbar window
- 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
-
-
-
- /* W I N M A I N */
- /*-------------------------------------------------------------------------
- %%Function: WinMain
-
- Main Windows entrypoint
-
- FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
-
- PURPOSE: calls initialization function, processes message loop
-
- PARAMETERS:
-
- hInstance - The handle to the instance of this application that
- is currently being executed.
-
- hInstPrev - This parameter is always NULL in Win32
- applications.
-
- lpszCmd - A pointer to a null terminated string specifying the
- command line of the application.
-
- nCmdShow - Specifies how the main window is to be displayed.
-
- RETURN VALUE:
- If the function terminates before entering the message loop,
- return FALSE.
- Otherwise, return the WPARAM value sent by the WM_QUIT message.
-
-
- COMMENTS:
-
- Windows recognizes this function by name as the initial entry point
- for the program. This function calls the initialization routine.
- It then executes a message retrieval and dispatch loop that is the
- top-level control structure for the remainder of the program. The
- loop is terminated when a WM_QUIT message is received, at which
- time this function exits the application instance by returning the
- value passed by PostQuitMessage.
-
- If this function must abort before entering the message loop, it
- returns the conventional value NULL.
-
- -------------------------------------------------------------------------*/
- 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;
- }
-
-