├── .gitignore ├── Demo ├── Demo.sln └── Demo │ ├── ChildFrm.cpp │ ├── ChildFrm.h │ ├── Demo.cpp │ ├── Demo.h │ ├── Demo.rc │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ ├── DemoDoc.cpp │ ├── DemoDoc.h │ ├── DemoView.cpp │ ├── DemoView.h │ ├── Log.cpp │ ├── Log.h │ ├── MainFrm.cpp │ ├── MainFrm.h │ ├── ProgressDlg.cpp │ ├── ProgressDlg.h │ ├── ReadMe.txt │ ├── Resource.h │ ├── UserImages.bmp │ ├── res │ ├── Demo.ico │ ├── Demo.rc2 │ ├── DemoDoc.ico │ ├── Toolbar.bmp │ └── Toolbar256.bmp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── DrawPlugin ├── Draw.sln └── Draw │ ├── Draw.cpp │ ├── Draw.def │ ├── Draw.h │ ├── Draw.rc │ ├── Draw.vcxproj │ ├── Draw.vcxproj.filters │ ├── DrawPlugin.cpp │ ├── DrawPlugin.h │ ├── ReadMe.txt │ ├── Resource.h │ ├── Shape.cpp │ ├── Shape.h │ ├── res │ └── Draw.rc2 │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ └── toolbar1.bmp ├── ImagePlugin ├── Image.sln └── Image │ ├── Image.cpp │ ├── Image.def │ ├── Image.h │ ├── Image.rc │ ├── Image.vcxproj │ ├── Image.vcxproj.filters │ ├── ImageDocument.cpp │ ├── ImageDocument.h │ ├── ImagePlugin.cpp │ ├── ImagePlugin.h │ ├── ImageView.cpp │ ├── ImageView.h │ ├── ReadMe.txt │ ├── Resource.h │ ├── res │ └── Image.rc2 │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── ImageProcessingPlugin ├── Process.sln └── Process │ ├── ImageProcessingPlugin.cpp │ ├── ImageProcessingPlugin.h │ ├── Process.cpp │ ├── Process.def │ ├── Process.h │ ├── Process.rc │ ├── Process.vcxproj │ ├── Process.vcxproj.filters │ ├── ReadMe.txt │ ├── res │ └── Process.rc2 │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── LevelPlugin ├── Level.sln └── Level │ ├── ItemInfo.cpp │ ├── ItemInfo.h │ ├── Level.cpp │ ├── Level.def │ ├── Level.h │ ├── Level.rc │ ├── Level.vcxproj │ ├── Level.vcxproj.filters │ ├── LevelDlg.cpp │ ├── LevelDlg.h │ ├── LevelPlugin.cpp │ ├── LevelPlugin.h │ ├── LevelSlider.cpp │ ├── LevelSlider.h │ ├── LevelWnd.cpp │ ├── LevelWnd.h │ ├── ReadMe.txt │ ├── res │ └── Level.rc2 │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ └── test.dat ├── PluginBrowser ├── PluginBrowser.sln └── PluginBrowser │ ├── Browser.cpp │ ├── Browser.h │ ├── ListViewPage.cpp │ ├── ListViewPage.h │ ├── PluginBrowser.cpp │ ├── PluginBrowser.def │ ├── PluginBrowser.h │ ├── PluginBrowser.rc │ ├── PluginBrowser.vcxproj │ ├── PluginBrowser.vcxproj.filters │ ├── PluginBrowserDlg.cpp │ ├── PluginBrowserDlg.h │ ├── ReadMe.txt │ ├── TreeViewPage.cpp │ ├── TreeViewPage.h │ ├── res │ └── PluginBrowser.rc2 │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── PluginSupport ├── PluginSupport.sln └── PluginSupport │ ├── PIDocManager.cpp │ ├── PIDocManager.h │ ├── PIDockablePane.cpp │ ├── PIDockablePane.h │ ├── PIDocument.cpp │ ├── PIDocument.h │ ├── PIMDIChildWndEx.cpp │ ├── PIMDIChildWndEx.h │ ├── PIMDIFrameWndEx.cpp │ ├── PIMDIFrameWndEx.h │ ├── PIMultiDocTemplate.cpp │ ├── PIMultiDocTemplate.h │ ├── PIToolBar.cpp │ ├── PIToolBar.h │ ├── PIView.cpp │ ├── PIView.h │ ├── PluginClass.cpp │ ├── PluginClass.h │ ├── PluginDefine.h │ ├── PluginImpl.cpp │ ├── PluginImpl.h │ ├── PluginLibrary.cpp │ ├── PluginLibrary.h │ ├── PluginSupport.cpp │ ├── PluginSupport.def │ ├── PluginSupport.h │ ├── PluginSupport.rc │ ├── PluginSupport.vcxproj │ ├── PluginSupport.vcxproj.filters │ ├── PluginWrapper.cpp │ ├── PluginWrapper.h │ ├── ReadMe.txt │ ├── Resource.h │ ├── res │ └── PluginSupport.rc2 │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | 18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 19 | !packages/*/build/ 20 | 21 | # MSTest test Results 22 | [Tt]est[Rr]esult*/ 23 | [Bb]uild[Ll]og.* 24 | 25 | *_i.c 26 | *_p.c 27 | *.ilk 28 | *.meta 29 | *.obj 30 | *.pch 31 | *.pdb 32 | *.pgc 33 | *.pgd 34 | *.rsp 35 | *.sbr 36 | *.tlb 37 | *.tli 38 | *.tlh 39 | *.tmp 40 | *.tmp_proj 41 | *.log 42 | *.vspscc 43 | *.vssscc 44 | .builds 45 | *.pidb 46 | *.log 47 | *.scc 48 | 49 | # Visual C++ cache files 50 | ipch/ 51 | *.aps 52 | *.ncb 53 | *.opensdf 54 | *.sdf 55 | *.cachefile 56 | 57 | # Visual Studio profiler 58 | *.psess 59 | *.vsp 60 | *.vspx 61 | 62 | # Guidance Automation Toolkit 63 | *.gpState 64 | 65 | # ReSharper is a .NET coding add-in 66 | _ReSharper*/ 67 | *.[Rr]e[Ss]harper 68 | 69 | # TeamCity is a build add-in 70 | _TeamCity* 71 | 72 | # DotCover is a Code Coverage Tool 73 | *.dotCover 74 | 75 | # NCrunch 76 | *.ncrunch* 77 | .*crunch*.local.xml 78 | 79 | # Installshield output folder 80 | [Ee]xpress/ 81 | 82 | # DocProject is a documentation generator add-in 83 | DocProject/buildhelp/ 84 | DocProject/Help/*.HxT 85 | DocProject/Help/*.HxC 86 | DocProject/Help/*.hhc 87 | DocProject/Help/*.hhk 88 | DocProject/Help/*.hhp 89 | DocProject/Help/Html2 90 | DocProject/Help/html 91 | 92 | # Click-Once directory 93 | publish/ 94 | 95 | # Publish Web Output 96 | *.Publish.xml 97 | *.pubxml 98 | 99 | # NuGet Packages Directory 100 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 101 | #packages/ 102 | 103 | # Windows Azure Build Output 104 | csx 105 | *.build.csdef 106 | 107 | # Windows Store app package directory 108 | AppPackages/ 109 | 110 | # Others 111 | sql/ 112 | *.Cache 113 | ClientBin/ 114 | [Ss]tyle[Cc]op.* 115 | ~$* 116 | *~ 117 | *.dbmdl 118 | *.[Pp]ublish.xml 119 | *.pfx 120 | *.publishsettings 121 | 122 | # RIA/Silverlight projects 123 | Generated_Code/ 124 | 125 | # Backup & report files from converting an old project file to a newer 126 | # Visual Studio version. Backup files are not needed, because we have git ;-) 127 | _UpgradeReport_Files/ 128 | Backup*/ 129 | UpgradeLog*.XML 130 | UpgradeLog*.htm 131 | 132 | # SQL Server files 133 | App_Data/*.mdf 134 | App_Data/*.ldf 135 | 136 | # ========================= 137 | # Windows detritus 138 | # ========================= 139 | 140 | # Windows image file caches 141 | Thumbs.db 142 | ehthumbs.db 143 | 144 | # Folder config file 145 | Desktop.ini 146 | 147 | # Recycle Bin used on file shares 148 | $RECYCLE.BIN/ 149 | 150 | # Mac crap 151 | .DS_Store 152 | -------------------------------------------------------------------------------- /Demo/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo\Demo.vcxproj", "{8C9B72ED-F1A7-4B45-A114-41C2CD8D417F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {8C9B72ED-F1A7-4B45-A114-41C2CD8D417F}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {8C9B72ED-F1A7-4B45-A114-41C2CD8D417F}.Debug|Win32.Build.0 = Debug|Win32 14 | {8C9B72ED-F1A7-4B45-A114-41C2CD8D417F}.Release|Win32.ActiveCfg = Release|Win32 15 | {8C9B72ED-F1A7-4B45-A114-41C2CD8D417F}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Demo/Demo/ChildFrm.cpp: -------------------------------------------------------------------------------- 1 | 2 | // ChildFrm.cpp : implementation of the CChildFrame class 3 | // 4 | 5 | #include "stdafx.h" 6 | #include "Demo.h" 7 | 8 | #include "ChildFrm.h" 9 | 10 | #ifdef _DEBUG 11 | #define new DEBUG_NEW 12 | #endif 13 | 14 | // CChildFrame 15 | 16 | IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx) 17 | 18 | BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx) 19 | END_MESSAGE_MAP() 20 | 21 | // CChildFrame construction/destruction 22 | 23 | CChildFrame::CChildFrame() 24 | { 25 | // TODO: add member initialization code here 26 | } 27 | 28 | CChildFrame::~CChildFrame() 29 | { 30 | 31 | } 32 | 33 | BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) 34 | { 35 | // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs 36 | if( !CMDIChildWndEx::PreCreateWindow(cs) ) 37 | return FALSE; 38 | 39 | return TRUE; 40 | } 41 | 42 | // CChildFrame diagnostics 43 | 44 | #ifdef _DEBUG 45 | void CChildFrame::AssertValid() const 46 | { 47 | CMDIChildWndEx::AssertValid(); 48 | } 49 | 50 | void CChildFrame::Dump(CDumpContext& dc) const 51 | { 52 | CMDIChildWndEx::Dump(dc); 53 | } 54 | #endif //_DEBUG 55 | 56 | // CChildFrame message handlers 57 | -------------------------------------------------------------------------------- /Demo/Demo/ChildFrm.h: -------------------------------------------------------------------------------- 1 | 2 | // ChildFrm.h : interface of the CChildFrame class 3 | // 4 | 5 | #pragma once 6 | 7 | class CChildFrame : public CMDIChildWndEx 8 | { 9 | DECLARE_DYNCREATE(CChildFrame) 10 | public: 11 | CChildFrame(); 12 | 13 | // Attributes 14 | public: 15 | 16 | // Operations 17 | public: 18 | 19 | // Overrides 20 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 21 | 22 | // Implementation 23 | public: 24 | virtual ~CChildFrame(); 25 | #ifdef _DEBUG 26 | virtual void AssertValid() const; 27 | virtual void Dump(CDumpContext& dc) const; 28 | #endif 29 | 30 | // Generated message map functions 31 | protected: 32 | DECLARE_MESSAGE_MAP() 33 | }; 34 | -------------------------------------------------------------------------------- /Demo/Demo/Demo.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Demo.cpp : Defines the class behaviors for the application. 3 | // 4 | 5 | #include "stdafx.h" 6 | #include "afxwinappex.h" 7 | #include "afxdialogex.h" 8 | #include "Demo.h" 9 | #include "MainFrm.h" 10 | 11 | #include "ChildFrm.h" 12 | #include "DemoDoc.h" 13 | #include "DemoView.h" 14 | #include "Log.h" 15 | 16 | #ifdef _DEBUG 17 | #define new DEBUG_NEW 18 | #endif 19 | 20 | 21 | // CDemoApp 22 | 23 | BEGIN_MESSAGE_MAP(CDemoApp, CWinAppEx) 24 | ON_COMMAND(ID_APP_ABOUT, &CDemoApp::OnAppAbout) 25 | // Standard file based document commands 26 | ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew) 27 | ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen) 28 | // Standard print setup command 29 | ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinAppEx::OnFilePrintSetup) 30 | ON_COMMAND(ID_LANGUAGE_ENG, &CDemoApp::OnLanguageEng) 31 | ON_UPDATE_COMMAND_UI(ID_LANGUAGE_ENG, &CDemoApp::OnUpdateLanguageEng) 32 | ON_COMMAND(ID_LANGUAGE_CHS, &CDemoApp::OnLanguageChs) 33 | ON_UPDATE_COMMAND_UI(ID_LANGUAGE_CHS, &CDemoApp::OnUpdateLanguageChs) 34 | END_MESSAGE_MAP() 35 | 36 | 37 | // CDemoApp construction 38 | 39 | CDemoApp::CDemoApp() 40 | { 41 | m_bHiColorIcons = TRUE; 42 | 43 | // support Restart Manager 44 | m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS; 45 | #ifdef _MANAGED 46 | // If the application is built using Common Language Runtime support (/clr): 47 | // 1) This additional setting is needed for Restart Manager support to work properly. 48 | // 2) In your project, you must add a reference to System.Windows.Forms in order to build. 49 | System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException); 50 | #endif 51 | 52 | // TODO: replace application ID string below with unique ID string; recommended 53 | // format for string is CompanyName.ProductName.SubProduct.VersionInformation 54 | SetAppID(_T("Demo.AppID.NoVersion")); 55 | 56 | // TODO: add construction code here, 57 | // Place all significant initialization in InitInstance 58 | } 59 | 60 | // The one and only CDemoApp object 61 | 62 | CDemoApp theApp; 63 | 64 | 65 | // CDemoApp initialization 66 | 67 | BOOL CDemoApp::InitInstance() 68 | { 69 | // InitCommonControlsEx() is required on Windows XP if an application 70 | // manifest specifies use of ComCtl32.dll version 6 or later to enable 71 | // visual styles. Otherwise, any window creation will fail. 72 | INITCOMMONCONTROLSEX InitCtrls; 73 | InitCtrls.dwSize = sizeof(InitCtrls); 74 | // Set this to include all the common control classes you want to use 75 | // in your application. 76 | InitCtrls.dwICC = ICC_WIN95_CLASSES; 77 | InitCommonControlsEx(&InitCtrls); 78 | 79 | CWinAppEx::InitInstance(); 80 | 81 | 82 | // Initialize OLE libraries 83 | if (!AfxOleInit()) 84 | { 85 | AfxMessageBox(IDP_OLE_INIT_FAILED); 86 | return FALSE; 87 | } 88 | 89 | AfxEnableControlContainer(); 90 | 91 | EnableTaskbarInteraction(); 92 | 93 | // AfxInitRichEdit2() is required to use RichEdit control 94 | // AfxInitRichEdit2(); 95 | 96 | // Standard initialization 97 | // If you are not using these features and wish to reduce the size 98 | // of your final executable, you should remove from the following 99 | // the specific initialization routines you do not need 100 | // Change the registry key under which our settings are stored 101 | // TODO: You should modify this string to be something appropriate 102 | // such as the name of your company or organization 103 | SetRegistryKey(_T("Local AppWizard-Generated Applications")); 104 | LoadStdProfileSettings(4); // Load standard INI file options (including MRU) 105 | 106 | // switch language 107 | SwitchLanguage(); 108 | 109 | // replace document manager 110 | ReplaceDocManager(); 111 | 112 | InitContextMenuManager(); 113 | 114 | InitKeyboardManager(); 115 | 116 | InitTooltipManager(); 117 | CMFCToolTipInfo ttParams; 118 | ttParams.m_bVislManagerTheme = TRUE; 119 | theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, 120 | RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); 121 | 122 | // Register the application's document templates. Document templates 123 | // serve as the connection between documents, frame windows and views 124 | /* CMultiDocTemplate* pDocTemplate; 125 | pDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME, 126 | RUNTIME_CLASS(CDemoDoc), 127 | RUNTIME_CLASS(CChildFrame), // custom MDI child frame 128 | RUNTIME_CLASS(CDemoView)); 129 | if (!pDocTemplate) 130 | return FALSE; 131 | AddDocTemplate(pDocTemplate);*/ 132 | 133 | // create main MDI Frame window 134 | CMainFrame* pMainFrame = new CMainFrame; 135 | if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) 136 | { 137 | delete pMainFrame; 138 | return FALSE; 139 | } 140 | m_pMainWnd = pMainFrame; 141 | 142 | 143 | // Parse command line for standard shell commands, DDE, file open 144 | CCommandLineInfo cmdInfo; 145 | cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; 146 | ParseCommandLine(cmdInfo); 147 | 148 | 149 | // Dispatch commands specified on the command line. Will return FALSE if 150 | // app was launched with /RegServer, /Register, /Unregserver or /Unregister. 151 | if (!ProcessShellCommand(cmdInfo)) 152 | return FALSE; 153 | // The main window has been initialized, so show and update it 154 | pMainFrame->ShowWindow(m_nCmdShow); 155 | pMainFrame->UpdateWindow(); 156 | 157 | PIInitPlugin(this); 158 | 159 | // register plugin document templates 160 | PIRegisterDocTemplates(); 161 | 162 | return TRUE; 163 | } 164 | 165 | int CDemoApp::ExitInstance() 166 | { 167 | //TODO: handle additional resources you may have added 168 | AfxOleTerm(FALSE); 169 | 170 | // int nResult = _CrtCheckMemory(); 171 | // _CrtDumpMemoryLeaks(); 172 | 173 | // removes all UI information about the application from registry 174 | CleanState(); 175 | 176 | return CWinAppEx::ExitInstance(); 177 | } 178 | 179 | // CDemoApp message handlers 180 | 181 | 182 | // CAboutDlg dialog used for App About 183 | 184 | class CAboutDlg : public CDialogEx 185 | { 186 | public: 187 | CAboutDlg(); 188 | 189 | // Dialog Data 190 | enum { IDD = IDD_ABOUTBOX }; 191 | 192 | protected: 193 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 194 | 195 | // Implementation 196 | protected: 197 | DECLARE_MESSAGE_MAP() 198 | }; 199 | 200 | CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD) 201 | { 202 | 203 | } 204 | 205 | void CAboutDlg::DoDataExchange(CDataExchange* pDX) 206 | { 207 | CDialogEx::DoDataExchange(pDX); 208 | } 209 | 210 | BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) 211 | END_MESSAGE_MAP() 212 | 213 | // App command to run the dialog 214 | void CDemoApp::OnAppAbout() 215 | { 216 | CAboutDlg aboutDlg; 217 | aboutDlg.DoModal(); 218 | } 219 | 220 | // CDemoApp customization load/save methods 221 | 222 | void CDemoApp::PreLoadState() 223 | { 224 | BOOL bNameValid; 225 | CString strName; 226 | bNameValid = strName.LoadString(IDS_EDIT_MENU); 227 | ASSERT(bNameValid); 228 | GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT); 229 | } 230 | 231 | void CDemoApp::LoadCustomState() 232 | { 233 | 234 | } 235 | 236 | void CDemoApp::SaveCustomState() 237 | { 238 | 239 | } 240 | 241 | // CDemoApp message handlers 242 | 243 | // write log 244 | void CDemoApp::WriteLog(CString strLog) 245 | { 246 | CLog::Out(strLog); 247 | } 248 | 249 | // replace default document manager 250 | void CDemoApp::ReplaceDocManager() 251 | { 252 | // make sure m_pDocManager hasn't been created 253 | ASSERT(m_pDocManager == NULL); 254 | // MFC only creates its own one if m_pDocManager is NULL 255 | // we replace the default doc manager 256 | m_pDocManager = new CPIDocManager; 257 | } 258 | 259 | void CDemoApp::RemovePluginDocTemplate() 260 | { 261 | CPIDocManager* pDocManager = (CPIDocManager*)m_pDocManager; 262 | pDocManager->RemovePluginDocTemplate(); 263 | } 264 | 265 | // switch language 266 | void CDemoApp::SwitchLanguage() 267 | { 268 | int nLanguage = GetProfileInt(_T("Settings"), _T("Language"), 0); 269 | 270 | LANGID id; 271 | if (nLanguage == 0) 272 | { 273 | id = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); 274 | } 275 | else 276 | { 277 | id = MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT); 278 | } 279 | SetThreadUILanguage(id); 280 | } 281 | 282 | void CDemoApp::OnLanguageEng() 283 | { 284 | WriteProfileInt(_T("Settings"), _T("Language"), 0); 285 | } 286 | 287 | void CDemoApp::OnUpdateLanguageEng(CCmdUI* pCmdUI) 288 | { 289 | int nLanguage = GetProfileInt(_T("Settings"), _T("Language"), 0); 290 | pCmdUI->SetCheck(nLanguage == 0); 291 | } 292 | 293 | void CDemoApp::OnLanguageChs() 294 | { 295 | WriteProfileInt(_T("Settings"), _T("Language"), 1); 296 | } 297 | 298 | void CDemoApp::OnUpdateLanguageChs(CCmdUI* pCmdUI) 299 | { 300 | int nLanguage = GetProfileInt(_T("Settings"), _T("Language"), 0); 301 | pCmdUI->SetCheck(nLanguage == 1); 302 | } 303 | -------------------------------------------------------------------------------- /Demo/Demo/Demo.h: -------------------------------------------------------------------------------- 1 | 2 | // Demo.h : main header file for the Demo application 3 | // 4 | #pragma once 5 | 6 | #ifndef __AFXWIN_H__ 7 | #error "include 'stdafx.h' before including this file for PCH" 8 | #endif 9 | 10 | #include "resource.h" // main symbols 11 | 12 | 13 | // CDemoApp: 14 | // See Demo.cpp for the implementation of this class 15 | // 16 | 17 | class CDemoApp : public CWinAppEx 18 | { 19 | public: 20 | CDemoApp(); 21 | 22 | 23 | // Overrides 24 | public: 25 | virtual BOOL InitInstance(); 26 | virtual int ExitInstance(); 27 | 28 | public: 29 | // write log 30 | void WriteLog(CString strLog); 31 | 32 | // replace document manager 33 | void ReplaceDocManager(); 34 | 35 | // remove plugin document template 36 | void RemovePluginDocTemplate(); 37 | 38 | // switch language 39 | void SwitchLanguage(); 40 | 41 | // Implementation 42 | UINT m_nAppLook; 43 | BOOL m_bHiColorIcons; 44 | 45 | virtual void PreLoadState(); 46 | virtual void LoadCustomState(); 47 | virtual void SaveCustomState(); 48 | 49 | afx_msg void OnAppAbout(); 50 | DECLARE_MESSAGE_MAP() 51 | afx_msg void OnLanguageEng(); 52 | afx_msg void OnUpdateLanguageEng(CCmdUI* pCmdUI); 53 | afx_msg void OnLanguageChs(); 54 | afx_msg void OnUpdateLanguageChs(CCmdUI* pCmdUI); 55 | }; 56 | 57 | extern CDemoApp theApp; 58 | -------------------------------------------------------------------------------- /Demo/Demo/Demo.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/Demo.rc -------------------------------------------------------------------------------- /Demo/Demo/Demo.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {8C9B72ED-F1A7-4B45-A114-41C2CD8D417F} 15 | Demo 16 | MFCProj 17 | 18 | 19 | 20 | Application 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | Application 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Use 53 | Level3 54 | Disabled 55 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 56 | true 57 | 58 | 59 | Windows 60 | true 61 | 62 | 63 | false 64 | true 65 | _DEBUG;%(PreprocessorDefinitions) 66 | 67 | 68 | 0x0409 69 | _DEBUG;%(PreprocessorDefinitions) 70 | $(IntDir);%(AdditionalIncludeDirectories) 71 | 72 | 73 | 74 | 75 | Level3 76 | Use 77 | MaxSpeed 78 | true 79 | true 80 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 81 | true 82 | 83 | 84 | Windows 85 | true 86 | true 87 | true 88 | 89 | 90 | false 91 | true 92 | NDEBUG;%(PreprocessorDefinitions) 93 | 94 | 95 | 0x0409 96 | NDEBUG;%(PreprocessorDefinitions) 97 | $(IntDir);%(AdditionalIncludeDirectories) 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | Create 125 | Create 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /Demo/Demo/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {9ca23451-d28b-47ba-a85a-8da9534de18f} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 头文件 26 | 27 | 28 | 头文件 29 | 30 | 31 | 头文件 32 | 33 | 34 | 头文件 35 | 36 | 37 | 头文件 38 | 39 | 40 | 头文件 41 | 42 | 43 | 头文件 44 | 45 | 46 | 头文件 47 | 48 | 49 | Support 50 | 51 | 52 | 头文件 53 | 54 | 55 | 56 | 57 | 源文件 58 | 59 | 60 | 源文件 61 | 62 | 63 | 源文件 64 | 65 | 66 | 源文件 67 | 68 | 69 | 源文件 70 | 71 | 72 | 源文件 73 | 74 | 75 | Support 76 | 77 | 78 | 源文件 79 | 80 | 81 | 82 | 83 | 资源文件 84 | 85 | 86 | 87 | 88 | 资源文件 89 | 90 | 91 | 资源文件 92 | 93 | 94 | 资源文件 95 | 96 | 97 | 资源文件 98 | 99 | 100 | 资源文件 101 | 102 | 103 | 104 | 105 | 资源文件 106 | 107 | 108 | -------------------------------------------------------------------------------- /Demo/Demo/DemoDoc.cpp: -------------------------------------------------------------------------------- 1 | 2 | // DemoDoc.cpp : implementation of the CDemoDoc class 3 | // 4 | 5 | #include "stdafx.h" 6 | // SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail 7 | // and search filter handlers and allows sharing of document code with that project. 8 | #ifndef SHARED_HANDLERS 9 | #include "Demo.h" 10 | #endif 11 | 12 | #include "DemoDoc.h" 13 | 14 | #include 15 | 16 | #ifdef _DEBUG 17 | #define new DEBUG_NEW 18 | #endif 19 | 20 | // CDemoDoc 21 | 22 | IMPLEMENT_DYNCREATE(CDemoDoc, CDocument) 23 | 24 | BEGIN_MESSAGE_MAP(CDemoDoc, CDocument) 25 | END_MESSAGE_MAP() 26 | 27 | 28 | // CDemoDoc construction/destruction 29 | 30 | CDemoDoc::CDemoDoc() 31 | { 32 | // TODO: add one-time construction code here 33 | 34 | } 35 | 36 | CDemoDoc::~CDemoDoc() 37 | { 38 | 39 | } 40 | 41 | BOOL CDemoDoc::OnNewDocument() 42 | { 43 | if (!CDocument::OnNewDocument()) 44 | return FALSE; 45 | 46 | // TODO: add reinitialization code here 47 | // (SDI documents will reuse this document) 48 | 49 | return TRUE; 50 | } 51 | 52 | // CDemoDoc serialization 53 | 54 | void CDemoDoc::Serialize(CArchive& ar) 55 | { 56 | if (ar.IsStoring()) 57 | { 58 | // TODO: add storing code here 59 | } 60 | else 61 | { 62 | // TODO: add loading code here 63 | } 64 | } 65 | 66 | #ifdef SHARED_HANDLERS 67 | 68 | // Support for thumbnails 69 | void CDemoDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds) 70 | { 71 | // Modify this code to draw the document's data 72 | dc.FillSolidRect(lprcBounds, RGB(255, 255, 255)); 73 | 74 | CString strText = _T("TODO: implement thumbnail drawing here"); 75 | LOGFONT lf; 76 | 77 | CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); 78 | pDefaultGUIFont->GetLogFont(&lf); 79 | lf.lfHeight = 36; 80 | 81 | CFont fontDraw; 82 | fontDraw.CreateFontIndirect(&lf); 83 | 84 | CFont* pOldFont = dc.SelectObject(&fontDraw); 85 | dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK); 86 | dc.SelectObject(pOldFont); 87 | } 88 | 89 | // Support for Search Handlers 90 | void CDemoDoc::InitializeSearchContent() 91 | { 92 | CString strSearchContent; 93 | // Set search contents from document's data. 94 | // The content parts should be separated by ";" 95 | 96 | // For example: strSearchContent = _T("point;rectangle;circle;ole object;"); 97 | SetSearchContent(strSearchContent); 98 | } 99 | 100 | void CDemoDoc::SetSearchContent(const CString& value) 101 | { 102 | if (value.IsEmpty()) 103 | { 104 | RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid); 105 | } 106 | else 107 | { 108 | CMFCFilterChunkValueImpl *pChunk = NULL; 109 | ATLTRY(pChunk = new CMFCFilterChunkValueImpl); 110 | if (pChunk != NULL) 111 | { 112 | pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT); 113 | SetChunkValue(pChunk); 114 | } 115 | } 116 | } 117 | 118 | #endif // SHARED_HANDLERS 119 | 120 | // CDemoDoc diagnostics 121 | 122 | #ifdef _DEBUG 123 | void CDemoDoc::AssertValid() const 124 | { 125 | CDocument::AssertValid(); 126 | } 127 | 128 | void CDemoDoc::Dump(CDumpContext& dc) const 129 | { 130 | CDocument::Dump(dc); 131 | } 132 | #endif //_DEBUG 133 | 134 | 135 | // CDemoDoc commands 136 | -------------------------------------------------------------------------------- /Demo/Demo/DemoDoc.h: -------------------------------------------------------------------------------- 1 | 2 | // DemoDoc.h : interface of the CDemoDoc class 3 | // 4 | 5 | 6 | #pragma once 7 | 8 | 9 | class CDemoDoc : public CDocument 10 | { 11 | protected: // create from serialization only 12 | CDemoDoc(); 13 | DECLARE_DYNCREATE(CDemoDoc) 14 | 15 | // Attributes 16 | public: 17 | 18 | // Operations 19 | public: 20 | 21 | // Overrides 22 | public: 23 | virtual BOOL OnNewDocument(); 24 | virtual void Serialize(CArchive& ar); 25 | #ifdef SHARED_HANDLERS 26 | virtual void InitializeSearchContent(); 27 | virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds); 28 | #endif // SHARED_HANDLERS 29 | 30 | // Implementation 31 | public: 32 | virtual ~CDemoDoc(); 33 | #ifdef _DEBUG 34 | virtual void AssertValid() const; 35 | virtual void Dump(CDumpContext& dc) const; 36 | #endif 37 | 38 | protected: 39 | 40 | // Generated message map functions 41 | protected: 42 | DECLARE_MESSAGE_MAP() 43 | 44 | #ifdef SHARED_HANDLERS 45 | // Helper function that sets search content for a Search Handler 46 | void SetSearchContent(const CString& value); 47 | #endif // SHARED_HANDLERS 48 | }; 49 | -------------------------------------------------------------------------------- /Demo/Demo/DemoView.cpp: -------------------------------------------------------------------------------- 1 | 2 | // DemoView.cpp : implementation of the CDemoView class 3 | // 4 | 5 | #include "stdafx.h" 6 | // SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail 7 | // and search filter handlers and allows sharing of document code with that project. 8 | #ifndef SHARED_HANDLERS 9 | #include "Demo.h" 10 | #endif 11 | 12 | #include "DemoDoc.h" 13 | #include "DemoView.h" 14 | 15 | #ifdef _DEBUG 16 | #define new DEBUG_NEW 17 | #endif 18 | 19 | 20 | // CDemoView 21 | 22 | IMPLEMENT_DYNCREATE(CDemoView, CPIView) 23 | 24 | BEGIN_MESSAGE_MAP(CDemoView, CPIView) 25 | // Standard printing commands 26 | ON_COMMAND(ID_FILE_PRINT, &CPIView::OnFilePrint) 27 | ON_COMMAND(ID_FILE_PRINT_DIRECT, &CPIView::OnFilePrint) 28 | ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CDemoView::OnFilePrintPreview) 29 | ON_WM_CONTEXTMENU() 30 | ON_WM_RBUTTONUP() 31 | END_MESSAGE_MAP() 32 | 33 | // CDemoView construction/destruction 34 | 35 | CDemoView::CDemoView() 36 | { 37 | // TODO: add construction code here 38 | 39 | } 40 | 41 | CDemoView::~CDemoView() 42 | { 43 | } 44 | 45 | BOOL CDemoView::PreCreateWindow(CREATESTRUCT& cs) 46 | { 47 | // TODO: Modify the Window class or styles here by modifying 48 | // the CREATESTRUCT cs 49 | 50 | return CPIView::PreCreateWindow(cs); 51 | } 52 | 53 | // CDemoView drawing 54 | 55 | void CDemoView::OnDraw(CDC* pDC) 56 | { 57 | CDemoDoc* pDoc = GetDocument(); 58 | ASSERT_VALID(pDoc); 59 | if (!pDoc) 60 | return; 61 | 62 | // TODO: add draw code for native data here 63 | CPIView::OnDraw(pDC); 64 | } 65 | 66 | // CDemoView printing 67 | 68 | void CDemoView::OnFilePrintPreview() 69 | { 70 | #ifndef SHARED_HANDLERS 71 | AFXPrintPreview(this); 72 | #endif 73 | } 74 | 75 | BOOL CDemoView::OnPreparePrinting(CPrintInfo* pInfo) 76 | { 77 | // default preparation 78 | return DoPreparePrinting(pInfo); 79 | } 80 | 81 | void CDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 82 | { 83 | // TODO: add extra initialization before printing 84 | } 85 | 86 | void CDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 87 | { 88 | // TODO: add cleanup after printing 89 | } 90 | 91 | void CDemoView::OnRButtonUp(UINT /* nFlags */, CPoint point) 92 | { 93 | ClientToScreen(&point); 94 | OnContextMenu(this, point); 95 | } 96 | 97 | void CDemoView::OnContextMenu(CWnd* /* pWnd */, CPoint point) 98 | { 99 | #ifndef SHARED_HANDLERS 100 | theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE); 101 | #endif 102 | } 103 | 104 | 105 | // CDemoView diagnostics 106 | 107 | #ifdef _DEBUG 108 | void CDemoView::AssertValid() const 109 | { 110 | CPIView::AssertValid(); 111 | } 112 | 113 | void CDemoView::Dump(CDumpContext& dc) const 114 | { 115 | CPIView::Dump(dc); 116 | } 117 | 118 | CDemoDoc* CDemoView::GetDocument() const // non-debug version is inline 119 | { 120 | ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDemoDoc))); 121 | return (CDemoDoc*)m_pDocument; 122 | } 123 | #endif //_DEBUG 124 | 125 | 126 | // CDemoView message handlers 127 | -------------------------------------------------------------------------------- /Demo/Demo/DemoView.h: -------------------------------------------------------------------------------- 1 | 2 | // DemoView.h : interface of the CDemoView class 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | class CDemoView : public CPIView 9 | { 10 | protected: // create from serialization only 11 | CDemoView(); 12 | DECLARE_DYNCREATE(CDemoView) 13 | 14 | // Attributes 15 | public: 16 | CDemoDoc* GetDocument() const; 17 | 18 | // Operations 19 | public: 20 | 21 | // Overrides 22 | public: 23 | virtual void OnDraw(CDC* pDC); // overridden to draw this view 24 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 25 | protected: 26 | virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); 27 | virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); 28 | virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); 29 | 30 | // Implementation 31 | public: 32 | virtual ~CDemoView(); 33 | #ifdef _DEBUG 34 | virtual void AssertValid() const; 35 | virtual void Dump(CDumpContext& dc) const; 36 | #endif 37 | 38 | protected: 39 | 40 | // Generated message map functions 41 | protected: 42 | afx_msg void OnFilePrintPreview(); 43 | afx_msg void OnRButtonUp(UINT nFlags, CPoint point); 44 | afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); 45 | DECLARE_MESSAGE_MAP() 46 | }; 47 | 48 | #ifndef _DEBUG // debug version in DemoView.cpp 49 | inline CDemoDoc* CDemoView::GetDocument() const 50 | { return reinterpret_cast(m_pDocument); } 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /Demo/Demo/Log.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/Log.cpp -------------------------------------------------------------------------------- /Demo/Demo/Log.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/Log.h -------------------------------------------------------------------------------- /Demo/Demo/MainFrm.cpp: -------------------------------------------------------------------------------- 1 | 2 | // MainFrm.cpp : implementation of the CMainFrame class 3 | // 4 | 5 | #include "stdafx.h" 6 | #include "Demo.h" 7 | 8 | #include "MainFrm.h" 9 | 10 | #ifdef _DEBUG 11 | #define new DEBUG_NEW 12 | #endif 13 | 14 | // CMainFrame 15 | 16 | IMPLEMENT_DYNAMIC(CMainFrame, CPIMDIFrameWndEx) 17 | 18 | const int iMaxUserToolbars = 10; 19 | const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40; 20 | const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1; 21 | 22 | BEGIN_MESSAGE_MAP(CMainFrame, CPIMDIFrameWndEx) 23 | ON_WM_CREATE() 24 | ON_COMMAND(ID_WINDOW_MANAGER, &CMainFrame::OnWindowManager) 25 | ON_COMMAND(ID_VIEW_CUSTOMIZE, &CMainFrame::OnViewCustomize) 26 | ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR, &CMainFrame::OnToolbarCreateNew) 27 | ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnApplicationLook) 28 | ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnUpdateApplicationLook) 29 | ON_MESSAGE(WM_MENU_EVENT, &CMainFrame::OnMenuEvent) 30 | ON_MESSAGE(WM_TOOLBAR_EVENT, &CMainFrame::OnToolbarEvent) 31 | ON_COMMAND(ID_INDICATOR_PROGRESS, &CMainFrame::OnIndicatorProgress) 32 | ON_WM_CLOSE() 33 | END_MESSAGE_MAP() 34 | 35 | static UINT indicators[] = 36 | { 37 | ID_INDICATOR_PROGRESS, // progress bar 38 | ID_SEPARATOR, // status line indicator 39 | ID_INDICATOR_CAPS, 40 | ID_INDICATOR_NUM, 41 | ID_INDICATOR_SCRL, 42 | }; 43 | 44 | // CMainFrame construction/destruction 45 | 46 | CMainFrame::CMainFrame() 47 | { 48 | // TODO: add member initialization code here 49 | theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_OFF_2007_BLACK); 50 | } 51 | 52 | CMainFrame::~CMainFrame() 53 | { 54 | 55 | } 56 | 57 | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 58 | { 59 | if (CPIMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) 60 | return -1; 61 | 62 | BOOL bNameValid; 63 | 64 | CMDITabInfo mdiTabParams; 65 | mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... 66 | mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area 67 | mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba 68 | mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs 69 | mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area 70 | EnableMDITabbedGroups(TRUE, mdiTabParams); 71 | 72 | if (!m_wndMenuBar.Create(this)) 73 | { 74 | TRACE0("Failed to create menubar\n"); 75 | return -1; // fail to create 76 | } 77 | 78 | m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); 79 | 80 | // prevent the menu bar from taking the focus on activation 81 | CMFCPopupMenu::SetForceMenuFocus(FALSE); 82 | 83 | if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || 84 | !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) 85 | { 86 | TRACE0("Failed to create toolbar\n"); 87 | return -1; // fail to create 88 | } 89 | 90 | CString strToolBarName; 91 | bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); 92 | ASSERT(bNameValid); 93 | m_wndToolBar.SetWindowText(strToolBarName); 94 | 95 | CString strCustomize; 96 | bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); 97 | ASSERT(bNameValid); 98 | m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); 99 | 100 | // Allow user-defined toolbars operations: 101 | InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId); 102 | 103 | if (!m_wndStatusBar.Create(this)) 104 | { 105 | TRACE0("Failed to create status bar\n"); 106 | return -1; // fail to create 107 | } 108 | m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); 109 | 110 | // TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable 111 | m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); 112 | m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); 113 | EnableDocking(CBRS_ALIGN_ANY); 114 | DockPane(&m_wndMenuBar); 115 | DockPane(&m_wndToolBar); 116 | 117 | 118 | // enable Visual Studio 2005 style docking window behavior 119 | CDockingManager::SetDockingMode(DT_SMART); 120 | // enable Visual Studio 2005 style docking window auto-hide behavior 121 | EnableAutoHidePanes(CBRS_ALIGN_ANY); 122 | // set the visual manager and style based on persisted value 123 | OnApplicationLook(theApp.m_nAppLook); 124 | 125 | // Enable enhanced windows management dialog 126 | EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); 127 | 128 | // Enable toolbar and docking window menu replacement 129 | EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); 130 | 131 | // enable quick (Alt+drag) toolbar customization 132 | CMFCToolBar::EnableQuickCustomization(); 133 | 134 | if (CMFCToolBar::GetUserImages() == NULL) 135 | { 136 | // load user-defined toolbar images 137 | if (m_UserImages.Load(_T(".\\UserImages.bmp"))) 138 | { 139 | CMFCToolBar::SetUserImages(&m_UserImages); 140 | } 141 | } 142 | 143 | // Switch the order of document name and application name on the window title bar. This 144 | // improves the usability of the taskbar because the document name is visible with the thumbnail. 145 | ModifyStyle(0, FWS_PREFIXTITLE); 146 | 147 | // Initialize StatusBar 148 | InitStatusBar(); 149 | 150 | return 0; 151 | } 152 | 153 | BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 154 | { 155 | if( !CPIMDIFrameWndEx::PreCreateWindow(cs) ) 156 | return FALSE; 157 | // TODO: Modify the Window class or styles here by modifying 158 | // the CREATESTRUCT cs 159 | 160 | return TRUE; 161 | } 162 | 163 | // CMainFrame diagnostics 164 | 165 | #ifdef _DEBUG 166 | void CMainFrame::AssertValid() const 167 | { 168 | CPIMDIFrameWndEx::AssertValid(); 169 | } 170 | 171 | void CMainFrame::Dump(CDumpContext& dc) const 172 | { 173 | CPIMDIFrameWndEx::Dump(dc); 174 | } 175 | #endif //_DEBUG 176 | 177 | 178 | // CMainFrame message handlers 179 | 180 | // Initialize StatusBar 181 | void CMainFrame::InitStatusBar() 182 | { 183 | m_wndStatusBar.SetPaneWidth(nStatusProgress, 100); 184 | m_wndStatusBar.EnablePaneProgressBar(nStatusProgress, 100L, TRUE); 185 | 186 | m_wndStatusBar.SetPaneStyle(nStatusInfo, SBPS_STRETCH | SBPS_NOBORDERS); 187 | 188 | m_wndStatusBar.EnablePaneDoubleClick(); 189 | } 190 | 191 | UINT ShowProgressDlgThread(LPVOID pParam) 192 | { 193 | CProgressDlg* pProgressDlg = (CProgressDlg*)pParam; 194 | pProgressDlg->DoModal(); 195 | 196 | return 0; 197 | } 198 | 199 | void CMainFrame::ProgressInit(int nProgressType, LPCTSTR lpszText, CDialog** pDialog) 200 | { 201 | CPIMDIFrameWndEx::ProgressInit(nProgressType, lpszText, pDialog); 202 | 203 | if (nProgressType == PI_PROGRESS_THREAD_DLG) 204 | { 205 | AfxBeginThread(ShowProgressDlgThread, &m_wndProgressDlg); 206 | *pDialog = &m_wndProgressDlg; 207 | } 208 | else if (nProgressType == PI_PROGRESS_NATIVE_DLG) 209 | { 210 | *pDialog = &m_wndProgressDlg; 211 | m_wndProgressDlg.SetCaption(lpszText); 212 | m_wndProgressDlg.DoModal(); 213 | } 214 | else if (nProgressType == PI_PROGRESS_BAR) 215 | { 216 | m_wndStatusBar.SetTipText(nStatusProgress, lpszText); 217 | m_wndStatusBar.EnablePaneProgressBar(nStatusProgress, 100L, TRUE); 218 | } 219 | } 220 | 221 | BOOL CMainFrame::ProgressPercent(int nPercent) 222 | { 223 | if (GetProgressType() == PI_PROGRESS_THREAD_DLG || GetProgressType() == PI_PROGRESS_NATIVE_DLG) 224 | { 225 | if (m_wndProgressDlg.GetSafeHwnd()) 226 | { 227 | m_wndProgressDlg.SetPercent(nPercent); 228 | } 229 | } 230 | else if (GetProgressType() == PI_PROGRESS_BAR) 231 | { 232 | m_wndStatusBar.SetPaneProgress(nStatusProgress, nPercent); 233 | } 234 | 235 | return CPIMDIFrameWndEx::ProgressPercent(nPercent); 236 | } 237 | 238 | void CMainFrame::ProgressDone() 239 | { 240 | CPIMDIFrameWndEx::ProgressDone(); 241 | 242 | if (GetProgressType() == PI_PROGRESS_THREAD_DLG || GetProgressType() == PI_PROGRESS_NATIVE_DLG) 243 | { 244 | if (m_wndProgressDlg.GetSafeHwnd()) 245 | { 246 | m_wndProgressDlg.SendMessage(WM_CLOSE); 247 | } 248 | } 249 | else if (GetProgressType() == PI_PROGRESS_BAR) 250 | { 251 | m_wndStatusBar.SetPaneProgress(nStatusProgress, 0); 252 | m_wndStatusBar.SetTipText(nStatusProgress, NULL); 253 | } 254 | } 255 | 256 | void CMainFrame::OnWindowManager() 257 | { 258 | ShowWindowsDialog(); 259 | } 260 | 261 | void CMainFrame::OnViewCustomize() 262 | { 263 | CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* scan menus */); 264 | pDlgCust->EnableUserDefinedToolbars(); 265 | pDlgCust->Create(); 266 | } 267 | 268 | LRESULT CMainFrame::OnToolbarCreateNew(WPARAM wp,LPARAM lp) 269 | { 270 | LRESULT lres = CPIMDIFrameWndEx::OnToolbarCreateNew(wp,lp); 271 | if (lres == 0) 272 | { 273 | return 0; 274 | } 275 | 276 | CMFCToolBar* pUserToolbar = (CMFCToolBar*)lres; 277 | ASSERT_VALID(pUserToolbar); 278 | 279 | BOOL bNameValid; 280 | CString strCustomize; 281 | bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); 282 | ASSERT(bNameValid); 283 | 284 | pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); 285 | return lres; 286 | } 287 | 288 | void CMainFrame::OnApplicationLook(UINT id) 289 | { 290 | CWaitCursor wait; 291 | 292 | theApp.m_nAppLook = id; 293 | 294 | switch (theApp.m_nAppLook) 295 | { 296 | case ID_VIEW_APPLOOK_WIN_2000: 297 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager)); 298 | break; 299 | 300 | case ID_VIEW_APPLOOK_OFF_XP: 301 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP)); 302 | break; 303 | 304 | case ID_VIEW_APPLOOK_WIN_XP: 305 | CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE; 306 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); 307 | break; 308 | 309 | case ID_VIEW_APPLOOK_OFF_2003: 310 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003)); 311 | CDockingManager::SetDockingMode(DT_SMART); 312 | break; 313 | 314 | case ID_VIEW_APPLOOK_VS_2005: 315 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005)); 316 | CDockingManager::SetDockingMode(DT_SMART); 317 | break; 318 | 319 | case ID_VIEW_APPLOOK_VS_2008: 320 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008)); 321 | CDockingManager::SetDockingMode(DT_SMART); 322 | break; 323 | 324 | case ID_VIEW_APPLOOK_WINDOWS_7: 325 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7)); 326 | CDockingManager::SetDockingMode(DT_SMART); 327 | break; 328 | 329 | default: 330 | switch (theApp.m_nAppLook) 331 | { 332 | case ID_VIEW_APPLOOK_OFF_2007_BLUE: 333 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); 334 | break; 335 | 336 | case ID_VIEW_APPLOOK_OFF_2007_BLACK: 337 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); 338 | break; 339 | 340 | case ID_VIEW_APPLOOK_OFF_2007_SILVER: 341 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); 342 | break; 343 | 344 | case ID_VIEW_APPLOOK_OFF_2007_AQUA: 345 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua); 346 | break; 347 | } 348 | 349 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); 350 | CDockingManager::SetDockingMode(DT_SMART); 351 | } 352 | 353 | RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); 354 | 355 | theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook); 356 | } 357 | 358 | void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI) 359 | { 360 | pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID); 361 | } 362 | 363 | BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) 364 | { 365 | // base class does the real work 366 | 367 | if (!CPIMDIFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext)) 368 | { 369 | return FALSE; 370 | } 371 | 372 | // enable customization button for all user toolbars 373 | BOOL bNameValid; 374 | CString strCustomize; 375 | bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); 376 | ASSERT(bNameValid); 377 | 378 | for (int i = 0; i < iMaxUserToolbars; i ++) 379 | { 380 | CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i); 381 | if (pUserToolbar != NULL) 382 | { 383 | pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); 384 | } 385 | } 386 | 387 | return TRUE; 388 | } 389 | 390 | void CMainFrame::OnClose() 391 | { 392 | CDemoApp* pApp = (CDemoApp*)AfxGetApp(); 393 | pApp->RemovePluginDocTemplate(); 394 | 395 | CPIMDIFrameWndEx::OnClose(); 396 | } 397 | 398 | LRESULT CMainFrame::OnMenuEvent(WPARAM wParam, LPARAM lParam) 399 | { 400 | BOOL bFlag = (BOOL)wParam; 401 | ASSERT(lParam != NULL); 402 | 403 | if (bFlag) 404 | { 405 | // create menu 406 | CMenu* pMenu = (CMenu*)lParam; 407 | m_wndMenuBar.CreateFromMenu(*pMenu, FALSE, TRUE); 408 | } 409 | else 410 | { 411 | // return menu 412 | HMENU* pMenu = (HMENU*)lParam; 413 | *pMenu = m_wndMenuBar.GetHMenu(); 414 | } 415 | 416 | return 0; 417 | } 418 | 419 | LRESULT CMainFrame::OnToolbarEvent(WPARAM wParam, LPARAM lParam) 420 | { 421 | BOOL bFlag = (BOOL)wParam; 422 | ToolbarInfo* pInfo = (ToolbarInfo*)lParam; 423 | ASSERT(pInfo != NULL); 424 | 425 | // save current resource handle 426 | HINSTANCE hCurrentInstance = AfxGetResourceHandle(); 427 | AfxSetResourceHandle(pInfo->hInstance); 428 | 429 | int nCommandCount = 0; 430 | if (bFlag) 431 | { 432 | // merge toolbar 433 | CPIToolBar PluginToolBar; 434 | // if (PluginToolBar.LoadToolBarExtend(pInfo->nIDResource, pInfo->nCommandIDIndex - 4)) 435 | if (PluginToolBar.LoadToolBar(pInfo->nIDResource)) 436 | { 437 | nCommandCount = PluginToolBar.GetCount(); 438 | for (int i=0; inPluginIndex, nID); 447 | if (nVirtualID) 448 | { 449 | CString str; 450 | str.LoadString(pInfo->hInstance, nID); 451 | CMFCToolBarButton ToolBarButton(nVirtualID, iImage, str); 452 | if (m_wndToolBar.InsertButton(ToolBarButton) == -1) 453 | { 454 | TRACE(_T("Plugin: InsertButton id = %d failed!\n"), nID); 455 | } 456 | 457 | // PluginToolBar.RemapImage(nVirtualID, iImage); 458 | // m_wndToolBar.ResetImages() 459 | } 460 | } 461 | m_wndToolBar.RestoreOriginalState(); 462 | } 463 | } 464 | else 465 | { 466 | // insert toolbar 467 | CPIToolBar* pToolBar = new CPIToolBar(); 468 | if (!pToolBar->CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || 469 | !pToolBar->LoadToolBar(pInfo->nIDResource)) 470 | { 471 | TRACE(_T("Plugin: InsertToolbar resource = %d failed!\n"), pInfo->nIDResource); 472 | return -1; 473 | } 474 | nCommandCount = pToolBar->GetCount(); 475 | for (int i=0; iGetButtonInfo(i, nID, nStyle, iImage); 481 | 482 | // replace command id 483 | pToolBar->SetButtonInfo(i, pInfo->nCommandIDIndex + i, nStyle, iImage); 484 | // set button text 485 | CString str; 486 | str.LoadString(pInfo->hInstance, nID); 487 | pToolBar->SetButtonText(i, str); 488 | // add new command 489 | PIAddNewCommand(pInfo->nPluginIndex, nID); 490 | } 491 | 492 | pToolBar->SetWindowText(pInfo->strText); 493 | pToolBar->EnableDocking(CBRS_ALIGN_ANY); 494 | 495 | // DockPane(&m_wndToolBar); 496 | // DockPaneLeftOf(pToolBar, &m_wndToolBar); 497 | DockPane(pToolBar); 498 | DockPaneLeftOf(&m_wndToolBar, pToolBar); 499 | 500 | // add to toolbar array 501 | m_ToolBarArray.Add(pToolBar); 502 | } 503 | 504 | // restore resource handle 505 | AfxSetResourceHandle(hCurrentInstance); 506 | 507 | return nCommandCount; 508 | } 509 | 510 | void CMainFrame::GetMessageString(UINT nID, CString& rMessage) const 511 | { 512 | if (nID >= PLUGIN_COMMAND_BEGIN && nID <= PLUGIN_COMMAND_END) 513 | { 514 | PIGetCommandString(nID, rMessage); 515 | return; 516 | } 517 | 518 | return CPIMDIFrameWndEx::GetMessageString(nID, rMessage); 519 | } 520 | 521 | void CMainFrame::OnIndicatorProgress() 522 | { 523 | SetProgressThreadRunning(FALSE); 524 | 525 | m_wndStatusBar.SetPaneProgress(nStatusProgress, 0); 526 | m_wndStatusBar.SetTipText(nStatusProgress, NULL); 527 | } -------------------------------------------------------------------------------- /Demo/Demo/MainFrm.h: -------------------------------------------------------------------------------- 1 | 2 | // MainFrm.h : interface of the CMainFrame class 3 | // 4 | 5 | #pragma once 6 | 7 | #include "ProgressDlg.h" 8 | 9 | typedef CArray ToolBarArray; 10 | 11 | const int nStatusProgress = 0; 12 | const int nStatusInfo = 1; 13 | 14 | class CMainFrame : public CPIMDIFrameWndEx 15 | { 16 | DECLARE_DYNAMIC(CMainFrame) 17 | public: 18 | CMainFrame(); 19 | 20 | // Attributes 21 | public: 22 | 23 | // Operations 24 | public: 25 | // Initialize StatusBar 26 | void InitStatusBar(); 27 | 28 | // Overrides 29 | public: 30 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 31 | virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL); 32 | 33 | virtual void ProgressInit(int nProgressType, LPCTSTR lpszText, CDialog** pDialog); 34 | virtual BOOL ProgressPercent(int nPercent); 35 | virtual void ProgressDone(); 36 | 37 | // Implementation 38 | public: 39 | virtual ~CMainFrame(); 40 | #ifdef _DEBUG 41 | virtual void AssertValid() const; 42 | virtual void Dump(CDumpContext& dc) const; 43 | #endif 44 | 45 | protected: // control bar embedded members 46 | CMFCMenuBar m_wndMenuBar; 47 | CMFCToolBar m_wndToolBar; 48 | CMFCStatusBar m_wndStatusBar; 49 | CMFCToolBarImages m_UserImages; 50 | 51 | CProgressDlg m_wndProgressDlg; 52 | 53 | private: 54 | // plugin toolbar 55 | ToolBarArray m_ToolBarArray; 56 | 57 | // Generated message map functions 58 | protected: 59 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 60 | afx_msg void OnWindowManager(); 61 | afx_msg void OnViewCustomize(); 62 | afx_msg LRESULT OnToolbarCreateNew(WPARAM wp, LPARAM lp); 63 | afx_msg void OnApplicationLook(UINT id); 64 | afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI); 65 | afx_msg void OnClose(); 66 | afx_msg LRESULT OnMenuEvent(WPARAM wParam, LPARAM lParam); 67 | afx_msg LRESULT OnToolbarEvent(WPARAM wParam, LPARAM lParam); 68 | afx_msg void OnIndicatorProgress(); 69 | DECLARE_MESSAGE_MAP() 70 | public: 71 | virtual void GetMessageString(UINT nID, CString& rMessage) const; 72 | }; 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Demo/ProgressDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/ProgressDlg.cpp -------------------------------------------------------------------------------- /Demo/Demo/ProgressDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/ProgressDlg.h -------------------------------------------------------------------------------- /Demo/Demo/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | MICROSOFT FOUNDATION CLASS LIBRARY : Demo Project Overview 3 | =============================================================================== 4 | 5 | The application wizard has created this Demo application for 6 | you. This application not only demonstrates the basics of using the Microsoft 7 | Foundation Classes but is also a starting point for writing your application. 8 | 9 | This file contains a summary of what you will find in each of the files that 10 | make up your Demo application. 11 | 12 | Demo.vcxproj 13 | This is the main project file for VC++ projects generated using an application wizard. 14 | It contains information about the version of Visual C++ that generated the file, and 15 | information about the platforms, configurations, and project features selected with the 16 | application wizard. 17 | 18 | Demo.vcxproj.filters 19 | This is the filters file for VC++ projects generated using an Application Wizard. 20 | It contains information about the association between the files in your project 21 | and the filters. This association is used in the IDE to show grouping of files with 22 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 23 | "Source Files" filter). 24 | 25 | Demo.h 26 | This is the main header file for the application. It includes other 27 | project specific headers (including Resource.h) and declares the 28 | CDemoApp application class. 29 | 30 | Demo.cpp 31 | This is the main application source file that contains the application 32 | class CDemoApp. 33 | 34 | Demo.rc 35 | This is a listing of all of the Microsoft Windows resources that the 36 | program uses. It includes the icons, bitmaps, and cursors that are stored 37 | in the RES subdirectory. This file can be directly edited in Microsoft 38 | Visual C++. Your project resources are in 1033. 39 | 40 | res\Demo.ico 41 | This is an icon file, which is used as the application's icon. This 42 | icon is included by the main resource file Demo.rc. 43 | 44 | res\Demo.rc2 45 | This file contains resources that are not edited by Microsoft 46 | Visual C++. You should place all resources not editable by 47 | the resource editor in this file. 48 | 49 | ///////////////////////////////////////////////////////////////////////////// 50 | 51 | For the main frame window: 52 | The project includes a standard MFC interface. 53 | 54 | MainFrm.h, MainFrm.cpp 55 | These files contain the frame class CMainFrame, which is derived from 56 | CMDIFrameWnd and controls all MDI frame features. 57 | 58 | res\Toolbar.bmp 59 | This bitmap file is used to create tiled images for the toolbar. 60 | The initial toolbar and status bar are constructed in the CMainFrame 61 | class. Edit this toolbar bitmap using the resource editor, and 62 | update the IDR_MAINFRAME TOOLBAR array in Demo.rc to add 63 | toolbar buttons. 64 | ///////////////////////////////////////////////////////////////////////////// 65 | 66 | For the child frame window: 67 | 68 | ChildFrm.h, ChildFrm.cpp 69 | These files define and implement the CChildFrame class, which 70 | supports the child windows in an MDI application. 71 | 72 | ///////////////////////////////////////////////////////////////////////////// 73 | 74 | The application wizard creates one document type and one view: 75 | 76 | DemoDoc.h, DemoDoc.cpp - the document 77 | These files contain your CDemoDoc class. Edit these files to 78 | add your special document data and to implement file saving and loading 79 | (via CDemoDoc::Serialize). 80 | 81 | DemoView.h, DemoView.cpp - the view of the document 82 | These files contain your CDemoView class. 83 | CDemoView objects are used to view CDemoDoc objects. 84 | 85 | res\DemoDoc.ico 86 | This is an icon file, which is used as the icon for MDI child windows 87 | for the CDemoDoc class. This icon is included by the main 88 | resource file Demo.rc. 89 | 90 | 91 | 92 | ///////////////////////////////////////////////////////////////////////////// 93 | 94 | Other Features: 95 | 96 | ActiveX Controls 97 | The application includes support to use ActiveX controls. 98 | 99 | Printing and Print Preview support 100 | The application wizard has generated code to handle the print, print setup, and print preview 101 | commands by calling member functions in the CView class from the MFC library. 102 | 103 | ///////////////////////////////////////////////////////////////////////////// 104 | 105 | Other standard files: 106 | 107 | StdAfx.h, StdAfx.cpp 108 | These files are used to build a precompiled header (PCH) file 109 | named Demo.pch and a precompiled types file named StdAfx.obj. 110 | 111 | Resource.h 112 | This is the standard header file, which defines new resource IDs. 113 | Microsoft Visual C++ reads and updates this file. 114 | 115 | Demo.manifest 116 | Application manifest files are used by Windows XP to describe an applications 117 | dependency on specific versions of Side-by-Side assemblies. The loader uses this 118 | information to load the appropriate assembly from the assembly cache or private 119 | from the application. The Application manifest maybe included for redistribution 120 | as an external .manifest file that is installed in the same folder as the application 121 | executable or it may be included in the executable in the form of a resource. 122 | ///////////////////////////////////////////////////////////////////////////// 123 | 124 | Other notes: 125 | 126 | The application wizard uses "TODO:" to indicate parts of the source code you 127 | should add to or customize. 128 | 129 | If your application uses MFC in a shared DLL, you will need 130 | to redistribute the MFC DLLs. If your application is in a language 131 | other than the operating system's locale, you will also have to 132 | redistribute the corresponding localized resources mfc110XXX.DLL. 133 | For more information on both of these topics, please see the section on 134 | redistributing Visual C++ applications in MSDN documentation. 135 | 136 | ///////////////////////////////////////////////////////////////////////////// 137 | -------------------------------------------------------------------------------- /Demo/Demo/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/Resource.h -------------------------------------------------------------------------------- /Demo/Demo/UserImages.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/UserImages.bmp -------------------------------------------------------------------------------- /Demo/Demo/res/Demo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/res/Demo.ico -------------------------------------------------------------------------------- /Demo/Demo/res/Demo.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/res/Demo.rc2 -------------------------------------------------------------------------------- /Demo/Demo/res/DemoDoc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/res/DemoDoc.ico -------------------------------------------------------------------------------- /Demo/Demo/res/Toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/res/Toolbar.bmp -------------------------------------------------------------------------------- /Demo/Demo/res/Toolbar256.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/Demo/Demo/res/Toolbar256.bmp -------------------------------------------------------------------------------- /Demo/Demo/stdafx.cpp: -------------------------------------------------------------------------------- 1 | 2 | // stdafx.cpp : source file that includes just the standard includes 3 | // Demo.pch will be the pre-compiled header 4 | // stdafx.obj will contain the pre-compiled type information 5 | 6 | #include "stdafx.h" 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demo/Demo/stdafx.h: -------------------------------------------------------------------------------- 1 | 2 | // stdafx.h : include file for standard system include files, 3 | // or project specific include files that are used frequently, 4 | // but are changed infrequently 5 | 6 | #pragma once 7 | 8 | #ifndef VC_EXTRALEAN 9 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 10 | #endif 11 | 12 | #include "targetver.h" 13 | 14 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 15 | 16 | // turns off MFC's hiding of some common and often safely ignored warning messages 17 | #define _AFX_ALL_WARNINGS 18 | 19 | #include // MFC core and standard components 20 | #include // MFC extensions 21 | 22 | 23 | #include // MFC Automation classes 24 | 25 | 26 | 27 | #ifndef _AFX_NO_OLE_SUPPORT 28 | #include // MFC support for Internet Explorer 4 Common Controls 29 | #endif 30 | #ifndef _AFX_NO_AFXCMN_SUPPORT 31 | #include // MFC support for Windows Common Controls 32 | #endif // _AFX_NO_AFXCMN_SUPPORT 33 | 34 | #include // MFC support for ribbons and control bars 35 | 36 | 37 | 38 | 39 | 40 | #include "..\\..\\PluginSupport\\PluginSupport\\PluginImpl.h" 41 | 42 | 43 | 44 | #ifdef _UNICODE 45 | #if defined _M_IX86 46 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 47 | #elif defined _M_X64 48 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 49 | #else 50 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 51 | #endif 52 | #endif 53 | 54 | 55 | -------------------------------------------------------------------------------- /Demo/Demo/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /DrawPlugin/Draw.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Draw", "Draw\Draw.vcxproj", "{BA5C840D-BC84-4868-B478-0D720C330DE4}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {BA5C840D-BC84-4868-B478-0D720C330DE4}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {BA5C840D-BC84-4868-B478-0D720C330DE4}.Debug|Win32.Build.0 = Debug|Win32 14 | {BA5C840D-BC84-4868-B478-0D720C330DE4}.Release|Win32.ActiveCfg = Release|Win32 15 | {BA5C840D-BC84-4868-B478-0D720C330DE4}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /DrawPlugin/Draw/Draw.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/Draw.cpp -------------------------------------------------------------------------------- /DrawPlugin/Draw/Draw.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/Draw.def -------------------------------------------------------------------------------- /DrawPlugin/Draw/Draw.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/Draw.h -------------------------------------------------------------------------------- /DrawPlugin/Draw/Draw.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/Draw.rc -------------------------------------------------------------------------------- /DrawPlugin/Draw/Draw.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {BA5C840D-BC84-4868-B478-0D720C330DE4} 15 | Draw 16 | MFCDLLProj 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Use 53 | Level3 54 | Disabled 55 | WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) 56 | true 57 | 58 | 59 | Windows 60 | true 61 | .\Draw.def 62 | 63 | 64 | false 65 | _DEBUG;%(PreprocessorDefinitions) 66 | 67 | 68 | 0x0804 69 | _DEBUG;%(PreprocessorDefinitions) 70 | $(IntDir);%(AdditionalIncludeDirectories) 71 | 72 | 73 | mkdir $(SolutionDir)..\\Demo\\Debug 74 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Debug 75 | 76 | 77 | 78 | 79 | Level3 80 | Use 81 | MaxSpeed 82 | true 83 | true 84 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) 85 | true 86 | 87 | 88 | Windows 89 | true 90 | true 91 | true 92 | .\Draw.def 93 | 94 | 95 | false 96 | NDEBUG;%(PreprocessorDefinitions) 97 | 98 | 99 | 0x0804 100 | NDEBUG;%(PreprocessorDefinitions) 101 | $(IntDir);%(AdditionalIncludeDirectories) 102 | 103 | 104 | mkdir $(SolutionDir)..\\Demo\\Release 105 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Release 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | Create 117 | Create 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /DrawPlugin/Draw/Draw.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 源文件 32 | 33 | 34 | 35 | 36 | 头文件 37 | 38 | 39 | 头文件 40 | 41 | 42 | 头文件 43 | 44 | 45 | 头文件 46 | 47 | 48 | 头文件 49 | 50 | 51 | 头文件 52 | 53 | 54 | 55 | 56 | 源文件 57 | 58 | 59 | 资源文件 60 | 61 | 62 | 63 | 64 | 资源文件 65 | 66 | 67 | -------------------------------------------------------------------------------- /DrawPlugin/Draw/DrawPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "DrawPlugin.h" 3 | #include "Draw.h" 4 | 5 | IMPLEMENT_PLUGIN(CDrawPlugin) 6 | 7 | void CDrawPlugin::Init() 8 | { 9 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 10 | 11 | // merge menu 12 | CMenu append; 13 | append.LoadMenu(IDR_DRAW_MENU); 14 | MergeMenu(&append, TRUE); 15 | 16 | // merge toolbar 17 | MergeToolbar(IDR_DRAW_TOOLBAR); 18 | } 19 | 20 | void CDrawPlugin::Query(CPluginInfo& plugininfo) 21 | { 22 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 23 | 24 | plugininfo.m_strName = _T("Draw Plugin"); 25 | plugininfo.m_strBlurb = _T("Hello, world!"); 26 | plugininfo.m_strHelp = _T("For Test Merge Menu & Merge Toolbar"); 27 | plugininfo.m_strAuthor = _T("Wang Hao"); 28 | plugininfo.m_strCopyRight = _T("Copyright WangHao"); 29 | plugininfo.m_strDate = _T("2014.3.19"); 30 | CString str; 31 | str.LoadString(IDS_STRING_MENU_LABEL); 32 | plugininfo.m_strMenuLabel = str; 33 | } 34 | 35 | #define PEN_WIDTH 2 36 | void CDrawPlugin::Draw(CDC* pDC) 37 | { 38 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 39 | 40 | CDrawApp* pApp = (CDrawApp*)AfxGetApp(); 41 | CWnd* pWnd = pDC->GetWindow(); 42 | CShape* pShape = pApp->GetCurrentShape(pWnd); 43 | 44 | if (pApp->m_shpFlag != CShape::NONE && pShape) 45 | { 46 | CRect rect; 47 | pApp->GetMainWnd()->GetClientRect(&rect); 48 | 49 | CDC memDC; 50 | memDC.CreateCompatibleDC(pDC); 51 | 52 | CBitmap bitmap; 53 | bitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height()); 54 | 55 | memDC.SelectObject(&bitmap); 56 | memDC.FillSolidRect(&rect, GetSysColor(COLOR_WINDOW)); 57 | 58 | CPen pen; 59 | if (!pen.CreatePen(PS_SOLID, PEN_WIDTH, RGB(0,0,0))) 60 | { 61 | return; 62 | } 63 | CPen* pOldPen = memDC.SelectObject(&pen); 64 | 65 | pShape->Draw(&memDC); 66 | 67 | memDC.SelectObject(pOldPen); 68 | 69 | pDC->BitBlt(0, 0, rect.Width(), rect.Height(), &memDC, 0, 0, SRCCOPY); 70 | 71 | bitmap.DeleteObject(); 72 | memDC.DeleteDC(); 73 | } 74 | } -------------------------------------------------------------------------------- /DrawPlugin/Draw/DrawPlugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CDrawPlugin : public CPlugin 4 | { 5 | DECLARE_PLUGIN(CDrawPlugin) 6 | 7 | private: 8 | CDrawPlugin(){} 9 | 10 | public: 11 | virtual void Init(); 12 | 13 | virtual void Query(CPluginInfo& plugininfo); 14 | 15 | virtual void Draw(CDC* pDC); 16 | }; -------------------------------------------------------------------------------- /DrawPlugin/Draw/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MICROSOFT 基础类库 : Draw 项目概述 3 | ======================================================================== 4 | 5 | 6 | 应用程序向导已为您创建了此 Draw DLL。此 DLL 不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写 DLL 的起点。 7 | 8 | 本文件概要介绍组成 Draw DLL 的每个文件的内容。 9 | 10 | Draw.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | Draw.vcxproj.filters 14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 15 | 16 | Draw.h 17 | 这是 DLL 的主头文件。它声明了 CDrawApp 类。 18 | 19 | Draw.cpp 20 | 这是主 DLL 源文件。它包含 CDrawApp 类。 21 | 22 | Draw.rc 23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。 24 | 25 | res\Draw.rc2 26 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。 27 | 28 | Draw.def 29 | 此文件包含在 Microsoft Windows 中运行所必需的 DLL 的有关信息。它定义了 DLL 的名称和说明等参数,而且还从 DLL 导出函数。 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | 其他标准文件: 33 | 34 | StdAfx.h, StdAfx.cpp 35 | 这些文件用于生成名为 Draw.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 36 | 37 | Resource.h 38 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | 其他注释: 42 | 43 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /DrawPlugin/Draw/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Draw.rc 4 | // 5 | #define IDS_STRING_MENU_LABEL 1 6 | #define IDR_DRAW_MENU 8000 7 | #define IDR_DRAW_TOOLBAR 8003 8 | #define ID_DRAW_LINE 32771 9 | #define ID_DRAW_STROKE 32772 10 | #define ID_DRAW_RECTANGLE 32773 11 | #define ID_DRAW_ELLIPSE 32774 12 | 13 | // Next default values for new objects 14 | // 15 | #ifdef APSTUDIO_INVOKED 16 | #ifndef APSTUDIO_READONLY_SYMBOLS 17 | #define _APS_NEXT_RESOURCE_VALUE 8005 18 | #define _APS_NEXT_COMMAND_VALUE 32775 19 | #define _APS_NEXT_CONTROL_VALUE 8000 20 | #define _APS_NEXT_SYMED_VALUE 8000 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /DrawPlugin/Draw/Shape.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "Shape.h" 3 | 4 | BOOL CLine::Draw(CDC* pDC) 5 | { 6 | pDC->MoveTo(m_ptFirst); 7 | pDC->LineTo(m_ptSecond); 8 | 9 | return TRUE; 10 | } 11 | 12 | BOOL CLine::Init(CPoint point) 13 | { 14 | m_ptFirst = m_ptSecond = point; 15 | return TRUE; 16 | } 17 | 18 | BOOL CLine::UpdatePoint(CPoint point) 19 | { 20 | m_ptSecond = point; 21 | return TRUE; 22 | } 23 | ////////////////////////////////////////////////////////////////////////// 24 | 25 | CStroke::CStroke() 26 | { 27 | m_pointArray.RemoveAll(); 28 | } 29 | 30 | BOOL CStroke::Init(CPoint point) 31 | { 32 | m_pointArray.Add(point); 33 | m_pointArray.Add(point); 34 | return TRUE; 35 | } 36 | 37 | BOOL CStroke::UpdatePoint(CPoint point) 38 | { 39 | m_pointArray.Add(point); 40 | return TRUE; 41 | } 42 | 43 | BOOL CStroke::Draw(CDC* pDC) 44 | { 45 | pDC->MoveTo(m_pointArray[0]); 46 | for (int i=1; iLineTo(m_pointArray[i]); 49 | } 50 | return TRUE; 51 | } 52 | 53 | ////////////////////////////////////////////////////////////////////////// 54 | 55 | BOOL CRectAngle::Draw(CDC* pDC) 56 | { 57 | CBrush* brush = CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH)); 58 | CBrush* pOldBrush = pDC->SelectObject(brush); 59 | pDC->Rectangle(m_ptFirst.x, m_ptFirst.y, m_ptSecond.x, m_ptSecond.y); 60 | pDC->SelectObject(pOldBrush); 61 | 62 | return TRUE; 63 | } 64 | 65 | BOOL CRectAngle::Init(CPoint point) 66 | { 67 | m_ptFirst = m_ptSecond = point; 68 | return TRUE; 69 | } 70 | 71 | BOOL CRectAngle::UpdatePoint(CPoint point) 72 | { 73 | m_ptSecond = point; 74 | return TRUE; 75 | } 76 | ////////////////////////////////////////////////////////////////////////// 77 | 78 | BOOL CEllipse::Init(CPoint point) 79 | { 80 | m_ptFirst = m_ptSecond = point; 81 | return TRUE; 82 | } 83 | 84 | BOOL CEllipse::UpdatePoint(CPoint point) 85 | { 86 | m_ptSecond = point; 87 | return TRUE; 88 | } 89 | 90 | BOOL CEllipse::Draw(CDC* pDC) 91 | { 92 | CBrush* brush = CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH)); 93 | CBrush* pOldBrush = pDC->SelectObject(brush); 94 | pDC->Ellipse(m_ptFirst.x, m_ptFirst.y, m_ptSecond.x, m_ptSecond.y); 95 | pDC->SelectObject(pOldBrush); 96 | 97 | return TRUE; 98 | } 99 | -------------------------------------------------------------------------------- /DrawPlugin/Draw/Shape.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CShape 4 | { 5 | public: 6 | virtual BOOL Draw(CDC* pDC)=0; 7 | virtual BOOL Init(CPoint point)=0; 8 | virtual BOOL UpdatePoint(CPoint point)=0; 9 | 10 | public: 11 | enum shape{ 12 | NONE = 0, 13 | LINE = 1, 14 | STROKE = 2, 15 | RECTANGLE = 3, 16 | ELLIPSE = 4 17 | }; 18 | }; 19 | 20 | class CLine : public CShape 21 | { 22 | public: 23 | CPoint m_ptFirst; 24 | CPoint m_ptSecond; 25 | 26 | public: 27 | virtual BOOL Draw(CDC* pDC); 28 | virtual BOOL Init(CPoint point); 29 | virtual BOOL UpdatePoint(CPoint point); 30 | }; 31 | 32 | class CStroke : public CShape 33 | { 34 | public: 35 | CStroke(); 36 | 37 | // Attributes 38 | public: 39 | CArray m_pointArray; 40 | 41 | // Operations 42 | public: 43 | virtual BOOL Draw(CDC* pDC); 44 | virtual BOOL Init(CPoint point); 45 | virtual BOOL UpdatePoint(CPoint point); 46 | }; 47 | 48 | class CRectAngle : public CShape 49 | { 50 | public: 51 | CPoint m_ptFirst; 52 | CPoint m_ptSecond; 53 | 54 | public: 55 | virtual BOOL Draw(CDC* pDC); 56 | virtual BOOL Init(CPoint point); 57 | virtual BOOL UpdatePoint(CPoint point); 58 | }; 59 | 60 | class CEllipse : public CShape 61 | { 62 | public: 63 | CPoint m_ptFirst; 64 | CPoint m_ptSecond; 65 | 66 | public: 67 | virtual BOOL Draw(CDC* pDC); 68 | virtual BOOL Init(CPoint point); 69 | virtual BOOL UpdatePoint(CPoint point); 70 | }; 71 | 72 | -------------------------------------------------------------------------------- /DrawPlugin/Draw/res/Draw.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/res/Draw.rc2 -------------------------------------------------------------------------------- /DrawPlugin/Draw/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/stdafx.cpp -------------------------------------------------------------------------------- /DrawPlugin/Draw/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/stdafx.h -------------------------------------------------------------------------------- /DrawPlugin/Draw/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/targetver.h -------------------------------------------------------------------------------- /DrawPlugin/Draw/toolbar1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/DrawPlugin/Draw/toolbar1.bmp -------------------------------------------------------------------------------- /ImagePlugin/Image.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Image", "Image\Image.vcxproj", "{CD8D2BD4-C1F4-40BF-91A2-D1A6C9548376}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CD8D2BD4-C1F4-40BF-91A2-D1A6C9548376}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {CD8D2BD4-C1F4-40BF-91A2-D1A6C9548376}.Debug|Win32.Build.0 = Debug|Win32 14 | {CD8D2BD4-C1F4-40BF-91A2-D1A6C9548376}.Release|Win32.ActiveCfg = Release|Win32 15 | {CD8D2BD4-C1F4-40BF-91A2-D1A6C9548376}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /ImagePlugin/Image/Image.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/Image.cpp -------------------------------------------------------------------------------- /ImagePlugin/Image/Image.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/Image.def -------------------------------------------------------------------------------- /ImagePlugin/Image/Image.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/Image.h -------------------------------------------------------------------------------- /ImagePlugin/Image/Image.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/Image.rc -------------------------------------------------------------------------------- /ImagePlugin/Image/Image.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {CD8D2BD4-C1F4-40BF-91A2-D1A6C9548376} 15 | Image 16 | MFCDLLProj 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Use 53 | Level3 54 | Disabled 55 | WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) 56 | true 57 | 58 | 59 | Windows 60 | true 61 | .\Image.def 62 | 63 | 64 | false 65 | _DEBUG;%(PreprocessorDefinitions) 66 | 67 | 68 | 0x0804 69 | _DEBUG;%(PreprocessorDefinitions) 70 | $(IntDir);%(AdditionalIncludeDirectories) 71 | 72 | 73 | mkdir $(SolutionDir)..\\Demo\\Debug 74 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Debug 75 | 76 | 77 | 78 | 79 | Level3 80 | Use 81 | MaxSpeed 82 | true 83 | true 84 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) 85 | true 86 | 87 | 88 | Windows 89 | true 90 | true 91 | true 92 | .\Image.def 93 | 94 | 95 | false 96 | NDEBUG;%(PreprocessorDefinitions) 97 | 98 | 99 | 0x0804 100 | NDEBUG;%(PreprocessorDefinitions) 101 | $(IntDir);%(AdditionalIncludeDirectories) 102 | 103 | 104 | mkdir $(SolutionDir)..\\Demo\\Release 105 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Release 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | Create 118 | Create 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /ImagePlugin/Image/Image.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 源文件 32 | 33 | 34 | 源文件 35 | 36 | 37 | 38 | 39 | 头文件 40 | 41 | 42 | 头文件 43 | 44 | 45 | 头文件 46 | 47 | 48 | 头文件 49 | 50 | 51 | 头文件 52 | 53 | 54 | 头文件 55 | 56 | 57 | 头文件 58 | 59 | 60 | 61 | 62 | 源文件 63 | 64 | 65 | 资源文件 66 | 67 | 68 | 69 | 70 | 资源文件 71 | 72 | 73 | -------------------------------------------------------------------------------- /ImagePlugin/Image/ImageDocument.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/ImageDocument.cpp -------------------------------------------------------------------------------- /ImagePlugin/Image/ImageDocument.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/ImageDocument.h -------------------------------------------------------------------------------- /ImagePlugin/Image/ImagePlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ImagePlugin.h" 3 | #include "Image.h" 4 | 5 | IMPLEMENT_PLUGIN(CImagePlugin) 6 | 7 | void CImagePlugin::Query(CPluginInfo& plugininfo) 8 | { 9 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 10 | 11 | plugininfo.m_strName = _T("ImagePlugin"); 12 | plugininfo.m_strBlurb = _T("Add Image DocTemplate"); 13 | plugininfo.m_strHelp = _T("For Image MultiDocTemplate"); 14 | plugininfo.m_strAuthor = _T("Rolin"); 15 | plugininfo.m_strCopyRight = _T("Copyright Rolin"); 16 | plugininfo.m_strDate = _T("2014.3.20"); 17 | CString str; 18 | str.LoadString(IDS_STRING_MENU_LABEL); 19 | plugininfo.m_strMenuLabel = str; 20 | } 21 | 22 | int CImagePlugin::GetDocTemplateCount() 23 | { 24 | return 1; 25 | } 26 | 27 | CPIMultiDocTemplate* CImagePlugin::GetDocTemplate(int nIndex) 28 | { 29 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 30 | 31 | CImageApp* pApp = (CImageApp*)AfxGetApp(); 32 | return pApp->GetDocTemplate(); 33 | } -------------------------------------------------------------------------------- /ImagePlugin/Image/ImagePlugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CImagePlugin : public CPlugin 4 | { 5 | DECLARE_PLUGIN(CImagePlugin) 6 | 7 | private: 8 | CImagePlugin(){} 9 | 10 | public: 11 | virtual void Query(CPluginInfo& plugininfo); 12 | 13 | virtual int GetDocTemplateCount(); 14 | 15 | virtual CPIMultiDocTemplate* GetDocTemplate(int nIndex); 16 | }; -------------------------------------------------------------------------------- /ImagePlugin/Image/ImageView.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/ImageView.cpp -------------------------------------------------------------------------------- /ImagePlugin/Image/ImageView.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/ImageView.h -------------------------------------------------------------------------------- /ImagePlugin/Image/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MICROSOFT 基础类库 : Image 项目概述 3 | ======================================================================== 4 | 5 | 6 | 应用程序向导已为您创建了此 Image DLL。此 DLL 不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写 DLL 的起点。 7 | 8 | 本文件概要介绍组成 Image DLL 的每个文件的内容。 9 | 10 | Image.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | Image.vcxproj.filters 14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 15 | 16 | Image.h 17 | 这是 DLL 的主头文件。它声明了 CImageApp 类。 18 | 19 | Image.cpp 20 | 这是主 DLL 源文件。它包含 CImageApp 类。 21 | 22 | Image.rc 23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。 24 | 25 | res\Image.rc2 26 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。 27 | 28 | Image.def 29 | 此文件包含在 Microsoft Windows 中运行所必需的 DLL 的有关信息。它定义了 DLL 的名称和说明等参数,而且还从 DLL 导出函数。 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | 其他标准文件: 33 | 34 | StdAfx.h, StdAfx.cpp 35 | 这些文件用于生成名为 Image.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 36 | 37 | Resource.h 38 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | 其他注释: 42 | 43 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /ImagePlugin/Image/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Image.rc 4 | // 5 | #define IDS_STRING_MENU_LABEL 10000 6 | #define IDR_IMAGE 10001 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | 13 | #define _APS_NEXT_RESOURCE_VALUE 10001 14 | #define _APS_NEXT_COMMAND_VALUE 32771 15 | #define _APS_NEXT_CONTROL_VALUE 10000 16 | #define _APS_NEXT_SYMED_VALUE 10000 17 | #endif 18 | #endif 19 | -------------------------------------------------------------------------------- /ImagePlugin/Image/res/Image.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/res/Image.rc2 -------------------------------------------------------------------------------- /ImagePlugin/Image/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/stdafx.cpp -------------------------------------------------------------------------------- /ImagePlugin/Image/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/stdafx.h -------------------------------------------------------------------------------- /ImagePlugin/Image/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImagePlugin/Image/targetver.h -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Process", "Process\Process.vcxproj", "{F1FC2011-B5F1-4E1D-BBD8-48CAB30E0373}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {F1FC2011-B5F1-4E1D-BBD8-48CAB30E0373}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {F1FC2011-B5F1-4E1D-BBD8-48CAB30E0373}.Debug|Win32.Build.0 = Debug|Win32 14 | {F1FC2011-B5F1-4E1D-BBD8-48CAB30E0373}.Release|Win32.ActiveCfg = Release|Win32 15 | {F1FC2011-B5F1-4E1D-BBD8-48CAB30E0373}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/ImageProcessingPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ImageProcessingPlugin.h" 3 | #include "Process.h" 4 | 5 | IMPLEMENT_PLUGIN(CImageProcessingPlugin) 6 | 7 | void CImageProcessingPlugin::Init() 8 | { 9 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 10 | 11 | // merge menu 12 | CMenu append; 13 | append.LoadMenu(IDR_PROCESS_MENU); 14 | MergeMenu(&append, TRUE); 15 | } 16 | 17 | void CImageProcessingPlugin::Query(CPluginInfo& plugininfo) 18 | { 19 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 20 | 21 | plugininfo.m_strName = _T("ImageProcessingPlugin"); 22 | plugininfo.m_strBlurb = _T("Process Image"); 23 | plugininfo.m_strHelp = _T("For Image Processing"); 24 | plugininfo.m_strAuthor = _T("Rolin"); 25 | plugininfo.m_strCopyRight = _T("Copyright Rolin"); 26 | plugininfo.m_strDate = _T("2014.6.9"); 27 | CString str; 28 | str.LoadString(IDS_STRING_MENU_LABEL); 29 | plugininfo.m_strMenuLabel = str; 30 | } -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/ImageProcessingPlugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CImageProcessingPlugin : public CPlugin 4 | { 5 | DECLARE_PLUGIN(CImageProcessingPlugin) 6 | 7 | private: 8 | CImageProcessingPlugin(){} 9 | 10 | public: 11 | virtual void Init(); 12 | 13 | virtual void Query(CPluginInfo& plugininfo); 14 | }; -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/Process.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/Process.cpp -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/Process.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/Process.def -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/Process.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/Process.h -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/Process.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/Process.rc -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/Process.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {F1FC2011-B5F1-4E1D-BBD8-48CAB30E0373} 15 | Process 16 | MFCDLLProj 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Use 53 | Level3 54 | Disabled 55 | WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) 56 | true 57 | 58 | 59 | Windows 60 | true 61 | .\Process.def 62 | 63 | 64 | false 65 | _DEBUG;%(PreprocessorDefinitions) 66 | 67 | 68 | 0x0804 69 | _DEBUG;%(PreprocessorDefinitions) 70 | $(IntDir);%(AdditionalIncludeDirectories) 71 | 72 | 73 | mkdir $(SolutionDir)..\\Demo\\Debug 74 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Debug 75 | 76 | 77 | 78 | 79 | Level3 80 | Use 81 | MaxSpeed 82 | true 83 | true 84 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) 85 | true 86 | 87 | 88 | Windows 89 | true 90 | true 91 | true 92 | .\Process.def 93 | 94 | 95 | false 96 | NDEBUG;%(PreprocessorDefinitions) 97 | 98 | 99 | 0x0804 100 | NDEBUG;%(PreprocessorDefinitions) 101 | $(IntDir);%(AdditionalIncludeDirectories) 102 | 103 | 104 | mkdir $(SolutionDir)..\\Demo\\Release 105 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Release 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | Create 116 | Create 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/Process.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 32 | 33 | 头文件 34 | 35 | 36 | 头文件 37 | 38 | 39 | 头文件 40 | 41 | 42 | 头文件 43 | 44 | 45 | 头文件 46 | 47 | 48 | 49 | 50 | 源文件 51 | 52 | 53 | 资源文件 54 | 55 | 56 | 57 | 58 | 资源文件 59 | 60 | 61 | -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MICROSOFT 基础类库 : Process 项目概述 3 | ======================================================================== 4 | 5 | 6 | 应用程序向导已为您创建了此 Process DLL。此 DLL 不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写 DLL 的起点。 7 | 8 | 本文件概要介绍组成 Process DLL 的每个文件的内容。 9 | 10 | Process.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | Process.vcxproj.filters 14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 15 | 16 | Process.h 17 | 这是 DLL 的主头文件。它声明了 CProcessApp 类。 18 | 19 | Process.cpp 20 | 这是主 DLL 源文件。它包含 CProcessApp 类。 21 | 22 | Process.rc 23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。 24 | 25 | res\Process.rc2 26 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。 27 | 28 | Process.def 29 | 此文件包含在 Microsoft Windows 中运行所必需的 DLL 的有关信息。它定义了 DLL 的名称和说明等参数,而且还从 DLL 导出函数。 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | 其他标准文件: 33 | 34 | StdAfx.h, StdAfx.cpp 35 | 这些文件用于生成名为 Process.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 36 | 37 | Resource.h 38 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | 其他注释: 42 | 43 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/res/Process.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/res/Process.rc2 -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/resource.h -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/stdafx.cpp -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/stdafx.h -------------------------------------------------------------------------------- /ImageProcessingPlugin/Process/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/ImageProcessingPlugin/Process/targetver.h -------------------------------------------------------------------------------- /LevelPlugin/Level.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Level", "Level\Level.vcxproj", "{9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|Mixed Platforms = Debug|Mixed Platforms 10 | Debug|Win32 = Debug|Win32 11 | Release|Any CPU = Release|Any CPU 12 | Release|Mixed Platforms = Release|Mixed Platforms 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Debug|Any CPU.ActiveCfg = Debug|Win32 17 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 18 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 19 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Debug|Win32.ActiveCfg = Debug|Win32 20 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Debug|Win32.Build.0 = Debug|Win32 21 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Release|Any CPU.ActiveCfg = Release|Win32 22 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 23 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Release|Mixed Platforms.Build.0 = Release|Win32 24 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Release|Win32.ActiveCfg = Release|Win32 25 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D}.Release|Win32.Build.0 = Release|Win32 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /LevelPlugin/Level/ItemInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ItemInfo.h" 3 | 4 | 5 | CItemInfo::CItemInfo(const ItemType& eType, const ItemPosition& ePosition, const CRect& rect, const UINT& nID, 6 | const UINT& nSourceID , const int& nSourceNum, const ItemExStyle& eExStyle, 7 | int nMinIndex, BOOL bMinFlag, int nMinDis, int nMaxIndex, BOOL bMaxFlag, int nMaxDis, CWnd* pItem) 8 | { 9 | m_eType = eType; 10 | m_ePosition = ePosition; 11 | m_Rect = rect; 12 | m_nID = nID; 13 | m_nSourceID = nSourceID; 14 | m_nSourceNum = nSourceNum; 15 | m_eExStyle =eExStyle; 16 | m_nMinIndex = nMinIndex; 17 | m_bMinFlag = bMinFlag; 18 | m_nMinDis = nMinDis; 19 | m_nMaxIndex = nMaxIndex; 20 | m_bMaxFlag =bMaxFlag; 21 | m_nMaxDis = nMaxDis; 22 | m_pItem = pItem; 23 | } 24 | 25 | CItemInfo::~CItemInfo(void) 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /LevelPlugin/Level/ItemInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | enum ItemType{LEVEL_BUTTON = 300, LEVEL_COMBOBOX, LEVEL_TEXT, LEVEL_BAR, LEVEL_HISTOGRAM, LEVEL_EDIT, LEVEL_SLDWND}; 3 | enum ItemPosition{LEFT_STATIC = 400, RIGHT_STATIC, BOTTOM_STATIC, LEFT_CHANGE, BOTTOM_CHANGE,BOTTOM_MEDIAN, BOTTOM_RIGHT}; 4 | enum ItemExStyle{NONE=500, COL_BLACK, COL_GRAY, COL_WHITE}; 5 | 6 | 7 | class CItemInfo 8 | { 9 | public: 10 | CItemInfo(const ItemType& eType, const ItemPosition& ePosition, const CRect& rect, const UINT& nID = 0, 11 | const UINT& nSourceID = 0, const int& nSourceNum = 0, const ItemExStyle& eExStyle = NONE, 12 | int nMinIndex = 0, BOOL bMinFlag=FALSE, int nMinDis=0, int nMaxIndex = 0,BOOL bMaxFlag = FALSE, int nMaxDis = 0, CWnd* pItem = NULL); 13 | ~CItemInfo(void); 14 | 15 | public: 16 | ItemType m_eType; 17 | ItemPosition m_ePosition; 18 | CRect m_Rect; 19 | UINT m_nID; 20 | UINT m_nSourceID; 21 | int m_nSourceNum; 22 | ItemExStyle m_eExStyle; 23 | int m_nMinIndex; 24 | BOOL m_bMinFlag; 25 | int m_nMinDis; 26 | int m_nMaxIndex; 27 | BOOL m_bMaxFlag; 28 | int m_nMaxDis; 29 | CWnd* m_pItem; 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /LevelPlugin/Level/Level.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/Level.cpp -------------------------------------------------------------------------------- /LevelPlugin/Level/Level.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/Level.def -------------------------------------------------------------------------------- /LevelPlugin/Level/Level.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/Level.h -------------------------------------------------------------------------------- /LevelPlugin/Level/Level.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/Level.rc -------------------------------------------------------------------------------- /LevelPlugin/Level/Level.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {9FC49A8C-C4BF-4854-82BE-BB0DCF9EC53D} 15 | Level 16 | MFCDLLProj 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | $(SolutionDir)$(Configuration)\ 47 | 48 | 49 | false 50 | 51 | 52 | 53 | Use 54 | Level3 55 | Disabled 56 | WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) 57 | true 58 | true 59 | 60 | 61 | Windows 62 | true 63 | .\Level.def 64 | 65 | 66 | false 67 | _DEBUG;%(PreprocessorDefinitions) 68 | 69 | 70 | 0x0804 71 | _DEBUG;%(PreprocessorDefinitions) 72 | $(IntDir);%(AdditionalIncludeDirectories) 73 | 74 | 75 | true 76 | 77 | 78 | mkdir $(SolutionDir)..\\Demo\\Debug 79 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Debug 80 | 81 | 82 | 83 | 84 | Level3 85 | Use 86 | MaxSpeed 87 | true 88 | true 89 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) 90 | true 91 | 92 | 93 | Windows 94 | true 95 | true 96 | true 97 | .\Level.def 98 | 99 | 100 | false 101 | NDEBUG;%(PreprocessorDefinitions) 102 | 103 | 104 | 0x0804 105 | NDEBUG;%(PreprocessorDefinitions) 106 | $(IntDir);%(AdditionalIncludeDirectories) 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Create 121 | Create 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /LevelPlugin/Level/Level.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 源文件 32 | 33 | 34 | 源文件 35 | 36 | 37 | 源文件 38 | 39 | 40 | 源文件 41 | 42 | 43 | 44 | 45 | 头文件 46 | 47 | 48 | 头文件 49 | 50 | 51 | 头文件 52 | 53 | 54 | 头文件 55 | 56 | 57 | 头文件 58 | 59 | 60 | 头文件 61 | 62 | 63 | 头文件 64 | 65 | 66 | 头文件 67 | 68 | 69 | 头文件 70 | 71 | 72 | 73 | 74 | 源文件 75 | 76 | 77 | 资源文件 78 | 79 | 80 | 81 | 82 | 资源文件 83 | 84 | 85 | 86 | 87 | 资源文件 88 | 89 | 90 | -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/LevelDlg.cpp -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/LevelDlg.h -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "LevelPlugin.h" 3 | #include "Level.h" 4 | 5 | IMPLEMENT_PLUGIN(CLevelPlugin) 6 | 7 | void CLevelPlugin::Init() 8 | { 9 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 10 | 11 | // merge menu 12 | CMenu append; 13 | append.LoadMenu(IDR_LEVEL_MENU); 14 | MergeMenu(&append, TRUE); 15 | } 16 | 17 | void CLevelPlugin::Query(CPluginInfo& plugininfo) 18 | { 19 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 20 | 21 | plugininfo.m_strName = _T("LevelPlugin"); 22 | plugininfo.m_strBlurb = _T("Process Image"); 23 | plugininfo.m_strHelp = _T("For Image Processing"); 24 | plugininfo.m_strAuthor = _T("Wangqian"); 25 | plugininfo.m_strCopyRight = _T("Copyright Wangqian"); 26 | plugininfo.m_strDate = _T("2015.9.18"); 27 | // CString str; 28 | // str.LoadString(IDS_STRING_MENU_LABEL); 29 | // plugininfo.m_strMenuLabel = str; 30 | } -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelPlugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CLevelPlugin : public CPlugin 4 | { 5 | DECLARE_PLUGIN(CLevelPlugin) 6 | 7 | private: 8 | CLevelPlugin(){} 9 | 10 | public: 11 | virtual void Init(); 12 | 13 | virtual void Query(CPluginInfo& plugininfo); 14 | }; -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelSlider.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/LevelSlider.cpp -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelSlider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ItemInfo.h" 3 | #include "LevelWnd.h" 4 | 5 | // CLevelSlider 6 | 7 | class CLevelSlider : public CWnd 8 | { 9 | DECLARE_DYNAMIC(CLevelSlider) 10 | 11 | public: 12 | CLevelSlider(); 13 | virtual ~CLevelSlider(); 14 | 15 | protected: 16 | DECLARE_MESSAGE_MAP() 17 | public: 18 | void NewLevelSlider(CRect& rect, const UINT& nID, const ItemExStyle& eExStyle, CWnd* pParent, 19 | CLevelSlider* pItem, const CRect* pMin, const BOOL& bMinFlag, const int& nMinDis, const CRect* pMax, const BOOL& bMaxFlag, const int& nMaxDis); 20 | COLORREF SetLevelSliderColor(); 21 | afx_msg void OnPaint(); 22 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 23 | afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 24 | afx_msg void OnMouseMove(UINT nFlags, CPoint point); 25 | UINT m_nID; 26 | CRgn m_rgn; 27 | CRgn m_rgnInner; 28 | ItemExStyle m_eExStyle; 29 | CRect* m_pPosition; 30 | const CRect* m_pMin; 31 | BOOL m_bMinFlag; 32 | int m_nMinDis; 33 | const CRect* m_pMax; 34 | BOOL m_bMaxFlag; 35 | int m_nMaxDis; 36 | }; 37 | 38 | 39 | -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelWnd.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/LevelWnd.cpp -------------------------------------------------------------------------------- /LevelPlugin/Level/LevelWnd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/LevelWnd.h -------------------------------------------------------------------------------- /LevelPlugin/Level/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MICROSOFT 基础类库 : Level 项目概述 3 | ======================================================================== 4 | 5 | 6 | 应用程序向导已为您创建了此 Level DLL。此 DLL 不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写 DLL 的起点。 7 | 8 | 本文件概要介绍组成 Level DLL 的每个文件的内容。 9 | 10 | Level.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | Level.vcxproj.filters 14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 15 | 16 | Level.h 17 | 这是 DLL 的主头文件。它声明了 CLevelApp 类。 18 | 19 | Level.cpp 20 | 这是主 DLL 源文件。它包含 CLevelApp 类。 21 | 22 | Level.rc 23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。 24 | 25 | res\Level.rc2 26 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。 27 | 28 | Level.def 29 | 此文件包含在 Microsoft Windows 中运行所必需的 DLL 的有关信息。它定义了 DLL 的名称和说明等参数,而且还从 DLL 导出函数。 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | 其他标准文件: 33 | 34 | StdAfx.h, StdAfx.cpp 35 | 这些文件用于生成名为 Level.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 36 | 37 | Resource.h 38 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | 其他注释: 42 | 43 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /LevelPlugin/Level/res/Level.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/res/Level.rc2 -------------------------------------------------------------------------------- /LevelPlugin/Level/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/resource.h -------------------------------------------------------------------------------- /LevelPlugin/Level/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/stdafx.cpp -------------------------------------------------------------------------------- /LevelPlugin/Level/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/stdafx.h -------------------------------------------------------------------------------- /LevelPlugin/Level/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/targetver.h -------------------------------------------------------------------------------- /LevelPlugin/Level/test.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/LevelPlugin/Level/test.dat -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginBrowser", "PluginBrowser\PluginBrowser.vcxproj", "{93F48DB5-53B2-4029-A28A-772B6D23BB90}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {93F48DB5-53B2-4029-A28A-772B6D23BB90}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {93F48DB5-53B2-4029-A28A-772B6D23BB90}.Debug|Win32.Build.0 = Debug|Win32 14 | {93F48DB5-53B2-4029-A28A-772B6D23BB90}.Release|Win32.ActiveCfg = Release|Win32 15 | {93F48DB5-53B2-4029-A28A-772B6D23BB90}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/Browser.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Browser.h" 3 | #include "PluginBrowser.h" 4 | 5 | IMPLEMENT_PLUGIN(CBrowserPlugin) 6 | 7 | void CBrowserPlugin::Init() 8 | { 9 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 10 | 11 | // merge menu 12 | CMenu append; 13 | append.LoadMenu(IDR_BROWSER_MENU); 14 | MergeMenu(&append, TRUE); 15 | } 16 | 17 | void CBrowserPlugin::Query(CPluginInfo& plugininfo) 18 | { 19 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 20 | 21 | plugininfo.m_strName = _T("PluginBrowser"); 22 | plugininfo.m_strBlurb = _T("Show Plugin Information"); 23 | plugininfo.m_strHelp = _T("PluginBrowser"); 24 | plugininfo.m_strAuthor = _T("Zhao Shusen"); 25 | plugininfo.m_strCopyRight = _T("Copyright Rolin"); 26 | plugininfo.m_strDate = _T("2014.3.17"); 27 | CString str; 28 | str.LoadString(IDS_STRING_MENU_LABEL); 29 | plugininfo.m_strMenuLabel = str; 30 | } -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/Browser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBrowserPlugin : public CPlugin 4 | { 5 | DECLARE_PLUGIN(CBrowserPlugin) 6 | 7 | private: 8 | CBrowserPlugin(){} 9 | 10 | public: 11 | virtual void Init(); 12 | 13 | virtual void Query(CPluginInfo& plugininfo); 14 | }; -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/ListViewPage.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/ListViewPage.cpp -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/ListViewPage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/ListViewPage.h -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowser.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/PluginBrowser.cpp -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowser.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/PluginBrowser.def -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowser.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/PluginBrowser.h -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowser.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/PluginBrowser.rc -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowser.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {93F48DB5-53B2-4029-A28A-772B6D23BB90} 15 | PluginBrowser 16 | MFCDLLProj 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Use 53 | Level3 54 | Disabled 55 | WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) 56 | true 57 | 58 | 59 | Windows 60 | true 61 | .\PluginBrowser.def 62 | 63 | 64 | false 65 | _DEBUG;%(PreprocessorDefinitions) 66 | 67 | 68 | 0x0804 69 | _DEBUG;%(PreprocessorDefinitions) 70 | $(IntDir);%(AdditionalIncludeDirectories) 71 | 72 | 73 | mkdir $(SolutionDir)..\\Demo\\Debug 74 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Debug 75 | 76 | 77 | 78 | 79 | Level3 80 | Use 81 | MaxSpeed 82 | true 83 | true 84 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) 85 | true 86 | 87 | 88 | Windows 89 | true 90 | true 91 | true 92 | .\PluginBrowser.def 93 | 94 | 95 | false 96 | NDEBUG;%(PreprocessorDefinitions) 97 | 98 | 99 | 0x0804 100 | NDEBUG;%(PreprocessorDefinitions) 101 | $(IntDir);%(AdditionalIncludeDirectories) 102 | 103 | 104 | mkdir $(SolutionDir)..\\Demo\\Release 105 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Release 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | Create 118 | Create 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowser.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 源文件 32 | 33 | 34 | 源文件 35 | 36 | 37 | 源文件 38 | 39 | 40 | 41 | 42 | 头文件 43 | 44 | 45 | 头文件 46 | 47 | 48 | 头文件 49 | 50 | 51 | 头文件 52 | 53 | 54 | 头文件 55 | 56 | 57 | 头文件 58 | 59 | 60 | 头文件 61 | 62 | 63 | 头文件 64 | 65 | 66 | 67 | 68 | 源文件 69 | 70 | 71 | 资源文件 72 | 73 | 74 | 75 | 76 | 资源文件 77 | 78 | 79 | -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowserDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/PluginBrowserDlg.cpp -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/PluginBrowserDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/PluginBrowserDlg.h -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MICROSOFT 基础类库 : PluginBrowser 项目概述 3 | ======================================================================== 4 | 5 | 6 | 应用程序向导已为您创建了此 PluginBrowser DLL。此 DLL 不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写 DLL 的起点。 7 | 8 | 本文件概要介绍组成 PluginBrowser DLL 的每个文件的内容。 9 | 10 | PluginBrowser.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | PluginBrowser.vcxproj.filters 14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 15 | 16 | PluginBrowser.h 17 | 这是 DLL 的主头文件。它声明了 CPluginBrowserApp 类。 18 | 19 | PluginBrowser.cpp 20 | 这是主 DLL 源文件。它包含 CPluginBrowserApp 类。 21 | 22 | PluginBrowser.rc 23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。 24 | 25 | res\PluginBrowser.rc2 26 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。 27 | 28 | PluginBrowser.def 29 | 此文件包含在 Microsoft Windows 中运行所必需的 DLL 的有关信息。它定义了 DLL 的名称和说明等参数,而且还从 DLL 导出函数。 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | 其他标准文件: 33 | 34 | StdAfx.h, StdAfx.cpp 35 | 这些文件用于生成名为 PluginBrowser.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 36 | 37 | Resource.h 38 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | 其他注释: 42 | 43 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/TreeViewPage.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/TreeViewPage.cpp -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/TreeViewPage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/TreeViewPage.h -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/res/PluginBrowser.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/res/PluginBrowser.rc2 -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/resource.h -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/stdafx.cpp -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/stdafx.h -------------------------------------------------------------------------------- /PluginBrowser/PluginBrowser/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginBrowser/PluginBrowser/targetver.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginSupport", "PluginSupport\PluginSupport.vcxproj", "{4752F8EF-F997-4D41-9769-CC7FB118CC00}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4752F8EF-F997-4D41-9769-CC7FB118CC00}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {4752F8EF-F997-4D41-9769-CC7FB118CC00}.Debug|Win32.Build.0 = Debug|Win32 14 | {4752F8EF-F997-4D41-9769-CC7FB118CC00}.Release|Win32.ActiveCfg = Release|Win32 15 | {4752F8EF-F997-4D41-9769-CC7FB118CC00}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIDocManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "PIDocManager.h" 3 | 4 | IMPLEMENT_DYNAMIC(CPIDocManager, CDocManager) 5 | 6 | CPIDocManager::CPIDocManager(void) 7 | { 8 | 9 | } 10 | 11 | CPIDocManager::~CPIDocManager(void) 12 | { 13 | 14 | } 15 | 16 | #ifdef _DEBUG 17 | void CPIDocManager::AssertValid() const 18 | { 19 | CDocManager::AssertValid(); 20 | } 21 | 22 | void CPIDocManager::Dump(CDumpContext& dc) const 23 | { 24 | CDocManager::Dump(dc); 25 | } 26 | #endif 27 | 28 | void CPIDocManager::OnFileNew() 29 | { 30 | if (m_templateList.IsEmpty()) 31 | { 32 | TRACE(traceAppMsg, 0, "Error: no document templates registered with CWinApp.\n"); 33 | AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC); 34 | return; 35 | } 36 | 37 | CDocTemplate* pTemplate = (CDocTemplate*)m_templateList.GetHead(); 38 | if (m_templateList.GetCount() > 1) 39 | { 40 | // use default template instead 41 | /* // more than one document template to choose from 42 | // bring up dialog prompting user 43 | CNewTypeDlg dlg(&m_templateList); 44 | INT_PTR nID = dlg.DoModal(); 45 | if (nID == IDOK) 46 | pTemplate = dlg.m_pSelectedTemplate; 47 | else 48 | return; // none - cancel operation 49 | */ 50 | } 51 | 52 | ASSERT(pTemplate != NULL); 53 | ASSERT_KINDOF(CDocTemplate, pTemplate); 54 | 55 | pTemplate->OpenDocumentFile(NULL); 56 | // if returns NULL, the user has already been alerted 57 | } 58 | 59 | // remove plugin document template 60 | void CPIDocManager::RemovePluginDocTemplate() 61 | { 62 | while (m_templateList.GetSize() > 1) 63 | { 64 | m_templateList.RemoveTail(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIDocManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PluginDefine.h" 4 | 5 | class PLUGIN_EXT_CLASS CPIDocManager : public CDocManager 6 | { 7 | DECLARE_DYNAMIC(CPIDocManager) 8 | 9 | public: 10 | CPIDocManager(void); 11 | virtual ~CPIDocManager(void); 12 | 13 | public: 14 | // remove plugin document template 15 | void RemovePluginDocTemplate(); 16 | 17 | #ifdef _DEBUG 18 | virtual void AssertValid() const; 19 | virtual void Dump(CDumpContext& dc) const; 20 | #endif 21 | virtual void OnFileNew(); 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIDockablePane.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIDockablePane.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIDockablePane.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CPIDockablePane 5 | 6 | class CPIDockablePane : public CDockablePane 7 | { 8 | DECLARE_DYNAMIC(CPIDockablePane) 9 | 10 | public: 11 | CPIDockablePane(HINSTANCE hInstance, CWnd* pChildWnd); 12 | virtual ~CPIDockablePane(); 13 | 14 | private: 15 | HINSTANCE m_hInstance; 16 | CWnd* m_pChildWnd; 17 | 18 | protected: 19 | DECLARE_MESSAGE_MAP() 20 | public: 21 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 22 | afx_msg void OnSize(UINT nType, int cx, int cy); 23 | }; -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIDocument.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIDocument.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIDocument.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIDocument.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIMDIChildWndEx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIMDIChildWndEx.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIMDIChildWndEx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PluginDefine.h" 4 | 5 | // CPIMDIChildWndEx 6 | 7 | class PLUGIN_EXT_CLASS CPIMDIChildWndEx : public CMDIChildWndEx 8 | { 9 | DECLARE_DYNCREATE(CPIMDIChildWndEx) 10 | 11 | public: 12 | CPIMDIChildWndEx(); 13 | virtual ~CPIMDIChildWndEx(); 14 | 15 | protected: 16 | DECLARE_MESSAGE_MAP() 17 | }; 18 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIMDIFrameWndEx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIMDIFrameWndEx.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIMDIFrameWndEx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIMDIFrameWndEx.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIMultiDocTemplate.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "PIMultiDocTemplate.h" 3 | 4 | IMPLEMENT_DYNAMIC(CPIMultiDocTemplate, CMultiDocTemplate) 5 | 6 | CPIMultiDocTemplate::CPIMultiDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass) 7 | : CMultiDocTemplate(nIDResource, pDocClass, pFrameClass, pViewClass) 8 | { 9 | 10 | } 11 | 12 | CPIMultiDocTemplate::~CPIMultiDocTemplate() 13 | { 14 | 15 | } 16 | 17 | #ifdef _DEBUG 18 | void CPIMultiDocTemplate::AssertValid() const 19 | { 20 | CMultiDocTemplate::AssertValid(); 21 | } 22 | 23 | void CPIMultiDocTemplate::Dump(CDumpContext& dc) const 24 | { 25 | CMultiDocTemplate::Dump(dc); 26 | } 27 | #endif 28 | 29 | CDocTemplate::Confidence CPIMultiDocTemplate::MatchDocType(LPCTSTR pszPathName, CDocument*& rpDocMatch) 30 | { 31 | ASSERT(pszPathName != NULL); 32 | rpDocMatch = NULL; 33 | 34 | // go through all documents 35 | POSITION pos = GetFirstDocPosition(); 36 | while (pos != NULL) 37 | { 38 | CDocument* pDoc = GetNextDoc(pos); 39 | if (pDoc->GetPathName() == pszPathName) 40 | { 41 | // already open 42 | rpDocMatch = pDoc; 43 | return yesAlreadyOpen; 44 | } 45 | } 46 | 47 | // see if it matches either suffix 48 | CString strFilterExt; 49 | if (GetDocString(strFilterExt, CDocTemplate::filterExt) && !strFilterExt.IsEmpty()) 50 | { 51 | // see if extension matches 52 | ASSERT(strFilterExt[0] == '.'); 53 | int nDot = CString(pszPathName).ReverseFind('.'); 54 | if (nDot < 0) 55 | { 56 | // unknown document type 57 | return yesAttemptForeign; 58 | } 59 | LPCTSTR pszDot = nDot < 0 ? NULL : pszPathName + nDot; 60 | 61 | int nSemi = strFilterExt.Find(';'); 62 | if (nSemi != -1) 63 | { 64 | while (nSemi != -1) 65 | { 66 | CString strExt = strFilterExt.Left(nSemi); 67 | if (lstrcmpi(pszDot, strExt) == 0) 68 | { 69 | return yesAttemptNative; // extension matches 70 | } 71 | else 72 | { 73 | strFilterExt = strFilterExt.Mid(nSemi + 1); 74 | nSemi = strFilterExt.Find(';'); 75 | } 76 | } 77 | // compare the last one 78 | if (lstrcmpi(pszDot, strFilterExt) == 0) 79 | { 80 | return yesAttemptNative; // extension matches 81 | } 82 | } 83 | else 84 | { 85 | // string contains a single extension 86 | if (lstrcmpi(pszDot, strFilterExt) == 0) 87 | { 88 | return yesAttemptNative; // extension matches 89 | } 90 | } 91 | } 92 | 93 | // unknown document type 94 | return yesAttemptForeign; 95 | } -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIMultiDocTemplate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PluginDefine.h" 4 | 5 | class PLUGIN_EXT_CLASS CPIMultiDocTemplate : public CMultiDocTemplate 6 | { 7 | DECLARE_DYNAMIC(CPIMultiDocTemplate) 8 | 9 | public: 10 | CPIMultiDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass); 11 | virtual ~CPIMultiDocTemplate(); 12 | 13 | #ifdef _DEBUG 14 | virtual void AssertValid() const; 15 | virtual void Dump(CDumpContext& dc) const; 16 | #endif 17 | 18 | virtual Confidence MatchDocType(LPCTSTR lpszPathName, CDocument*& rpDocMatch); 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIToolBar.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIToolBar.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIToolBar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PluginDefine.h" 4 | 5 | // CPIToolBar 6 | 7 | class PLUGIN_EXT_CLASS CPIToolBar : public CMFCToolBar 8 | { 9 | DECLARE_DYNAMIC(CPIToolBar) 10 | 11 | public: 12 | CPIToolBar(); 13 | virtual ~CPIToolBar(); 14 | 15 | public: 16 | // edit image 17 | void RemapImage(UINT nCommandID, int nImageIndex); 18 | 19 | public: 20 | #ifdef _DEBUG 21 | virtual void AssertValid() const; 22 | #endif 23 | 24 | public: 25 | virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; 26 | virtual BOOL LoadToolBarExtend(UINT uiResID, UINT nCommandIDIndex, UINT uiColdResID = 0, UINT uiMenuResID = 0, 27 | BOOL bLocked = FALSE, UINT uiDisabledResID = 0, UINT uiMenuDisabledResID = 0, UINT uiHotResID = 0); 28 | virtual BOOL LoadToolBarExtend2(UINT uiToolbarResID, UINT nCommandIDIndex, CMFCToolBarInfo& params, BOOL bLocked = FALSE); 29 | 30 | protected: 31 | DECLARE_MESSAGE_MAP() 32 | }; 33 | 34 | 35 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIView.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIView.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PIView.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PIView.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginClass.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "PluginClass.h" 4 | #include "PluginLibrary.h" 5 | #include "PluginSupport.h" 6 | #include "PluginImpl.h" 7 | #include "PluginWrapper.h" 8 | 9 | int CPlugin::MergeMenu(const CMenu* pMenuAdd, BOOL bTopLevel) 10 | { 11 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 12 | 13 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 14 | CWinApp* pMainApp = pApp->GetMainApp(); 15 | 16 | HMENU hMenu = NULL; 17 | pMainApp->m_pMainWnd->SendMessage(WM_MENU_EVENT, (WPARAM)FALSE, (LPARAM)&hMenu); 18 | ASSERT(hMenu != NULL); 19 | 20 | // calculate command offset 21 | CPluginWrapper* pPluginWrapper = pApp->GetPluginArray().GetAt(m_nPluginIndex); 22 | 23 | CMenu ParentMenu; 24 | ParentMenu.Attach(hMenu); 25 | int nCommandCount = MergeMenuImpl(&ParentMenu, pMenuAdd, pPluginWrapper, bTopLevel); 26 | // refresh menu 27 | pMainApp->m_pMainWnd->SendMessage(WM_MENU_EVENT, (WPARAM)TRUE, (LPARAM)&ParentMenu); 28 | ParentMenu.Detach(); 29 | 30 | return nCommandCount; 31 | } 32 | 33 | // merge toolbar 34 | int CPlugin::MergeToolbar(UINT nIDResource) 35 | { 36 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 37 | 38 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 39 | CWinApp* pMainApp = pApp->GetMainApp(); 40 | 41 | CPluginWrapper* pPluginWrapper = pApp->GetPluginArray().GetAt(m_nPluginIndex); 42 | ToolbarInfo info; 43 | info.nPluginIndex = m_nPluginIndex; 44 | info.hInstance = pPluginWrapper->GetInstance(); 45 | info.nIDResource = nIDResource; 46 | // calculate command offset 47 | info.nCommandIDIndex = CPluginWrapper::GetCommandIDIndex(); 48 | int nCommandCount = pMainApp->m_pMainWnd->SendMessage(WM_TOOLBAR_EVENT, (WPARAM)TRUE, (LPARAM)&info); 49 | 50 | return nCommandCount; 51 | } 52 | 53 | // insert toolbar 54 | int CPlugin::InsertToolbar(UINT nIDResource, CString strText) 55 | { 56 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 57 | 58 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 59 | CWinApp* pMainApp = pApp->GetMainApp(); 60 | 61 | CPluginWrapper* pPluginWrapper = pApp->GetPluginArray().GetAt(m_nPluginIndex); 62 | ToolbarInfo info; 63 | info.nPluginIndex = m_nPluginIndex; 64 | info.hInstance = pPluginWrapper->GetInstance(); 65 | info.nIDResource = nIDResource; 66 | // calculate command offset 67 | info.nCommandIDIndex = CPluginWrapper::GetCommandIDIndex(); 68 | info.strText = strText; 69 | LRESULT nCommandCount = pMainApp->m_pMainWnd->SendMessage(WM_TOOLBAR_EVENT, (WPARAM)FALSE, (LPARAM)&info); 70 | 71 | return int(nCommandCount); 72 | } 73 | 74 | // this code was taken from the article 75 | // http://www.codeproject.com/menu/mergemenu.asp 76 | // by Oskar Wieland (http://www.codeproject.com/script/profile/whos_who.asp?id=23357) 77 | int CPlugin::MergeMenuImpl(CMenu* pMenuDestination, const CMenu* pMenuAdd, CPluginWrapper* pPluginWrapper, BOOL bTopLevel /*=FALSE*/) 78 | { 79 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 80 | 81 | // Abstract: 82 | // Merges two menus. 83 | // 84 | // Parameters: 85 | // pMenuDestination - [in, retval] destination menu handle 86 | // pMenuAdd - [in] menu to merge 87 | // bTopLevel - [in] indicator for special top level behavior 88 | // 89 | // Return value: 90 | // in case of error. 91 | // 92 | // Comments: 93 | // This function calles itself recursivley. If bTopLevel is set to true, 94 | // we append popups at top level or we insert before or . 95 | 96 | int nCommandCount = 0; 97 | // get the number menu items in the menus 98 | int iMenuAddItemCount = pMenuAdd->GetMenuItemCount(); 99 | int iMenuDestItemCount = pMenuDestination->GetMenuItemCount(); 100 | 101 | // if there are no items return 102 | if (iMenuAddItemCount == 0) 103 | return FALSE; 104 | 105 | // if we are not at top level and the destination menu is not empty 106 | // -> we append a seperator 107 | if (!bTopLevel && iMenuDestItemCount > 0) 108 | { 109 | pMenuDestination->AppendMenu(MF_SEPARATOR); 110 | } 111 | 112 | // iterate through the top level of 113 | for (int iLoop = 0; iLoop < iMenuAddItemCount; iLoop++) 114 | { 115 | // get the menu string from the add menu 116 | CString sMenuAddString; 117 | pMenuAdd->GetMenuString(iLoop, sMenuAddString, MF_BYPOSITION); 118 | 119 | // try to get the submenu of the current menu item 120 | CMenu* pSubMenu = pMenuAdd->GetSubMenu(iLoop); 121 | 122 | // check if we have a sub menu 123 | if (!pSubMenu) 124 | { 125 | // normal menu item 126 | // read the source and append at the destination 127 | UINT nState = pMenuAdd->GetMenuState(iLoop, MF_BYPOSITION); 128 | UINT nItemID = pMenuAdd->GetMenuItemID(iLoop); 129 | 130 | if (pMenuDestination->AppendMenu(nState, CPluginWrapper::GetCommandIDIndex(), sMenuAddString)) 131 | { 132 | // menu item added, don't forget to correct the item count 133 | iMenuDestItemCount++; 134 | nCommandCount++; 135 | 136 | // add new command 137 | pPluginWrapper->AddCommand(nItemID); 138 | } 139 | else 140 | { 141 | TRACE(_T("Plugin: AppendMenu failed!\n")); 142 | return FALSE; 143 | } 144 | } 145 | else 146 | { 147 | // create or insert a new popup menu item 148 | 149 | // default insert pos is like ap 150 | int iInsertPosDefault = -1; 151 | 152 | // if we are at top level merge into existing popups rather than 153 | // creating new ones 154 | if (bTopLevel) 155 | { 156 | ASSERT(sMenuAddString != "&?" && sMenuAddString != "?"); 157 | CString sAdd(sMenuAddString); 158 | // sAdd.Remove('&'); // for comparison of menu items supress '&' 159 | bool bAdded = false; 160 | 161 | // try to find existing popup 162 | for (int iLoop1 = 0; iLoop1 < iMenuDestItemCount; iLoop1++) 163 | { 164 | // get the menu string from the destination menu 165 | CString sDest; 166 | pMenuDestination->GetMenuString(iLoop1, sDest, MF_BYPOSITION); 167 | // sDest.Remove('&'); // for a better compare (s.a.) 168 | 169 | if (sAdd == sDest) 170 | { 171 | // we got a hit -> merge the two popups 172 | // try to get the submenu of the desired destination menu item 173 | CMenu* pSubMenuDest = pMenuDestination->GetSubMenu(iLoop1); 174 | 175 | if (pSubMenuDest) 176 | { 177 | // merge the popup recursivly and continue with outer for loop 178 | int nSubCommandCount = MergeMenuImpl(pSubMenuDest, pSubMenu, pPluginWrapper, FALSE); 179 | if (!nSubCommandCount) 180 | { 181 | return FALSE; 182 | } 183 | else 184 | { 185 | nCommandCount += nSubCommandCount; 186 | } 187 | 188 | bAdded = true; 189 | break; 190 | } 191 | } 192 | 193 | // alternativ insert before or 194 | if (iInsertPosDefault == -1 && (sDest == "Window" || sDest == "?" || sDest == "Help")) 195 | iInsertPosDefault = iLoop1; 196 | } 197 | 198 | if (bAdded) 199 | { 200 | // menu added, so go on with loop over pMenuAdd's top level 201 | continue; 202 | } 203 | } 204 | 205 | // if the top level search did not find a position append the menu 206 | if (iInsertPosDefault == -1) 207 | { 208 | iInsertPosDefault = pMenuDestination->GetMenuItemCount(); 209 | } 210 | 211 | // create a new popup and insert before or 212 | CMenu NewPopupMenu; 213 | if (!NewPopupMenu.CreatePopupMenu()) 214 | { 215 | TRACE(_T("Plugin: CreatePopupMenu failed!\n")); 216 | return FALSE; 217 | } 218 | 219 | // merge the new popup recursivly 220 | int nSubCommandCount = MergeMenuImpl(&NewPopupMenu, pSubMenu, pPluginWrapper, FALSE); 221 | if (!nSubCommandCount) 222 | { 223 | return FALSE; 224 | } 225 | else 226 | { 227 | nCommandCount += nSubCommandCount; 228 | } 229 | 230 | // insert the new popup menu into the destination menu 231 | HMENU hNewMenu = NewPopupMenu.GetSafeHmenu(); 232 | 233 | if (pMenuDestination->InsertMenu(-1, MF_BYPOSITION | MF_POPUP | MF_ENABLED, (UINT)hNewMenu, sMenuAddString)) 234 | { 235 | // don't forget to correct the item count 236 | iMenuDestItemCount++; 237 | } 238 | else 239 | { 240 | TRACE(_T("Plugin: InsertMenu failed!\n")); 241 | return FALSE; 242 | } 243 | 244 | // don't destroy the new menu 245 | NewPopupMenu.Detach(); 246 | } 247 | } 248 | 249 | return nCommandCount; 250 | } -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginClass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CPluginWrapper; 4 | 5 | #include "PluginDefine.h" 6 | #include "PIMultiDocTemplate.h" 7 | 8 | class PLUGIN_EXT_CLASS CPlugin 9 | { 10 | protected: 11 | CPlugin(){} 12 | 13 | private: 14 | CPlugin(const CPlugin&); 15 | CPlugin& operator=(const CPlugin&); 16 | 17 | public: 18 | void SetPluginIndex(int nPluginIndex) { m_nPluginIndex = nPluginIndex; } 19 | 20 | virtual void Init(){} 21 | 22 | virtual void Release(){} 23 | 24 | virtual void Query(CPluginInfo& plugininfo){} 25 | 26 | virtual void Execute(UINT nCommandID, CCmdUI* pCmdUI) 27 | { 28 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 29 | 30 | CWinApp* pApp = AfxGetApp(); 31 | if (pCmdUI == NULL) 32 | { 33 | pApp->OnCmdMsg(nCommandID, CN_COMMAND, NULL, NULL); 34 | } 35 | else 36 | { 37 | pApp->OnCmdMsg(nCommandID, CN_UPDATE_COMMAND_UI, pCmdUI, NULL); 38 | } 39 | } 40 | 41 | virtual void Draw(CDC* pDC){} 42 | 43 | virtual int GetDocTemplateCount() { return 0; } 44 | 45 | virtual CPIMultiDocTemplate* GetDocTemplate(int nIndex) { return NULL; } 46 | 47 | protected: 48 | int MergeMenu(const CMenu* pMenuAdd, BOOL bTopLevel = FALSE); 49 | 50 | // merge toolbar 51 | int MergeToolbar(UINT nIDResource); 52 | 53 | // insert toolbar 54 | int InsertToolbar(UINT nIDResource, CString strText); 55 | 56 | private: 57 | // implement of merge menu 58 | int MergeMenuImpl(CMenu* pMenuDestination, const CMenu* pMenuAdd, CPluginWrapper* pPluginWrapper, BOOL bTopLevel =FALSE); 59 | 60 | // member variables 61 | private: 62 | int m_nPluginIndex; 63 | }; -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginDefine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PluginDefine.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginImpl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "PluginImpl.h" 4 | #include "PluginSupport.h" 5 | #include "PluginWrapper.h" 6 | 7 | PLUGIN_EXPORT void PIInitPlugin(CWinApp* pApp) 8 | { 9 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 10 | 11 | CPluginSupportApp* pThisApp = (CPluginSupportApp*)AfxGetApp(); 12 | // load plugin 13 | pThisApp->SetMainApp(pApp); 14 | pThisApp->LoadPlugin(pApp); 15 | } 16 | 17 | // register plugin document templates 18 | PLUGIN_EXPORT void PIRegisterDocTemplates() 19 | { 20 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 21 | 22 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 23 | CWinApp* pMainApp = pApp->GetMainApp(); 24 | 25 | const PluginArray& array = pApp->GetPluginArray(); 26 | for (int i=0; iGetDocTemplateCount(); j++) 30 | { 31 | CDocTemplate* pDocTemplate = pPluginWrapper->GetDocTemplate(j); 32 | // plugin said it had one, but didn't supply it 33 | ASSERT(pDocTemplate); 34 | pMainApp->AddDocTemplate(pDocTemplate); 35 | } 36 | } 37 | } 38 | 39 | PLUGIN_EXPORT void PICommand(UINT nCommandID, CCmdUI* pCmdUI) 40 | { 41 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 42 | 43 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 44 | const PluginArray& array = pApp->GetPluginArray(); 45 | for (int i=0; iGetFirstVirtualID(); 49 | UINT nPluginCommandCount = pPluginWrapper->GetCommandCount(); 50 | if (nCommandID >= nFirstVirtualID && nCommandID < nFirstVirtualID + nPluginCommandCount) 51 | { 52 | // calculate actual plugin id 53 | pPluginWrapper->ExecutePlugin(nCommandID, pCmdUI); 54 | return; 55 | } 56 | } 57 | 58 | TRACE(_T("Plugin: message CommandID = %d is not processed\n"), nCommandID); 59 | } 60 | 61 | PLUGIN_EXPORT int PIAddNewCommand(int nPluginIndex, UINT nActualID) 62 | { 63 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 64 | 65 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 66 | CPluginWrapper* pPluginWrapper = pApp->GetPluginArray().GetAt(nPluginIndex); 67 | ASSERT(pPluginWrapper != NULL); 68 | 69 | // add new command 70 | return pPluginWrapper->AddCommand(nActualID); 71 | } 72 | 73 | PLUGIN_EXPORT void PIGetCommandString(UINT nCommandID, CString& str) 74 | { 75 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 76 | 77 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 78 | const PluginArray& array = pApp->GetPluginArray(); 79 | for (int i=0; iGetFirstVirtualID(); 83 | UINT nPluginCommandCount = pPluginWrapper->GetCommandCount(); 84 | if (nCommandID >= nFirstVirtualID && nCommandID < nFirstVirtualID + nPluginCommandCount) 85 | { 86 | pPluginWrapper->GetCommandString(nCommandID, str); 87 | } 88 | } 89 | } 90 | 91 | PLUGIN_EXPORT void PIDraw(CDC* pDC) 92 | { 93 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 94 | 95 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 96 | const PluginArray& array = pApp->GetPluginArray(); 97 | for (int i=0; iDraw(pDC); 101 | } 102 | } 103 | 104 | PLUGIN_EXPORT BOOL PIHandleMessage(MSG* pMsg, CWnd* pSender) 105 | { 106 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 107 | 108 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 109 | MessageMap& messageMap = pApp->GetPluginMessageMap(); 110 | 111 | MESSAGEPROC pFNMessageProc = NULL; 112 | BOOL bReslut = messageMap.Lookup(pMsg->message, pFNMessageProc); 113 | if (bReslut) 114 | { 115 | ASSERT(pFNMessageProc != NULL); 116 | return BOOL(pFNMessageProc(pMsg)); 117 | } 118 | else 119 | { 120 | return FALSE; 121 | } 122 | } -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "PluginLibrary.h" 5 | 6 | // exported function for main application 7 | 8 | PLUGIN_EXPORT void PIInitPlugin(CWinApp* pApp); 9 | 10 | // register plugin document templates 11 | PLUGIN_EXPORT void PIRegisterDocTemplates(); 12 | 13 | PLUGIN_EXPORT void PICommand(UINT nCommandID, CCmdUI* pCmdUI); 14 | 15 | PLUGIN_EXPORT int PIAddNewCommand(int nPluginIndex, UINT nActualID); 16 | 17 | PLUGIN_EXPORT void PIGetCommandString(UINT nCommandID, CString& str); 18 | 19 | PLUGIN_EXPORT void PIDraw(CDC* pDC); 20 | 21 | PLUGIN_EXPORT BOOL PIHandleMessage(MSG* pMsg, CWnd* pSender); 22 | 23 | struct ToolbarInfo 24 | { 25 | int nPluginIndex; 26 | HINSTANCE hInstance; 27 | UINT nIDResource; 28 | UINT nCommandIDIndex; 29 | CString strText; 30 | }; 31 | 32 | #include "PIToolBar.h" 33 | #include "PIView.h" 34 | #include "PIDocManager.h" 35 | #include "PIMDIFrameWndEx.h" -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginLibrary.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "PluginSupport.h" 4 | #include "PluginLibrary.h" 5 | #include "PluginImpl.h" 6 | #include "PluginWrapper.h" 7 | 8 | PLUGIN_EXPORT void PIEnableUI(CCmdUI* pCmdUI, BOOL bEnable) 9 | { 10 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 11 | 12 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 13 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 14 | if (pMainWnd) 15 | { 16 | pMainWnd->SendMessage(WM_UI_ENABLE_EVENT, (WPARAM)pCmdUI, (LPARAM)bEnable); 17 | } 18 | } 19 | 20 | PLUGIN_EXPORT void PICheckUI(CCmdUI* pCmdUI, BOOL bCheck) 21 | { 22 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 23 | 24 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 25 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 26 | if (pMainWnd) 27 | { 28 | pMainWnd->SendMessage(WM_UI_CHECK_EVENT, (WPARAM)pCmdUI, (LPARAM)bCheck); 29 | } 30 | } 31 | 32 | PLUGIN_EXPORT void PIMessageBox(CString str, UINT uType) 33 | { 34 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 35 | 36 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 37 | CWinApp* pMainApp = pApp->GetMainApp(); 38 | CWnd* pMainWnd = pMainApp->m_pMainWnd; 39 | if (pMainWnd) 40 | { 41 | pMainWnd->MessageBox(str, pMainApp->m_pszAppName, uType); 42 | } 43 | } 44 | 45 | PLUGIN_EXPORT void PILog(CString strLog) 46 | { 47 | CString strAppName = AfxGetApp()->m_pszAppName; 48 | strLog = strAppName + _T("> ") + strLog; 49 | 50 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 51 | 52 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 53 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 54 | 55 | COPYDATASTRUCT copyData = {0}; 56 | copyData.lpData = strLog.GetBuffer(); 57 | copyData.cbData = strLog.GetLength(); 58 | if (pMainWnd) 59 | { 60 | pMainWnd->SendMessage(WM_COPYDATA, (WPARAM)NULL, (LPARAM)©Data); 61 | } 62 | } 63 | 64 | PLUGIN_EXPORT void PIPrepareDC(CView* pView, CDC* pDC) 65 | { 66 | pView->SendMessage(WM_PREPARE_DC_EVENT, (WPARAM)NULL, (LPARAM)pDC); 67 | } 68 | 69 | PLUGIN_EXPORT void PIRegisterMessage(int nPluginIndex, UINT nMessage, MESSAGEPROC pFN) 70 | { 71 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 72 | 73 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 74 | MessageMap& messageMap = pApp->GetPluginMessageMap(); 75 | messageMap.SetAt(nMessage, pFN); 76 | } 77 | 78 | PLUGIN_EXPORT void PIUnregisterMessage(int nPluginIndex, UINT nMessage) 79 | { 80 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 81 | 82 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 83 | MessageMap& messageMap = pApp->GetPluginMessageMap(); 84 | BOOL bResult = messageMap.RemoveKey(nMessage); 85 | if (!bResult) 86 | { 87 | TRACE(_T("Plugin: messageMap RemoveKey %d was not found!\n"), nMessage); 88 | } 89 | } 90 | 91 | PLUGIN_EXPORT CDocument* PIGetActiveDocument() 92 | { 93 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 94 | 95 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 96 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 97 | 98 | CDocument* pActiveDoc = NULL; 99 | if (pMainWnd) 100 | { 101 | pMainWnd->SendMessage(WM_GET_ACTIVE_DOC, (WPARAM)&pActiveDoc, (LPARAM)NULL); 102 | } 103 | 104 | return pActiveDoc; 105 | } 106 | 107 | PLUGIN_EXPORT CView* PIGetActiveView() 108 | { 109 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 110 | 111 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 112 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 113 | 114 | CView* pActiveView = NULL; 115 | if (pMainWnd) 116 | { 117 | pMainWnd->SendMessage(WM_GET_ACTIVE_VIEW, (WPARAM)&pActiveView, (LPARAM)NULL); 118 | } 119 | 120 | return pActiveView; 121 | } 122 | 123 | // Progress Dialog 124 | PLUGIN_EXPORT void PIProgressInit(int nProgressType, LPCTSTR lpszText) 125 | { 126 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 127 | 128 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 129 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 130 | if (pMainWnd == NULL) 131 | return; 132 | 133 | CDialog* pDialog = (CDialog*)pMainWnd->SendMessage(WM_PROGRESS_INIT, (WPARAM)nProgressType, (LPARAM)lpszText); 134 | if (nProgressType != PI_PROGRESS_THREAD_DLG || pDialog == NULL) 135 | return; 136 | 137 | int nCount = 0; 138 | while (pDialog->GetSafeHwnd() == NULL && nCount < 10) 139 | { 140 | // The maximum wait time is one second 141 | nCount++; 142 | Sleep(100); 143 | } 144 | 145 | // set progress dialog title 146 | if (pDialog->GetSafeHwnd()) 147 | { 148 | if (lpszText) 149 | { 150 | pDialog->SetWindowText(lpszText); 151 | } 152 | else 153 | { 154 | // remove title bar 155 | pDialog->ModifyStyle(WS_CAPTION, 0); 156 | 157 | CRect rect; 158 | pDialog->GetWindowRect(rect); 159 | pDialog->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height() - 32, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); 160 | } 161 | } 162 | } 163 | 164 | PLUGIN_EXPORT LRESULT PIProgressPercent(int nPercent, BOOL bSupportCancel) 165 | { 166 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 167 | 168 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 169 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 170 | if (pMainWnd) 171 | { 172 | if (bSupportCancel) 173 | { 174 | return pMainWnd->SendMessage(WM_PROGRESS_PERCENT, (WPARAM)NULL, (LPARAM)nPercent); 175 | } 176 | else 177 | { 178 | return pMainWnd->PostMessage(WM_PROGRESS_PERCENT, (WPARAM)NULL, (LPARAM)nPercent); 179 | } 180 | } 181 | else 182 | { 183 | return 0; 184 | } 185 | } 186 | 187 | PLUGIN_EXPORT void PIProgressDone() 188 | { 189 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 190 | 191 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 192 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 193 | if (pMainWnd) 194 | { 195 | pMainWnd->SendMessage(WM_PROGRESS_DONE, (WPARAM)NULL, (LPARAM)NULL); 196 | } 197 | } 198 | 199 | PLUGIN_EXPORT LANGID PIGetThreadUILanguage() 200 | { 201 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 202 | 203 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 204 | CWinApp* pMainApp = pApp->GetMainApp(); 205 | int nLanguage = pMainApp->GetProfileInt(_T("Settings"), _T("Language"), 0); 206 | 207 | LANGID id; 208 | if (nLanguage == 0) 209 | { 210 | id = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); 211 | } 212 | else 213 | { 214 | id = MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT); 215 | } 216 | return id; 217 | } 218 | 219 | PLUGIN_EXPORT void PIDockablePane(CPluginWindow* pPluginWindow) 220 | { 221 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 222 | 223 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 224 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 225 | if (pMainWnd == NULL) 226 | return; 227 | 228 | if (!pMainWnd->IsKindOf(RUNTIME_CLASS(CPIMDIFrameWndEx))) 229 | return; 230 | 231 | pMainWnd->SendMessage(WM_CREATE_DOCKABLE_PANE, (WPARAM)&pPluginWindow, (LPARAM)NULL); 232 | } 233 | 234 | PLUGIN_EXPORT void PICreateWidget(CPluginWindow* pPluginWindow) 235 | { 236 | AFX_MANAGE_STATE(AfxGetStaticModuleState()); 237 | 238 | CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp(); 239 | CWnd* pMainWnd = pApp->GetMainApp()->m_pMainWnd; 240 | if (pMainWnd == NULL) 241 | return; 242 | 243 | if (!pMainWnd->IsKindOf(RUNTIME_CLASS(CPIMDIFrameWndEx))) 244 | return; 245 | 246 | pMainWnd->SendMessage(WM_CREATE_WIDGET, (WPARAM)pPluginWindow, (LPARAM)NULL); 247 | } -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginLibrary.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include "PluginDefine.h" 7 | #include "PluginClass.h" 8 | #include "PIDocument.h" 9 | #include "PIMDIChildWndEx.h" 10 | 11 | #ifndef PLUGIN_NO_AUTO_LIB 12 | #ifdef _DEBUG 13 | #pragma comment(lib, "..\\..\\PluginSupport\\Debug\\PluginSupport.lib") 14 | #pragma message("Automatically link with PluginSupport Debug") 15 | #else 16 | #pragma comment(lib, "..\\..\\PluginSupport\\Release\\PluginSupport.lib") 17 | #pragma message("Automatically link with PluginSupport Release") 18 | #endif 19 | #endif 20 | 21 | #ifdef __cplusplus 22 | #define PLUGIN_EXPORT extern "C" __declspec(dllexport) 23 | #else 24 | #define PLUGIN_EXPORT __declspec(dllexport) 25 | #endif 26 | 27 | PLUGIN_EXPORT void PIEnableUI(CCmdUI* pCmdUI, BOOL bEnable); 28 | 29 | PLUGIN_EXPORT void PICheckUI(CCmdUI* pCmdUI, BOOL bCheck); 30 | 31 | PLUGIN_EXPORT void PIMessageBox(CString str, UINT uType = MB_OK | MB_ICONINFORMATION); 32 | 33 | PLUGIN_EXPORT void PILog(CString str); 34 | 35 | PLUGIN_EXPORT void PIPrepareDC(CView* pView, CDC* pDC); 36 | 37 | // register message handler 38 | typedef LRESULT (__cdecl* MESSAGEPROC)(MSG* pMsg); 39 | PLUGIN_EXPORT void PIRegisterMessage(int nPluginIndex, UINT nMessage, MESSAGEPROC pFN); 40 | 41 | PLUGIN_EXPORT void PIUnregisterMessage(int nPluginIndex, UINT nMessage); 42 | 43 | PLUGIN_EXPORT CDocument* PIGetActiveDocument(); 44 | 45 | PLUGIN_EXPORT CView* PIGetActiveView(); 46 | 47 | // Progress Dialog&StatusBar 48 | #define PI_PROGRESS_THREAD_DLG 0 49 | #define PI_PROGRESS_NATIVE_DLG 1 50 | #define PI_PROGRESS_BAR 2 51 | PLUGIN_EXPORT void PIProgressInit(int nProgressType = PI_PROGRESS_THREAD_DLG, LPCTSTR lpszText = NULL); 52 | 53 | PLUGIN_EXPORT LRESULT PIProgressPercent(int nPercent, BOOL bSupportCancel = FALSE); 54 | 55 | PLUGIN_EXPORT void PIProgressDone(); 56 | 57 | PLUGIN_EXPORT LANGID PIGetThreadUILanguage(); 58 | 59 | PLUGIN_EXPORT void PIDockablePane(CPluginWindow* pPluginWindow); 60 | 61 | PLUGIN_EXPORT void PICreateWidget(CPluginWindow* pPluginWindow); -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginSupport.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PluginSupport.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginSupport.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PluginSupport.def -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginSupport.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PluginSupport.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginSupport.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/PluginSupport.rc -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginSupport.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {4752F8EF-F997-4D41-9769-CC7FB118CC00} 15 | PluginSupport 16 | MFCDLLProj 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Use 53 | Level3 54 | Disabled 55 | WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) 56 | true 57 | 58 | 59 | Windows 60 | true 61 | .\PluginSupport.def 62 | 63 | 64 | false 65 | _DEBUG;%(PreprocessorDefinitions) 66 | 67 | 68 | 0x0804 69 | _DEBUG;%(PreprocessorDefinitions) 70 | $(IntDir);%(AdditionalIncludeDirectories) 71 | 72 | 73 | mkdir $(SolutionDir)..\\Demo\\Debug 74 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Debug 75 | 76 | 77 | 78 | 79 | Level3 80 | Use 81 | MaxSpeed 82 | true 83 | true 84 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) 85 | true 86 | 87 | 88 | Windows 89 | true 90 | true 91 | true 92 | .\PluginSupport.def 93 | 94 | 95 | false 96 | NDEBUG;%(PreprocessorDefinitions) 97 | 98 | 99 | 0x0804 100 | NDEBUG;%(PreprocessorDefinitions) 101 | $(IntDir);%(AdditionalIncludeDirectories) 102 | 103 | 104 | mkdir $(SolutionDir)..\\Demo\\Release 105 | copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)..\\Demo\\Release 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | Create 127 | Create 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginSupport.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 源文件 32 | 33 | 34 | 源文件 35 | 36 | 37 | 源文件 38 | 39 | 40 | 源文件 41 | 42 | 43 | 源文件 44 | 45 | 46 | 源文件 47 | 48 | 49 | 源文件 50 | 51 | 52 | 源文件 53 | 54 | 55 | 源文件 56 | 57 | 58 | 源文件 59 | 60 | 61 | 源文件 62 | 63 | 64 | 65 | 66 | 头文件 67 | 68 | 69 | 头文件 70 | 71 | 72 | 头文件 73 | 74 | 75 | 头文件 76 | 77 | 78 | 头文件 79 | 80 | 81 | 头文件 82 | 83 | 84 | 头文件 85 | 86 | 87 | 头文件 88 | 89 | 90 | 头文件 91 | 92 | 93 | 头文件 94 | 95 | 96 | 头文件 97 | 98 | 99 | 头文件 100 | 101 | 102 | 头文件 103 | 104 | 105 | 头文件 106 | 107 | 108 | 头文件 109 | 110 | 111 | 头文件 112 | 113 | 114 | 头文件 115 | 116 | 117 | 118 | 119 | 源文件 120 | 121 | 122 | 资源文件 123 | 124 | 125 | 126 | 127 | 资源文件 128 | 129 | 130 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/PluginWrapper.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "PluginWrapper.h" 4 | #include "PIMultiDocTemplate.h" 5 | 6 | UINT CPluginWrapper::m_nCommandIDIndex = PLUGIN_COMMAND_BEGIN; 7 | 8 | CPluginWrapper::CPluginWrapper() 9 | : m_strFileName(_T("")) 10 | , m_hInstance(NULL) 11 | , m_pfnGetInstance(NULL) 12 | , m_pPlugin(NULL) 13 | { 14 | 15 | } 16 | 17 | CPluginWrapper::~CPluginWrapper() 18 | { 19 | // release any loaded DLL 20 | if (m_hInstance != NULL) 21 | { 22 | FreeLibrary(m_hInstance); // release library 23 | m_hInstance = NULL; 24 | m_strFileName = ""; 25 | // kill any function pointers 26 | m_pfnGetInstance = NULL; 27 | } 28 | } 29 | 30 | BOOL CPluginWrapper::LoadDLL(CString strFileName) 31 | { 32 | m_strFileName = strFileName; 33 | m_hInstance = LoadLibrary(strFileName); 34 | 35 | if (m_hInstance != NULL) 36 | { 37 | m_pfnGetInstance = (GETINSTANCE)GetProcAddress(m_hInstance, "GetInstance"); 38 | if (m_pfnGetInstance == NULL) 39 | { 40 | FreeLibrary(m_hInstance); 41 | return FALSE; 42 | } 43 | 44 | m_pPlugin = m_pfnGetInstance(); 45 | if (m_pPlugin == NULL) 46 | { 47 | FreeLibrary(m_hInstance); 48 | return FALSE; 49 | } 50 | } 51 | return (m_hInstance != NULL); 52 | } 53 | 54 | void CPluginWrapper::InitPlugin(CWinApp* pApp, int nPluginIndex) 55 | { 56 | m_nPluginIndex = nPluginIndex; 57 | 58 | // map virtual plugin command id 59 | SetFirstVirtualID(CPluginWrapper::GetCommandIDIndex()); 60 | 61 | m_pPlugin->SetPluginIndex(nPluginIndex); 62 | m_pPlugin->Init(); 63 | } 64 | 65 | void CPluginWrapper::ReleasePlugin() 66 | { 67 | m_pPlugin->Release(); 68 | } 69 | 70 | void CPluginWrapper::QueryPlugin() 71 | { 72 | m_pPlugin->Query(m_PluginInfo); 73 | } 74 | 75 | void CPluginWrapper::ExecutePlugin(UINT nCommandID, CCmdUI* pCmdUI) 76 | { 77 | UINT nActualID = FindCommand(nCommandID); 78 | ASSERT(nActualID != 0); 79 | 80 | m_pPlugin->Execute(nActualID, pCmdUI); 81 | } 82 | 83 | void CPluginWrapper::Draw(CDC* pDC) 84 | { 85 | m_pPlugin->Draw(pDC); 86 | } 87 | 88 | int CPluginWrapper::GetDocTemplateCount() 89 | { 90 | return m_pPlugin->GetDocTemplateCount(); 91 | } 92 | 93 | CPIMultiDocTemplate* CPluginWrapper::GetDocTemplate(int nIndex) 94 | { 95 | ASSERT(nIndex >= 0); 96 | ASSERT(nIndex < GetDocTemplateCount()); 97 | return m_pPlugin->GetDocTemplate(nIndex); 98 | } 99 | 100 | HINSTANCE CPluginWrapper::GetInstance() const 101 | { 102 | return m_hInstance; 103 | } 104 | 105 | const CPluginInfo& CPluginWrapper::GetPluginInfo() const 106 | { 107 | return m_PluginInfo; 108 | } 109 | 110 | UINT CPluginWrapper::GetFirstVirtualID() const 111 | { 112 | return m_nFirstVirtualID; 113 | } 114 | 115 | void CPluginWrapper::SetFirstVirtualID(UINT nCommandID) 116 | { 117 | m_nFirstVirtualID = nCommandID; 118 | } 119 | 120 | UINT CPluginWrapper::GetCommandIDIndex() 121 | { 122 | return m_nCommandIDIndex; 123 | } 124 | 125 | void CPluginWrapper::OffsetCommandIDIndex(int nCount) 126 | { 127 | m_nCommandIDIndex += nCount; 128 | } 129 | 130 | // return command array 131 | const CommandArray& CPluginWrapper::GetCommandArray() const 132 | { 133 | return m_CommandArray; 134 | } 135 | 136 | // add new command 137 | int CPluginWrapper::AddCommand(UINT nActualID) 138 | { 139 | for (int i=0; i CommandArray; 9 | 10 | class CPluginWrapper 11 | { 12 | public: 13 | CPluginWrapper(); // default constructor 14 | virtual ~CPluginWrapper(); // destructor 15 | 16 | private: 17 | CPluginWrapper(CPluginWrapper& other){} // copy constructor 18 | CPluginWrapper& operator=(CPluginWrapper& other){} 19 | 20 | public: 21 | // return true is load successful 22 | BOOL LoadDLL(CString strFileName); 23 | 24 | // Plug-in DLL wrapper functions 25 | void InitPlugin(CWinApp* pApp, int nPluginIndex); 26 | void ReleasePlugin(); 27 | void QueryPlugin(); 28 | void ExecutePlugin(UINT nCommandID, CCmdUI* pCmdUI); 29 | void Draw(CDC* pDC); 30 | int GetDocTemplateCount(); 31 | CPIMultiDocTemplate* GetDocTemplate(int nIndex); 32 | 33 | HINSTANCE GetInstance() const; 34 | const CPluginInfo& GetPluginInfo() const; 35 | 36 | UINT GetFirstVirtualID() const; 37 | void SetFirstVirtualID(UINT nCommandID); 38 | static UINT GetCommandIDIndex(); 39 | static void OffsetCommandIDIndex(int nCount); 40 | 41 | // return command array 42 | const CommandArray& GetCommandArray() const; 43 | // add new command 44 | int AddCommand(UINT nActualID); 45 | // find actual command id 46 | UINT FindCommand(UINT nVirtualID); 47 | // get count of command 48 | int GetCommandCount(); 49 | // get command string 50 | void GetCommandString(UINT nVirtualID, CString& str); 51 | 52 | // member variables 53 | private: 54 | // filename of DLL 55 | CString m_strFileName; 56 | 57 | // Instance of DLL 58 | HINSTANCE m_hInstance; 59 | 60 | // index of all plugin 61 | int m_nPluginIndex; 62 | 63 | CPluginInfo m_PluginInfo; 64 | 65 | // first virtual ID 66 | UINT m_nFirstVirtualID; 67 | // command index 68 | static UINT m_nCommandIDIndex; 69 | 70 | CommandArray m_CommandArray; 71 | 72 | // function pointers. Each of these function pointers has a "wrapper" function in the class 73 | // which allows the rest of he code not to worry about whether the pointer is NULL or not 74 | // DLL initialisation / de-initialisation 75 | GETINSTANCE m_pfnGetInstance; 76 | 77 | CPlugin* m_pPlugin; 78 | }; 79 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MICROSOFT 基础类库 : PluginSupport 项目概述 3 | ======================================================================== 4 | 5 | 6 | 应用程序向导已为您创建了此 PluginSupport DLL。此 DLL 不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写 DLL 的起点。 7 | 8 | 本文件概要介绍组成 PluginSupport DLL 的每个文件的内容。 9 | 10 | PluginSupport.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | PluginSupport.vcxproj.filters 14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 15 | 16 | PluginSupport.h 17 | 这是 DLL 的主头文件。它声明了 CPluginSupportApp 类。 18 | 19 | PluginSupport.cpp 20 | 这是主 DLL 源文件。它包含 CPluginSupportApp 类。 21 | 22 | PluginSupport.rc 23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。 24 | 25 | res\PluginSupport.rc2 26 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。 27 | 28 | PluginSupport.def 29 | 此文件包含在 Microsoft Windows 中运行所必需的 DLL 的有关信息。它定义了 DLL 的名称和说明等参数,而且还从 DLL 导出函数。 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | 其他标准文件: 33 | 34 | StdAfx.h, StdAfx.cpp 35 | 这些文件用于生成名为 PluginSupport.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 36 | 37 | Resource.h 38 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | 其他注释: 42 | 43 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/Resource.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/res/PluginSupport.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/res/PluginSupport.rc2 -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/stdafx.cpp -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/stdafx.h -------------------------------------------------------------------------------- /PluginSupport/PluginSupport/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devonchenc/Plugin/1e26efe852047edff09e7ebf10fb538cf1d822ae/PluginSupport/PluginSupport/targetver.h -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Plugin Framework based on MFC 2 | build by Visual Studio 2013 3 | ====== 4 | 5 | Demo: 6 | MDI application using plugin framework 7 | 8 | PluginSupport: 9 | core of plugin framework 10 | 11 | DrawPlugin: 12 | example of merge plugin's menu&toolbar 13 | 14 | ImagePlugin: 15 | example of insert MultiDocTemplate to main application 16 | 17 | PluginBrowser: 18 | GIMP-like plugin browser 19 | 20 | ImageProcessingPlugin: 21 | inverse image using multi-threading 22 | 23 | CurvePlugin: 24 | adjust image with curves 25 | 26 | LevelPlugin: 27 | adjust image with levels --------------------------------------------------------------------------------