home *** CD-ROM | disk | FTP | other *** search
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- Copyright (c) 1998 Microsoft Corporation
-
- Module Name:
-
- winmain.cpp
-
- Abstract:
-
- Contains the Win32 Main entry point. Creates and initializes
- main Application class and sets up the message loop.
-
- Environment:
-
- AutoPC
-
- -------------------------------------------------------------------*/
- // System specific includes
- #include <windows.h>
- #include <olectl.h>
- #include <asfc.h>
- #include <ascmnctl.h>
-
- // Application specific includes
- #include "resource.h"
- #include "appsink.h"
- #include "app.h"
-
- // Global application class object
- CKeyboardApp* g_pApp = NULL;
-
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Function:
- WinMain
-
- Description:
- Main Win32 entry point. Creates and initializes main application
- class.
-
- Parameters:
- Standard Win32 Arguments.
-
- Returns:
- TRUE on app exit.
- -------------------------------------------------------------------*/
- int APIENTRY
- WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR szCmd, int nCmdShow)
- {
- MSG msg;
-
- // Peek message to ensure that thread is ready for PostThreadMsg calls
- PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
-
- // Create our new main application class object
- g_pApp = new CKeyboardApp(hInst);
-
- // GoTo quit if 'new' failed.
- if(!g_pApp)
- goto LReturn;
-
- // Call App's init function, quit if it failes.
- if(!g_pApp->Init())
- goto LReturn;
-
- // Message Loop
- while (GetMessage(&msg, NULL, 0, 0))
- {
- if (msg.hwnd)
- {
- DispatchMessage(&msg);
- }
- else
- {
- // Send any messages not directed towards main window to our
- // app's ProcessMessage function
- g_pApp->ProcessMessage(msg.message, msg.wParam, msg.lParam);
- }
- }
-
- LReturn:
-
- if(g_pApp)
- delete g_pApp;
-
- return TRUE;
- }
-