source: trunk/Utilities/Miscellaneous/MfcWindowlessVideoRenderer01/MfcWindowlessVideoRenderer01.cpp

Last change on this file was 281, checked in by roman, 10 years ago
File size: 4.0 KB
Line 
1////////////////////////////////////////////////////////////
2// MfcWindowlessVideoRenderer01.cpp : Defines the class behaviors for the application.
3//
4// Copyright (C) Alax.Info, 2006-2008
5// http://alax.info
6//
7// A permission to use the source code is granted as long as reference to
8// source website http://alax.info is retained.
9//
10// Created by Roman Ryltsov roman@alax.info
11//
12// $Id: MfcWindowlessVideoRenderer01.cpp 14 2008-11-19 09:23:16Z alax $
13
14#include "stdafx.h"
15#include "MfcWindowlessVideoRenderer01.h"
16#include "MainDialog.h"
17#include <initguid.h>
18#include "MfcWindowlessVideoRenderer01_i.c"
19
20#ifdef _DEBUG
21#define new DEBUG_NEW
22#endif
23
24
25// CMyApplication
26
27
28class CMfcWindowlessVideoRenderer01Module :
29        public CAtlMfcModule
30{
31public:
32        DECLARE_LIBID(LIBID_MfcWindowlessVideoRenderer01Lib);
33        DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MFCWINDOWLESSVIDEORENDERER01, "{D7FFBC02-C09F-4708-9CEE-35F4CBB51D72}");};
34
35CMfcWindowlessVideoRenderer01Module _AtlModule;
36
37BEGIN_MESSAGE_MAP(CMyApplication, CWinAppEx)
38        ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
39END_MESSAGE_MAP()
40
41
42// CMyApplication construction
43
44CMyApplication::CMyApplication()
45{
46        // TODO: add construction code here,
47        // Place all significant initialization in InitInstance
48}
49
50
51// The one and only CMyApplication object
52
53CMyApplication theApp;
54
55
56// CMyApplication initialization
57
58BOOL CMyApplication::InitInstance()
59{
60        AfxOleInit();
61        // Parse command line for standard shell commands, DDE, file open
62        CCommandLineInfo cmdInfo;
63        ParseCommandLine(cmdInfo);
64        #if !defined(_WIN32_WCE) || defined(_CE_DCOM)
65        // Register class factories via CoRegisterClassObject().
66        if (FAILED(_AtlModule.RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE)))
67                return FALSE;
68        #endif // !defined(_WIN32_WCE) || defined(_CE_DCOM)
69        // App was launched with /Embedding or /Automation switch.
70        // Run app as automation server.
71        if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
72        {
73                // Don't show the main window
74                return TRUE;
75        }
76        // App was launched with /Unregserver or /Unregister switch.
77        if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
78        {
79                _AtlModule.UpdateRegistryAppId(FALSE);
80                _AtlModule.UnregisterServer(TRUE);
81                return FALSE;
82        }
83        // App was launched with /Register or /Regserver switch.
84        if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppRegister)
85        {
86                _AtlModule.UpdateRegistryAppId(TRUE);
87                _AtlModule.RegisterServer(TRUE);
88                return FALSE;
89        }
90        // InitCommonControlsEx() is required on Windows XP if an application
91        // manifest specifies use of ComCtl32.dll version 6 or later to enable
92        // visual styles.  Otherwise, any window creation will fail.
93        INITCOMMONCONTROLSEX InitCtrls;
94        InitCtrls.dwSize = sizeof(InitCtrls);
95        // Set this to include all the common control classes you want to use
96        // in your application.
97        InitCtrls.dwICC = ICC_WIN95_CLASSES;
98        InitCommonControlsEx(&InitCtrls);
99
100        CWinAppEx::InitInstance();
101
102        // Standard initialization
103        // If you are not using these features and wish to reduce the size
104        // of your final executable, you should remove from the following
105        // the specific initialization routines you do not need
106        // Change the registry key under which our settings are stored
107        // TODO: You should modify this string to be something appropriate
108        // such as the name of your company or organization
109        SetRegistryKey(_T("Local AppWizard-Generated Applications"));
110
111        CMainDialog dlg;
112        m_pMainWnd = &dlg;
113        INT_PTR nResponse = dlg.DoModal();
114        if (nResponse == IDOK)
115        {
116                // TODO: Place code here to handle when the dialog is
117                //  dismissed with OK
118        }
119        else if (nResponse == IDCANCEL)
120        {
121                // TODO: Place code here to handle when the dialog is
122                //  dismissed with Cancel
123        }
124
125        // Since the dialog has been closed, return FALSE so that we exit the
126        //  application, rather than start the application's message pump.
127        return FALSE;
128}
129
130BOOL CMyApplication::ExitInstance(void)
131{
132#if !defined(_WIN32_WCE) || defined(_CE_DCOM)
133        _AtlModule.RevokeClassObjects();
134#endif
135        return CWinApp::ExitInstance();
136}
Note: See TracBrowser for help on using the repository browser.