├── .gitignore ├── Plain-C++ ├── AddObj │ ├── AddObj.cpp │ ├── AddObj.dsp │ ├── AddObj.dsw │ ├── AddObj.h │ ├── AddObj.mak │ ├── AddObj.plg │ ├── AddObj.sln │ ├── AddObj.v12.suo │ ├── AddObj.vcxproj │ ├── AddObjFactory.cpp │ ├── AddObjFactory.h │ ├── AddObjGuid.h │ ├── Exports.cpp │ ├── Exports.def │ ├── Factory.cpp │ ├── Factory.h │ ├── IAdd.h │ ├── IAdd.idl │ ├── IAdd.tlb │ ├── IAdd_h.h │ ├── IAdd_i.c │ ├── IAdd_p.c │ ├── REGISTRY.H │ ├── Registry.cpp │ ├── UpgradeLog.htm │ ├── dlldata.c │ ├── resource.h │ └── resource.rc ├── VBClient │ ├── Client.vbw │ ├── CodeGuru.vbw │ ├── CodeGuruDemo.vbp │ ├── CodeGuruDemo.vbw │ ├── frmMain.frm │ └── frmMain.frx └── VCClient │ ├── Client.cpp │ ├── IAdd.tlb │ ├── UpgradeLog.htm │ ├── VCClient.dsp │ ├── VCClient.dsw │ ├── VCClient.mak │ ├── VCClient.opensdf │ ├── VCClient.plg │ ├── VCClient.sln │ ├── VCClient.v12.suo │ └── VCClient.vcxproj ├── README.md ├── Use-ATL ├── ComTest1.sln ├── ComTest1.suo ├── ComTest1 │ ├── ComTest1.aps │ ├── ComTest1.cpp │ ├── ComTest1.def │ ├── ComTest1.idl │ ├── ComTest1.rc │ ├── ComTest1.rgs │ ├── ComTest1.vcxproj │ ├── ComTest1.vcxproj.filters │ ├── ComTest1.vcxproj.user │ ├── ComTest1PS.vcxproj │ ├── ComTest1PS.vcxproj.filters │ ├── ComTest1PS.vcxproj.user │ ├── ComTest1_i.c │ ├── ComTest1_i.h │ ├── ComTest1_p.c │ ├── ComTest1ps.def │ ├── MyClass.cpp │ ├── MyClass.h │ ├── MyClass.rgs │ ├── ReadMe.txt │ ├── compreg.cpp │ ├── compreg.h │ ├── dlldata.c │ ├── dllmain.cpp │ ├── dllmain.h │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h └── ComTest1Test │ ├── ComTest1Test.cpp │ ├── ComTest1Test.vcxproj │ ├── ComTest1Test.vcxproj.filters │ ├── ComTest1Test.vcxproj.user │ ├── ComTest1_i.c │ ├── ComTest1_i.h │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h └── Use-Third-Party-Lib ├── COMProtocol.sln ├── COMProtocol.v12.suo ├── COMProvider ├── COMProvider.cpp ├── COMProvider.def ├── COMProvider.h ├── COMProvider.vcxproj ├── COMProvider.vcxproj.filters ├── ClassFactory.cpp ├── ClassFactory.h ├── DLLMain.cpp ├── Interface.h ├── SampClass.cpp ├── SampleClass.h ├── xlComClass.h └── xlIUnknownImpl.h ├── COMUser ├── COMUser.vcxproj ├── COMUser.vcxproj.filters └── Main.cpp └── xl ├── Algorithm └── xlSort.h ├── App └── xlLog.h ├── Containers ├── xlArray.h ├── xlBinTree.h ├── xlGraph.h ├── xlList.h ├── xlMap.h ├── xlPair.h ├── xlRBTree.h ├── xlSet.h ├── xlTree.h └── xlTuple.h ├── Cryption ├── xlCRC32.h ├── xlMD5.h └── xlSHA1.h ├── Math ├── xlBigInt.h ├── xlInterval.h ├── xlIntervalSet.h └── xlMathBase.h ├── Memory ├── xlMemory.h └── xlSmartPtr.h ├── Meta ├── xlAssert.h ├── xlBind.h ├── xlFunction.h ├── xlMacros.h ├── xlMetaBase.h ├── xlScopeExit.h ├── xlStaticAssert.h ├── xlTypeList.h ├── xlTypeTraits.h └── xlUtility.h ├── Parser └── xlRegExp.h ├── String ├── xlBase64.h ├── xlEncoding.h └── xlString.h ├── Test └── xlUnitTest.h ├── Win32 ├── COM │ ├── InterfaceHelper │ │ ├── xlDWebBrowserEvents2Impl.h │ │ ├── xlDWebBrowserEventsImpl.h │ │ ├── xlIClassFactoryImpl.h │ │ ├── xlIDispatchImpl.h │ │ ├── xlIDocHostUIHandlerImpl.h │ │ ├── xlIObjectWithSiteImpl.h │ │ ├── xlIOleClientSiteImpl.h │ │ ├── xlIOleInPlaceFrameImpl.h │ │ ├── xlIOleInPlaceSiteImpl.h │ │ ├── xlIOleInPlaceUIWindowImpl.h │ │ ├── xlIOleObjectImpl.h │ │ ├── xlIOleWindowImpl.h │ │ ├── xlITfActiveLanguageProfileNotifySinkImpl.h │ │ ├── xlITfCompositionSinkImpl.h │ │ ├── xlITfDisplayAttributeProviderImpl.h │ │ ├── xlITfFnGetPreferredTouchKeyboardLayoutImpl.h │ │ ├── xlITfFunctionImpl.h │ │ ├── xlITfFunctionProviderImpl.h │ │ ├── xlITfKeyEventSinkImpl.h │ │ ├── xlITfLangBarItemButtonImpl.h │ │ ├── xlITfLangBarItemImpl.h │ │ ├── xlITfSourceImpl.h │ │ ├── xlITfTextEditSinkImpl.h │ │ ├── xlITfTextInputProcessorExImpl.h │ │ ├── xlITfTextInputProcessorImpl.h │ │ ├── xlITfThreadFocusSinkImpl.h │ │ ├── xlITfThreadMgrEventSinkImpl.h │ │ ├── xlITypeCompImpl.h │ │ ├── xlITypeInfoImpl.h │ │ ├── xlITypeLibImpl.h │ │ ├── xlIUnknownImpl.h │ │ ├── xlIWMPCoreImpl.h │ │ └── xlIWMPPlayerImpl.h │ ├── Objects │ │ ├── xlMediaPlayer.h │ │ ├── xlOleContainer.h │ │ └── xlWebBrowser.h │ ├── xlClassFactory.h │ ├── xlComClass.h │ ├── xlComDef.h │ ├── xlComInclude.h │ ├── xlComLoader.h │ ├── xlComModule.h │ ├── xlComPtr.h │ └── xlDispatcher.h ├── File │ └── xlIniFile.h ├── GUI │ ├── xlCommCtrlInitializer.h │ ├── xlDialog.h │ ├── xlMenu.h │ ├── xlMenuBase.h │ ├── xlStdButton.h │ ├── xlStdComboBox.h │ ├── xlStdEdit.h │ ├── xlStdLink.h │ ├── xlStdListBox.h │ ├── xlStdListView.h │ ├── xlStdProgressBar.h │ ├── xlStdScrollBar.h │ ├── xlStdStatic.h │ ├── xlThunk.h │ ├── xlWindow.h │ ├── xlWindowAPIMacroRedefine.h │ ├── xlWindowBase.h │ └── xlWindowBaseEx.h ├── Memory │ ├── xlHeap.h │ └── xlSafeSmartPtr.h ├── Messaging │ └── xlMessageBus.h ├── Network │ ├── xlHttpIO.h │ ├── xlSocket.h │ └── xlWinHttp.h ├── Registry │ └── xlRegistry.h ├── Threads │ ├── xlCriticalSection.h │ ├── xlEvent.h │ ├── xlThread.h │ ├── xlThreadPool.h │ └── xlTls.h ├── Timer │ └── xlTimer.h ├── xlDllHelper.h ├── xlHandle.h └── xlWin32Ver.h └── xlDef.h /.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 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opendb 78 | *.opensdf 79 | *.sdf 80 | *.cachefile 81 | *.VC.db 82 | *.VC.VC.opendb 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | *.vspx 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Ignore custom database 93 | MyData.db 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | ## TODO: Comment the next line if you want to checkin your 143 | ## web deploy settings but do note that will include unencrypted 144 | ## passwords 145 | #*.pubxml 146 | 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | 158 | # Windows Azure Build Output 159 | csx/ 160 | *.build.csdef 161 | 162 | # Windows Store app package directory 163 | AppPackages/ 164 | 165 | # Visual Studio cache files 166 | # files ending in .cache can be ignored 167 | *.[Cc]ache 168 | # but keep track of directories ending in .cache 169 | !*.[Cc]ache/ 170 | 171 | # Others 172 | ClientBin/ 173 | [Ss]tyle[Cc]op.* 174 | ~$* 175 | *~ 176 | *.dbmdl 177 | *.dbproj.schemaview 178 | *.pfx 179 | *.publishsettings 180 | node_modules/ 181 | orleans.codegen.cs 182 | 183 | # RIA/Silverlight projects 184 | Generated_Code/ 185 | 186 | # Backup & report files from converting an old project file 187 | # to a newer Visual Studio version. Backup files are not needed, 188 | # because we have git ;-) 189 | _UpgradeReport_Files/ 190 | Backup*/ 191 | UpgradeLog*.XML 192 | UpgradeLog*.htm 193 | 194 | # SQL Server files 195 | *.mdf 196 | *.ldf 197 | 198 | # Business Intelligence projects 199 | *.rdl.data 200 | *.bim.layout 201 | *.bim_*.settings 202 | 203 | # Microsoft Fakes 204 | FakesAssemblies/ 205 | 206 | # Node.js Tools for Visual Studio 207 | .ntvs_analysis.dat 208 | 209 | # Visual Studio 6 build log 210 | *.plg 211 | 212 | # Visual Studio 6 workspace options file 213 | *.opt 214 | 215 | # LightSwitch generated files 216 | GeneratedArtifacts/ 217 | _Pvt_Extensions/ 218 | ModelManifest.xml 219 | 220 | Thumbs.db 221 | 222 | # Mac OS X 223 | .DS_Store -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObj.cpp: -------------------------------------------------------------------------------- 1 | // 2 | //AddObj.cpp 3 | //Contains the C++ class body for implementing the IAdd, IFileIO 4 | //interfaces 5 | // 6 | 7 | 8 | #include 9 | 10 | #include "AddObj.h" 11 | #include "IAdd_i.c" 12 | 13 | 14 | HRESULT __stdcall CAddObj::SetFirstNumber( long nX1) 15 | { 16 | m_nX1=nX1; 17 | if (m_bIsLogEnabled) WriteToLog("Junk"); 18 | return S_OK; 19 | } 20 | 21 | HRESULT __stdcall CAddObj::SetSecondNumber( long nX2) 22 | { 23 | m_nX2=nX2; 24 | return S_OK; 25 | } 26 | 27 | HRESULT __stdcall CAddObj::DoTheAddition( long *pBuffer) 28 | { 29 | *pBuffer =m_nX1 + m_nX2; 30 | 31 | return S_OK; 32 | } 33 | 34 | 35 | HRESULT __stdcall CAddObj::EnableLog( long nEnable) 36 | { 37 | if (nEnable) 38 | m_bIsLogEnabled=TRUE; 39 | else 40 | m_bIsLogEnabled=FALSE; 41 | 42 | return S_OK; 43 | } 44 | 45 | HRESULT __stdcall CAddObj::IsEnabled( long *pEnabled) 46 | { 47 | *pEnabled = m_bIsLogEnabled; 48 | return S_OK; 49 | } 50 | 51 | 52 | HRESULT __stdcall CAddObj::QueryInterface( 53 | REFIID riid , 54 | void **ppObj) 55 | { 56 | if (riid == IID_IUnknown) 57 | { 58 | *ppObj = static_cast(this) ; 59 | AddRef() ; 60 | return S_OK; 61 | } 62 | 63 | if (riid == IID_IAdd) 64 | { 65 | *ppObj = static_cast(this) ; 66 | AddRef() ; 67 | return S_OK; 68 | } 69 | 70 | if (riid == IID_IFileIO) 71 | { 72 | *ppObj = static_cast(this) ; 73 | AddRef() ; 74 | return S_OK; 75 | } 76 | 77 | // 78 | //if control reaches here then , let the client know that 79 | //we do not satisfy the required interface 80 | // 81 | 82 | *ppObj = NULL ; 83 | return E_NOINTERFACE ; 84 | } 85 | 86 | void CAddObj::WriteToLog(char *szBuffer) 87 | { 88 | // 89 | //write to the log file 90 | // 91 | /* 92 | FILE *fp=NULL; 93 | fp = fopen(" 94 | YOU WERE HERE 95 | */ 96 | } -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObj.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 5.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "AddObj"=.\AddObj.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObj.h: -------------------------------------------------------------------------------- 1 | // 2 | //AddObj.h 3 | //Contains the C++ class declarations for implementing the IAdd, IFileIO 4 | //interfaces 5 | // 6 | #include "IAdd.h" 7 | extern long g_nComObjsInUse; 8 | class CAddObj : 9 | public IAdd , 10 | public IFileIO 11 | { 12 | public: 13 | 14 | //IUnknown methods are implemented here 15 | HRESULT __stdcall QueryInterface( 16 | REFIID riid , 17 | void **ppObj); 18 | 19 | 20 | ULONG __stdcall AddRef() 21 | { 22 | return InterlockedIncrement(&m_nRefCount) ; 23 | } 24 | 25 | ULONG __stdcall Release() 26 | { 27 | long nRefCount=0; 28 | nRefCount=InterlockedDecrement(&m_nRefCount) ; 29 | if (nRefCount == 0) delete this; 30 | return nRefCount; 31 | } 32 | 33 | 34 | //IAdd interface 35 | HRESULT __stdcall SetFirstNumber( long nX1); 36 | HRESULT __stdcall SetSecondNumber( long nX2); 37 | HRESULT __stdcall DoTheAddition( long *pBuffer); 38 | 39 | //IFileIO interface 40 | HRESULT __stdcall EnableLog( long nEnable); 41 | HRESULT __stdcall IsEnabled( long *pEnabled); 42 | 43 | 44 | 45 | 46 | CAddObj() 47 | { 48 | // 49 | //constructor 50 | // 51 | 52 | m_nRefCount=0; 53 | m_bIsLogEnabled=FALSE; 54 | 55 | // 56 | //increment the global count 57 | // 58 | InterlockedIncrement(&g_nComObjsInUse); 59 | 60 | // 61 | //set the path to the log file 62 | // 63 | GetTempPath(sizeof(szLogPath),szLogPath); 64 | lstrcat(szLogPath,"cguruAdd.log"); 65 | } 66 | 67 | 68 | ~CAddObj() 69 | { 70 | // 71 | //destructor 72 | //decerement the global object count 73 | InterlockedDecrement(&g_nComObjsInUse); 74 | 75 | } 76 | 77 | 78 | 79 | 80 | private: 81 | void WriteToLog(char *szBuffer); 82 | 83 | long m_nX1 , m_nX2; //operands for addition 84 | 85 | long m_nRefCount; //for managing the reference count 86 | char m_szLogFile[260]; 87 | BOOL m_bIsLogEnabled; 88 | char szLogPath[MAX_PATH]; 89 | 90 | }; -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObj.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: AddObj - Win32 Debug-------------------- 2 | Begining build with project "D:\work\COM_training\Code_Guru_Submission\AddObj\AddObj.dsp", at root. 3 | Active configuration is Win32 (x86) Dynamic-Link Library (based on Win32 (x86) Dynamic-Link Library) 4 | 5 | Project's tools are: 6 | "32-bit C/C++ Compiler for 80x86" with flags "/nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"Debug/" /Fp"Debug/AddObj.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c " 7 | "OLE Type Library Maker" with flags "/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 " 8 | "Win32 Resource Compiler" with flags "/l 0x409 /fo"Debug/resource.res" /d "_DEBUG" " 9 | "Browser Database Maker" with flags "/nologo /o"Debug/AddObj.bsc" " 10 | "COFF Linker for 80x86" with flags "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"Debug/AddObj.pdb" /debug /machine:I386 /def:".\Exports.def" /out:"Debug/AddObj.dll" /implib:"Debug/AddObj.lib" /pdbtype:sept " 11 | "Custom Build" with flags "" 12 | "" with flags "" 13 | 14 | Creating command line "rc.exe /l 0x409 /fo"Debug/resource.res" /d "_DEBUG" "D:\work\COM_training\Code_Guru_Submission\AddObj\resource.rc"" 15 | Creating temp file "C:\TEMP\RSP288.tmp" with contents 21 | Creating command line "cl.exe @C:\TEMP\RSP288.tmp" 22 | Creating temp file "C:\TEMP\RSP289.tmp" with contents 28 | Creating command line "link.exe @C:\TEMP\RSP289.tmp" 29 | Compiling resources... 30 | Compiling... 31 | AddObj.cpp 32 | AddObjFactory.cpp 33 | Exports.cpp 34 | REGISTRY.CPP 35 | Linking... 36 | Creating library Debug/AddObj.lib and object Debug/AddObj.exp 37 | Creating command line "bscmake.exe /nologo /o"Debug/AddObj.bsc" .\Debug\AddObj.sbr .\Debug\AddObjFactory.sbr .\Debug\Exports.sbr .\Debug\REGISTRY.SBR" 38 | Creating browse info file... 39 | Creating temp file "C:\TEMP\RSP28B.bat" with contents <@echo off 40 | echo Registering the DLL 41 | regsvr32 Debug\AddObj.dll 42 | > 43 | Creating command line "C:\TEMP\RSP28B.bat" 44 | 45 | Registering the DLL 46 | 47 | 48 | 49 | AddObj.dll - 0 error(s), 0 warning(s) 50 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObj.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2013 for Windows Desktop 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AddObj", "AddObj.vcxproj", "{536E44B9-0F71-440B-8EC9-9B692C5D1798}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {536E44B9-0F71-440B-8EC9-9B692C5D1798}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {536E44B9-0F71-440B-8EC9-9B692C5D1798}.Debug|Win32.Build.0 = Debug|Win32 16 | {536E44B9-0F71-440B-8EC9-9B692C5D1798}.Release|Win32.ActiveCfg = Release|Win32 17 | {536E44B9-0F71-440B-8EC9-9B692C5D1798}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObj.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Plain-C++/AddObj/AddObj.v12.suo -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObjFactory.cpp: -------------------------------------------------------------------------------- 1 | // 2 | //AddObjFactory.cpp 3 | // 4 | //Contains the method body for the class factory for our super-fast 5 | //addition algorithm COM object 6 | // 7 | #include 8 | #include "AddObjFactory.h" 9 | #include "AddObj.h" 10 | 11 | 12 | 13 | 14 | HRESULT __stdcall CAddFactory::QueryInterface( 15 | const IID& iid, 16 | void** ppv) 17 | { 18 | if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) 19 | { 20 | *ppv = static_cast(this) ; 21 | } 22 | else 23 | { 24 | *ppv = NULL ; 25 | return E_NOINTERFACE ; 26 | } 27 | reinterpret_cast(*ppv)->AddRef() ; 28 | return S_OK ; 29 | } 30 | 31 | 32 | HRESULT __stdcall CAddFactory::LockServer(BOOL bLock) 33 | { 34 | return E_NOTIMPL; 35 | } 36 | 37 | HRESULT __stdcall CAddFactory::CreateInstance(IUnknown* pUnknownOuter, 38 | const IID& iid, 39 | void** ppv) 40 | { 41 | // 42 | //This method lets the client manufacture components en masse 43 | //The class factory provides a mechanism to control the way 44 | //the component is created. Within the class factory the 45 | //author of the component may decide to selectivey enable 46 | //or disable creation as per license agreements 47 | // 48 | // 49 | 50 | // Cannot aggregate. 51 | if (pUnknownOuter != NULL) 52 | { 53 | return CLASS_E_NOAGGREGATION ; 54 | } 55 | 56 | // 57 | // Create an instance of the component. 58 | // 59 | CAddObj* pObject = new CAddObj ; 60 | if (pObject == NULL) 61 | { 62 | return E_OUTOFMEMORY ; 63 | } 64 | 65 | // 66 | // Get the requested interface. 67 | // 68 | return pObject->QueryInterface(iid, ppv) ; 69 | } 70 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObjFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | //AddObjFactory.h 3 | // 4 | //Contains the declaration for the class factory for our super-fast 5 | //addition algorithm COM object 6 | // 7 | 8 | extern long g_nComObjsInUse; 9 | 10 | class CAddFactory : public IClassFactory 11 | { 12 | 13 | public: 14 | CAddFactory() 15 | { 16 | m_nRefCount=0; 17 | // 18 | //increment the global count 19 | // 20 | InterlockedIncrement(&g_nComObjsInUse); 21 | } 22 | 23 | ~CAddFactory() 24 | { 25 | // 26 | //decrement the global count 27 | // 28 | InterlockedDecrement(&g_nComObjsInUse); 29 | } 30 | 31 | 32 | //IUnknown methods are implemented here 33 | HRESULT __stdcall QueryInterface( 34 | REFIID riid , 35 | void **ppObj); 36 | 37 | 38 | ULONG __stdcall AddRef() 39 | { 40 | return InterlockedIncrement(&m_nRefCount) ; 41 | } 42 | 43 | ULONG __stdcall Release() 44 | { 45 | long nRefCount=0; 46 | nRefCount=InterlockedDecrement(&m_nRefCount) ; 47 | if (nRefCount == 0) delete this; 48 | return nRefCount; 49 | } 50 | 51 | 52 | // Interface IClassFactory 53 | virtual HRESULT __stdcall CreateInstance(IUnknown* pUnknownOuter, 54 | const IID& iid, 55 | void** ppv) ; 56 | virtual HRESULT __stdcall LockServer(BOOL bLock) ; 57 | 58 | private: 59 | long m_nRefCount; 60 | }; 61 | 62 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/AddObjGuid.h: -------------------------------------------------------------------------------- 1 | // 2 | //AddObjGuid.h 3 | // 4 | #ifndef __AddObjGuid_h__ 5 | #define __AddObjGuid_h__ 6 | 7 | // {92E7A9C2-F4CB-11d4-825D-00104B3646C0} 8 | static const GUID CLSID_AddObject = 9 | { 0x92e7a9c2, 0xf4cb, 0x11d4, { 0x82, 0x5d, 0x0, 0x10, 0x4b, 0x36, 0x46, 0xc0 } }; 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/Exports.cpp: -------------------------------------------------------------------------------- 1 | // 2 | //Exports.cpp 3 | //Contains the implementation of the COM specified exported functions 4 | //DlLRegisterServer, DllUnRegisterServer, DllGetClassObject, 5 | //DllCanUnloadNow 6 | // 7 | 8 | #include 9 | #include "addobj.h" 10 | #include "AddObjFactory.h" 11 | #include "AddObjGuid.h" 12 | 13 | HMODULE g_hModule=NULL; 14 | long g_nComObjsInUse=0; 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | BOOL APIENTRY DllMain(HANDLE hModule, 18 | DWORD dwReason, 19 | void* lpReserved) 20 | { 21 | if (dwReason == DLL_PROCESS_ATTACH) 22 | { 23 | g_hModule = (HMODULE)hModule ; 24 | } 25 | return TRUE ; 26 | } 27 | 28 | 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | 32 | STDAPI DllGetClassObject(const CLSID& clsid, 33 | const IID& iid, 34 | void** ppv) 35 | { 36 | // 37 | //Check if the requested COM object is implemented in this DLL 38 | //There can be more than 1 COM object implemented in a DLL 39 | // 40 | 41 | if (clsid == CLSID_AddObject) 42 | { 43 | // 44 | //iid specifies the requested interface for the factory object 45 | //The client can request for IUnknown, IClassFactory, 46 | //IClassFactory2 47 | // 48 | CAddFactory *pAddFact = new CAddFactory; 49 | if (pAddFact == NULL) 50 | return E_OUTOFMEMORY; 51 | else 52 | { 53 | return pAddFact->QueryInterface(iid , ppv); 54 | } 55 | } 56 | 57 | 58 | // 59 | //if control reaches here then that implies that the object 60 | //specified by the user is not implemented in this DLL 61 | // 62 | 63 | return CLASS_E_CLASSNOTAVAILABLE; 64 | } 65 | 66 | 67 | 68 | /////////////////////////////////////////////////////////////////////////////// 69 | 70 | STDAPI DllCanUnloadNow() 71 | { 72 | // 73 | //A DLL is no longer in use when it is not managing any existing objects 74 | // (the reference count on all of its objects is 0). 75 | //We will examine the value of g_nComObjsInUse 76 | // 77 | 78 | if (g_nComObjsInUse == 0) 79 | { 80 | return S_OK; 81 | } 82 | else 83 | { 84 | return S_FALSE; 85 | } 86 | 87 | } 88 | 89 | /////////////////////////////////////////////////////////////////////////////// 90 | 91 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/Exports.def: -------------------------------------------------------------------------------- 1 | ; 2 | ;contains the list of functions that are being exported from this DLL 3 | ; 4 | 5 | DESCRIPTION "Simple COM object" 6 | 7 | EXPORTS 8 | DllGetClassObject PRIVATE 9 | DllCanUnloadNow PRIVATE 10 | DllRegisterServer PRIVATE 11 | DllUnregisterServer PRIVATE 12 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/Factory.cpp: -------------------------------------------------------------------------------- 1 | #include "Factory.h" 2 | #include "trace.h" 3 | #include "..\\Interface Declarations\\ISort.h" 4 | #include "Sort.h" 5 | #include "Compnt.h" 6 | 7 | 8 | // 9 | // Class factory IUnknown implementation 10 | // 11 | HRESULT __stdcall CFactory::QueryInterface(const IID& iid, void** ppv) 12 | { 13 | if ((iid == IID_IUnknown) || (iid == IID_IClassFactory)) 14 | { 15 | *ppv = static_cast(this) ; 16 | } 17 | else 18 | { 19 | *ppv = NULL ; 20 | return E_NOINTERFACE ; 21 | } 22 | reinterpret_cast(*ppv)->AddRef() ; 23 | return S_OK ; 24 | } 25 | 26 | ULONG __stdcall CFactory::AddRef() 27 | { 28 | // 29 | //The InterlockedIncrement function increments (increases by one) the 30 | //value of the specified variable and checks the resulting value. The 31 | //function prevents more than one thread from using the same variable 32 | //simultaneously. 33 | // 34 | return InterlockedIncrement(&m_cRef) ; 35 | } 36 | 37 | ULONG __stdcall CFactory::Release() 38 | { 39 | if (InterlockedDecrement(&m_cRef) == 0) 40 | { 41 | delete this ; 42 | return 0 ; 43 | } 44 | return m_cRef ; 45 | } 46 | 47 | // 48 | // IClassFactory implementation 49 | // 50 | HRESULT __stdcall CFactory::CreateInstance(IUnknown* pUnknownOuter, 51 | const IID& iid, 52 | void** ppv) 53 | { 54 | // 55 | //This method lets the client manufacture components en masse 56 | //The class factory provides a mechanism to control the way 57 | //the component is created. Within the class factory the 58 | //author of the component may decide to selectivey enable 59 | //or disable creation as per license agreements 60 | // 61 | // 62 | trace("Class factory:\t\tCreate component.") ; 63 | 64 | // Cannot aggregate. 65 | if (pUnknownOuter != NULL) 66 | { 67 | return CLASS_E_NOAGGREGATION ; 68 | } 69 | 70 | // Create component. 71 | Sort* pObject = new Sort ; 72 | if (pObject == NULL) 73 | { 74 | return E_OUTOFMEMORY ; 75 | } 76 | 77 | // Get the requested interface. 78 | HRESULT hr = pObject->QueryInterface(iid, ppv) ; 79 | 80 | // Release the IUnknown pointer. 81 | // (If QueryInterface failed, component will delete itself.) 82 | pObject->Release() ; 83 | return hr ; 84 | } 85 | 86 | // LockServer 87 | HRESULT __stdcall CFactory::LockServer(BOOL bLock) 88 | { 89 | if (bLock) 90 | { 91 | InterlockedIncrement(&g_cServerLocks) ; 92 | } 93 | else 94 | { 95 | InterlockedDecrement(&g_cServerLocks) ; 96 | } 97 | return S_OK ; 98 | } 99 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/Factory.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SORT_CLASS_FACTORY__ 3 | #define __SORT_CLASS_FACTORY__ 4 | 5 | 6 | #include 7 | #include "trace.h" 8 | /////////////////////////////////////////////////////////// 9 | // 10 | // Class factory 11 | // 12 | class CFactory : public IClassFactory 13 | { 14 | public: 15 | // IUnknown 16 | virtual HRESULT __stdcall QueryInterface(const IID& iid, void** ppv) ; 17 | virtual ULONG __stdcall AddRef() ; 18 | virtual ULONG __stdcall Release() ; 19 | 20 | // Interface IClassFactory 21 | virtual HRESULT __stdcall CreateInstance(IUnknown* pUnknownOuter, 22 | const IID& iid, 23 | void** ppv) ; 24 | virtual HRESULT __stdcall LockServer(BOOL bLock) ; 25 | 26 | // Constructor 27 | CFactory() : m_cRef(1) {} 28 | 29 | // Destructor 30 | ~CFactory() { trace("Class factory:\t\tDestroy self.") ;} 31 | 32 | private: 33 | long m_cRef ; 34 | } ; 35 | 36 | #endif -------------------------------------------------------------------------------- /Plain-C++/AddObj/IAdd.idl: -------------------------------------------------------------------------------- 1 | import "unknwn.idl"; 2 | 3 | [ 4 | object, 5 | uuid(1221db62-f3d8-11d4-825d-00104b3646c0), 6 | helpstring("interface IAdd is used for implementing a super-fast addition Algorithm") 7 | ] 8 | 9 | interface IAdd : IUnknown 10 | { 11 | HRESULT SetFirstNumber(long nX1); 12 | 13 | HRESULT SetSecondNumber(long nX2); 14 | 15 | HRESULT DoTheAddition([out,retval] long *pBuffer); 16 | }; 17 | 18 | 19 | 20 | [ 21 | object, 22 | uuid(6bee2d26-f3d8-11d4-825d-00104b3646c0), 23 | helpstring("interface IFileIO is used for enabling the COM object to log the operations to a file.") 24 | ] 25 | 26 | // 27 | //The interface IFileIO when implemented by a COM object will allow clients 28 | //to control the logging of activity to a disk file. 29 | // 30 | interface IFileIO : IUnknown 31 | { 32 | 33 | // 34 | //to enable logging , pass nEnable=1 35 | //to stop logging pass nEnable=0 36 | // 37 | HRESULT EnableLog(long nEnable); 38 | 39 | // 40 | //if logging has been enabled then, pEnabled passes back 1 41 | //otherwise 0 42 | // 43 | HRESULT IsEnabled(long *pEnabled); 44 | }; 45 | 46 | 47 | 48 | 49 | [ 50 | uuid(3ff1aab8-f3d8-11d4-825d-00104b3646c0), 51 | helpstring("Interfaces for Code-Guru algorithm implementations .") 52 | ] 53 | library CodeGuruMathLib 54 | { 55 | importlib("stdole32.tlb"); 56 | importlib("stdole2.tlb"); 57 | 58 | interface IAdd; 59 | interface IFileIO; 60 | } 61 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/IAdd.tlb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Plain-C++/AddObj/IAdd.tlb -------------------------------------------------------------------------------- /Plain-C++/AddObj/IAdd_i.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ 4 | 5 | /* link this file in with the server and any clients */ 6 | 7 | 8 | /* File created by MIDL compiler version 8.01.0622 */ 9 | /* at Tue Jan 19 11:14:07 2038 10 | */ 11 | /* Compiler settings for IAdd.idl: 12 | Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622 13 | protocol : dce , ms_ext, c_ext, robust 14 | error checks: allocation ref bounds_check enum stub_data 15 | VC __declspec() decoration level: 16 | __declspec(uuid()), __declspec(selectany), __declspec(novtable) 17 | DECLSPEC_UUID(), MIDL_INTERFACE() 18 | */ 19 | /* @@MIDL_FILE_HEADING( ) */ 20 | 21 | 22 | 23 | #ifdef __cplusplus 24 | extern "C"{ 25 | #endif 26 | 27 | 28 | #include 29 | #include 30 | 31 | #ifdef _MIDL_USE_GUIDDEF_ 32 | 33 | #ifndef INITGUID 34 | #define INITGUID 35 | #include 36 | #undef INITGUID 37 | #else 38 | #include 39 | #endif 40 | 41 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 42 | DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) 43 | 44 | #else // !_MIDL_USE_GUIDDEF_ 45 | 46 | #ifndef __IID_DEFINED__ 47 | #define __IID_DEFINED__ 48 | 49 | typedef struct _IID 50 | { 51 | unsigned long x; 52 | unsigned short s1; 53 | unsigned short s2; 54 | unsigned char c[8]; 55 | } IID; 56 | 57 | #endif // __IID_DEFINED__ 58 | 59 | #ifndef CLSID_DEFINED 60 | #define CLSID_DEFINED 61 | typedef IID CLSID; 62 | #endif // CLSID_DEFINED 63 | 64 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 65 | EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} 66 | 67 | #endif // !_MIDL_USE_GUIDDEF_ 68 | 69 | MIDL_DEFINE_GUID(IID, IID_IAdd,0x1221db62,0xf3d8,0x11d4,0x82,0x5d,0x00,0x10,0x4b,0x36,0x46,0xc0); 70 | 71 | 72 | MIDL_DEFINE_GUID(IID, IID_IFileIO,0x6bee2d26,0xf3d8,0x11d4,0x82,0x5d,0x00,0x10,0x4b,0x36,0x46,0xc0); 73 | 74 | 75 | MIDL_DEFINE_GUID(IID, LIBID_CodeGuruMathLib,0x3ff1aab8,0xf3d8,0x11d4,0x82,0x5d,0x00,0x10,0x4b,0x36,0x46,0xc0); 76 | 77 | #undef MIDL_DEFINE_GUID 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/REGISTRY.H: -------------------------------------------------------------------------------- 1 | #ifndef __Registry_H__ 2 | #define __Registry_H__ 3 | // 4 | // Registry.h 5 | // - Helper functions registering and unregistering a component. 6 | // 7 | 8 | // This function will register a component in the Registry. 9 | // The component calls this function from its DllRegisterServer function. 10 | HRESULT RegisterServer(HMODULE hModule, 11 | const CLSID& clsid, 12 | const char* szFriendlyName, 13 | const char* szVerIndProgID, 14 | const char* szProgID) ; 15 | 16 | // This function will unregister a component. Components 17 | // call this function from their DllUnregisterServer function. 18 | HRESULT UnregisterServer(const CLSID& clsid, 19 | const char* szVerIndProgID, 20 | const char* szProgID) ; 21 | 22 | #endif -------------------------------------------------------------------------------- /Plain-C++/AddObj/UpgradeLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Plain-C++/AddObj/UpgradeLog.htm -------------------------------------------------------------------------------- /Plain-C++/AddObj/dlldata.c: -------------------------------------------------------------------------------- 1 | /********************************************************* 2 | DllData file -- generated by MIDL compiler 3 | 4 | DO NOT ALTER THIS FILE 5 | 6 | This file is regenerated by MIDL on every IDL file compile. 7 | 8 | To completely reconstruct this file, delete it and rerun MIDL 9 | on all the IDL files in this DLL, specifying this file for the 10 | /dlldata command line option 11 | 12 | *********************************************************/ 13 | 14 | 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | EXTERN_PROXY_FILE( IAdd ) 22 | 23 | 24 | PROXYFILE_LIST_START 25 | /* Start of list */ 26 | REFERENCE_PROXY_FILE( IAdd ), 27 | /* End of list */ 28 | PROXYFILE_LIST_END 29 | 30 | 31 | DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) 32 | 33 | #ifdef __cplusplus 34 | } /*extern "C" */ 35 | #endif 36 | 37 | /* end of generated dlldata file */ 38 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by resource.rc 4 | // 5 | #define IDR_TYPELIB1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 103 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /Plain-C++/AddObj/resource.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "windows.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // TYPELIB 27 | // 28 | 29 | 1 TYPELIB DISCARDABLE "IAdd.tlb" 30 | 31 | #ifdef APSTUDIO_INVOKED 32 | ///////////////////////////////////////////////////////////////////////////// 33 | // 34 | // TEXTINCLUDE 35 | // 36 | 37 | 1 TEXTINCLUDE DISCARDABLE 38 | BEGIN 39 | "resource.h\0" 40 | END 41 | 42 | 2 TEXTINCLUDE DISCARDABLE 43 | BEGIN 44 | "#include ""afxres.h""\r\n" 45 | "\0" 46 | END 47 | 48 | 3 TEXTINCLUDE DISCARDABLE 49 | BEGIN 50 | "\r\n" 51 | "\0" 52 | END 53 | 54 | #endif // APSTUDIO_INVOKED 55 | 56 | #endif // English (U.S.) resources 57 | ///////////////////////////////////////////////////////////////////////////// 58 | 59 | 60 | 61 | #ifndef APSTUDIO_INVOKED 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Generated from the TEXTINCLUDE 3 resource. 65 | // 66 | 67 | 68 | ///////////////////////////////////////////////////////////////////////////// 69 | #endif // not APSTUDIO_INVOKED 70 | 71 | -------------------------------------------------------------------------------- /Plain-C++/VBClient/Client.vbw: -------------------------------------------------------------------------------- 1 | frmMain = 66, 66, 459, 409, Z, 22, 22, 415, 365, 2 | -------------------------------------------------------------------------------- /Plain-C++/VBClient/CodeGuru.vbw: -------------------------------------------------------------------------------- 1 | frmMain = 0, 0, 0, 0, C, 22, 22, 437, 365, Z 2 | -------------------------------------------------------------------------------- /Plain-C++/VBClient/CodeGuruDemo.vbp: -------------------------------------------------------------------------------- 1 | Type=Exe 2 | Reference=*\G{3FF1AAB8-F3D8-11D4-825D-00104B3646C0}#0.0#0#..\AddObjD:\work\COM_train#Interfaces for Code Guru algorithm implementations . 3 | Form=frmMain.frm 4 | IconForm="frmMain" 5 | Startup="frmMain" 6 | HelpFile="" 7 | ExeName32="CodeGuru.exe" 8 | Command32="" 9 | Name="CodeGuru" 10 | HelpContextID="0" 11 | CompatibleMode="0" 12 | MajorVer=1 13 | MinorVer=0 14 | RevisionVer=0 15 | AutoIncrementVer=0 16 | ServerSupportFiles=0 17 | VersionCompanyName="JUNKER" 18 | CompilationType=0 19 | OptimizationType=0 20 | FavorPentiumPro(tm)=0 21 | CodeViewDebugInfo=0 22 | NoAliasing=0 23 | BoundsCheck=0 24 | OverflowCheck=0 25 | FlPointCheck=0 26 | FDIVCheck=0 27 | UnroundedFP=0 28 | StartMode=0 29 | Unattended=0 30 | ThreadPerObject=0 31 | MaxNumberOfThreads=1 32 | -------------------------------------------------------------------------------- /Plain-C++/VBClient/CodeGuruDemo.vbw: -------------------------------------------------------------------------------- 1 | frmMain = 44, 44, 270, 387, C, 22, 22, 437, 365, Z 2 | -------------------------------------------------------------------------------- /Plain-C++/VBClient/frmMain.frx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Plain-C++/VBClient/frmMain.frx -------------------------------------------------------------------------------- /Plain-C++/VCClient/Client.cpp: -------------------------------------------------------------------------------- 1 | // 2 | ///Client.cpp 3 | // 4 | //Demo of client using the COM object from AddObj.dll 5 | // 6 | 7 | #include 8 | #include 9 | #include 10 | #import "IAdd.tlb" 11 | // 12 | //Here we do a #import on the DLL ,you can also do a #import on the .TLB 13 | //The #import directive generates two files in the output folders. 14 | // 15 | 16 | void main() 17 | { 18 | long n1 =100, n2=200; 19 | long nOutPut = 0; 20 | 21 | CoInitialize(NULL); 22 | CodeGuruMathLib::IAddPtr pFastAddAlgorithm; 23 | // 24 | //IAddPtr is not the actual interface IAdd, but a template C++ class (_com_ptr_t) 25 | //that contains an embedded instance of the raw IAdd pointer 26 | //While destructing , the destructor makes sure to invoke Release() on the internal 27 | //raw interface pointer. Further, the operator -> has been overloaded to direct all 28 | //method invocations to the internal raw interface pointer. 29 | // 30 | pFastAddAlgorithm.CreateInstance("CodeGuru.FastAddition"); 31 | 32 | 33 | printf("\nEnter the first number:"); 34 | scanf("%d",&n1); 35 | 36 | printf("\nEnter the second number:"); 37 | scanf("%d",&n2); 38 | 39 | pFastAddAlgorithm->SetFirstNumber(n1); //"->" overloading in action 40 | pFastAddAlgorithm->SetSecondNumber(n2); 41 | nOutPut = pFastAddAlgorithm->DoTheAddition(); 42 | 43 | printf("\nOutput after adding %d & %d is %d\n",n1,n2,nOutPut); 44 | printf("\nPress a key to exit the application...."); 45 | getch(); 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /Plain-C++/VCClient/IAdd.tlb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Plain-C++/VCClient/IAdd.tlb -------------------------------------------------------------------------------- /Plain-C++/VCClient/UpgradeLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Plain-C++/VCClient/UpgradeLog.htm -------------------------------------------------------------------------------- /Plain-C++/VCClient/VCClient.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="VCClient" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 5.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=VCClient - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "VCClient.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "VCClient.mak" CFG="VCClient - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "VCClient - Win32 Release" (based on\ 21 | "Win32 (x86) Console Application") 22 | !MESSAGE "VCClient - Win32 Debug" (based on "Win32 (x86) Console Application") 23 | !MESSAGE 24 | 25 | # Begin Project 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "VCClient - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir "Release" 36 | # PROP BASE Intermediate_Dir "Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir "Release" 41 | # PROP Intermediate_Dir "Release" 42 | # PROP Target_Dir "" 43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 44 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 45 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 46 | # ADD RSC /l 0x409 /d "NDEBUG" 47 | BSC32=bscmake.exe 48 | # ADD BASE BSC32 /nologo 49 | # ADD BSC32 /nologo 50 | LINK32=link.exe 51 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 52 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 53 | 54 | !ELSEIF "$(CFG)" == "VCClient - Win32 Debug" 55 | 56 | # PROP BASE Use_MFC 0 57 | # PROP BASE Use_Debug_Libraries 1 58 | # PROP BASE Output_Dir "Debug" 59 | # PROP BASE Intermediate_Dir "Debug" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "Debug" 64 | # PROP Intermediate_Dir "Debug" 65 | # PROP Target_Dir "" 66 | # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 67 | # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 68 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 69 | # ADD RSC /l 0x409 /d "_DEBUG" 70 | BSC32=bscmake.exe 71 | # ADD BASE BSC32 /nologo 72 | # ADD BSC32 /nologo 73 | LINK32=link.exe 74 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept 75 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept 76 | 77 | !ENDIF 78 | 79 | # Begin Target 80 | 81 | # Name "VCClient - Win32 Release" 82 | # Name "VCClient - Win32 Debug" 83 | # Begin Source File 84 | 85 | SOURCE=.\Client.cpp 86 | # End Source File 87 | # End Target 88 | # End Project 89 | -------------------------------------------------------------------------------- /Plain-C++/VCClient/VCClient.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 5.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "VCClient"=.\VCClient.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /Plain-C++/VCClient/VCClient.opensdf: -------------------------------------------------------------------------------- 1 | userUSER-MACPC -------------------------------------------------------------------------------- /Plain-C++/VCClient/VCClient.plg: -------------------------------------------------------------------------------- 1 | --------------------Configuration: VCClient - Win32 Debug-------------------- 2 | Begining build with project "D:\work\COM_training\Code_Guru_Submission\VCClient\VCClient.dsp", at root. 3 | Active configuration is Win32 (x86) Console Application (based on Win32 (x86) Console Application) 4 | 5 | Project's tools are: 6 | "32-bit C/C++ Compiler for 80x86" with flags "/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/VCClient.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c " 7 | "Win32 Resource Compiler" with flags "/l 0x409 /d "_DEBUG" " 8 | "Browser Database Maker" with flags "/nologo /o"Debug/VCClient.bsc" " 9 | "COFF Linker for 80x86" with flags "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/VCClient.pdb" /debug /machine:I386 /out:"Debug/VCClient.exe" /pdbtype:sept " 10 | "Custom Build" with flags "" 11 | "" with flags "" 12 | 13 | Creating temp file "C:\TEMP\RSP3A4.tmp" with contents 16 | Creating command line "cl.exe @C:\TEMP\RSP3A4.tmp" 17 | Creating temp file "C:\TEMP\RSP3A5.tmp" with contents 19 | Creating command line "link.exe @C:\TEMP\RSP3A5.tmp" 20 | Compiling... 21 | Client.cpp 22 | Linking... 23 | 24 | 25 | 26 | VCClient.exe - 0 error(s), 0 warning(s) 27 | -------------------------------------------------------------------------------- /Plain-C++/VCClient/VCClient.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2013 for Windows Desktop 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCClient", "VCClient.vcxproj", "{13EFA738-F56C-4CBD-A7E0-DCD32287EAC3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {13EFA738-F56C-4CBD-A7E0-DCD32287EAC3}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {13EFA738-F56C-4CBD-A7E0-DCD32287EAC3}.Debug|Win32.Build.0 = Debug|Win32 16 | {13EFA738-F56C-4CBD-A7E0-DCD32287EAC3}.Release|Win32.ActiveCfg = Release|Win32 17 | {13EFA738-F56C-4CBD-A7E0-DCD32287EAC3}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Plain-C++/VCClient/VCClient.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Plain-C++/VCClient/VCClient.v12.suo -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 中间件技术 COM 实验示例代码 2 | ======================= 3 | 4 | ## 运行环境 5 | 6 | * Windows 10 7 | * Visual Studio 2017 8 | 9 | 10 | ## 代码说明 11 | 12 | 仓库中包含了多个 COM 实现: 13 | 14 | * [纯 C++ 版](https://github.com/HIT-Alibaba/COM-Example/tree/master/Plain-C%2B%2B) 15 | 16 | 代码来自 [Step by Step COM Tutorial](http://www.codeguru.com/cpp/com-tech/activex/tutorials/article.php/c5567/Step-by-Step-COM-Tutorial.htm),略作修改使其能在 VS 2013 上编译。 17 | 18 | * [使用第三方库](https://github.com/HIT-Alibaba/COM-Example/tree/master/Use-Third-Party-Lib) 19 | 20 | 使用 [xlLib](https://github.com/Streamlet/xlLib) 库实现。 21 | 22 | * [使用 ATL](https://github.com/HIT-Alibaba/COM-Example/tree/master/Use-ATL) 23 | 24 | 使用 ATL 实现的版本。 25 | 26 | ## 注意事项 27 | 28 | * 如果提示 midl.exe 退出(2214),打开项目属性 -> 配置属性 -> MIDL -> 常规,在右侧把“与 MkTypLib 兼容”置为否 29 | * 注册 DLL 需要以管理员模式运行 cmd,然后再执行 regsvr32, 不然不能正确注册,切记! 30 | 31 | 32 | ## 贡献者 33 | 34 | * [skyline75489](https://github.com/skyline75489) 35 | * [marcoszh](https://github.com/marcoszh) 36 | * 以及不上 Github 的龙哥 37 | 38 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComTest1", "ComTest1\ComTest1.vcxproj", "{2C9B578E-92F2-4A41-AC6F-41CBA9B996C6}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComTest1PS", "ComTest1\ComTest1PS.vcxproj", "{E7851E16-6168-4A89-9EDE-0AEFAA9D439F}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {2C9B578E-92F2-4A41-AC6F-41CBA9B996C6} = {2C9B578E-92F2-4A41-AC6F-41CBA9B996C6} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComTest1Test", "ComTest1Test\ComTest1Test.vcxproj", "{9FB7F79F-AC70-465A-9F04-72E3AD25067A}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Win32 = Debug|Win32 16 | Release|Win32 = Release|Win32 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {2C9B578E-92F2-4A41-AC6F-41CBA9B996C6}.Debug|Win32.ActiveCfg = Debug|Win32 20 | {2C9B578E-92F2-4A41-AC6F-41CBA9B996C6}.Debug|Win32.Build.0 = Debug|Win32 21 | {2C9B578E-92F2-4A41-AC6F-41CBA9B996C6}.Release|Win32.ActiveCfg = Release|Win32 22 | {2C9B578E-92F2-4A41-AC6F-41CBA9B996C6}.Release|Win32.Build.0 = Release|Win32 23 | {E7851E16-6168-4A89-9EDE-0AEFAA9D439F}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {E7851E16-6168-4A89-9EDE-0AEFAA9D439F}.Release|Win32.ActiveCfg = Release|Win32 25 | {9FB7F79F-AC70-465A-9F04-72E3AD25067A}.Debug|Win32.ActiveCfg = Debug|Win32 26 | {9FB7F79F-AC70-465A-9F04-72E3AD25067A}.Debug|Win32.Build.0 = Debug|Win32 27 | {9FB7F79F-AC70-465A-9F04-72E3AD25067A}.Release|Win32.ActiveCfg = Release|Win32 28 | {9FB7F79F-AC70-465A-9F04-72E3AD25067A}.Release|Win32.Build.0 = Release|Win32 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1.suo -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/ComTest1.aps -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/ComTest1.cpp -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/ComTest1.def -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.idl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/ComTest1.idl -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/ComTest1.rc -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove {879ADCC7-9EDE-48B1-A244-C268DBBEB998} = s 'CompReg Class' 6 | { 7 | InprocServer32 = s '%MODULE%' 8 | { 9 | val ThreadingModel = s 'Apartment' 10 | } 11 | TypeLib = s '{11260EF9-876C-4EA4-A416-17F32B15EF8C}' 12 | Version = s '1.0' 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.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 | {82cdc78c-737d-435c-9f27-d6e1adf92407} 18 | False 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 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1PS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {d96e4575-4fc7-4d45-a53e-a79a89c2e45c} 6 | 7 | 8 | {8756da90-45b9-4ca2-8deb-e5bda11bdb4e} 9 | False 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 生成的文件 18 | 19 | 20 | 生成的文件 21 | 22 | 23 | 生成的文件 24 | 25 | 26 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1PS.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1_i.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ 4 | 5 | /* link this file in with the server and any clients */ 6 | 7 | 8 | /* File created by MIDL compiler version 8.01.0622 */ 9 | /* at Tue Jan 19 11:14:07 2038 10 | */ 11 | /* Compiler settings for ComTest1.idl: 12 | Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622 13 | protocol : dce , ms_ext, c_ext, robust 14 | error checks: allocation ref bounds_check enum stub_data 15 | VC __declspec() decoration level: 16 | __declspec(uuid()), __declspec(selectany), __declspec(novtable) 17 | DECLSPEC_UUID(), MIDL_INTERFACE() 18 | */ 19 | /* @@MIDL_FILE_HEADING( ) */ 20 | 21 | 22 | 23 | #ifdef __cplusplus 24 | extern "C"{ 25 | #endif 26 | 27 | 28 | #include 29 | #include 30 | 31 | #ifdef _MIDL_USE_GUIDDEF_ 32 | 33 | #ifndef INITGUID 34 | #define INITGUID 35 | #include 36 | #undef INITGUID 37 | #else 38 | #include 39 | #endif 40 | 41 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 42 | DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) 43 | 44 | #else // !_MIDL_USE_GUIDDEF_ 45 | 46 | #ifndef __IID_DEFINED__ 47 | #define __IID_DEFINED__ 48 | 49 | typedef struct _IID 50 | { 51 | unsigned long x; 52 | unsigned short s1; 53 | unsigned short s2; 54 | unsigned char c[8]; 55 | } IID; 56 | 57 | #endif // __IID_DEFINED__ 58 | 59 | #ifndef CLSID_DEFINED 60 | #define CLSID_DEFINED 61 | typedef IID CLSID; 62 | #endif // CLSID_DEFINED 63 | 64 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 65 | EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} 66 | 67 | #endif // !_MIDL_USE_GUIDDEF_ 68 | 69 | MIDL_DEFINE_GUID(IID, IID_IComponentRegistrar,0xa817e7a2,0x43fa,0x11d0,0x9e,0x44,0x00,0xaa,0x00,0xb6,0x77,0x0a); 70 | 71 | 72 | MIDL_DEFINE_GUID(IID, IID_IMyClass,0xB4D46A93,0xFF10,0x46D8,0x87,0xD3,0x8E,0x68,0x1E,0x70,0xCB,0x80); 73 | 74 | 75 | MIDL_DEFINE_GUID(IID, LIBID_ComTest1Lib,0x11260EF9,0x876C,0x4EA4,0xA4,0x16,0x17,0xF3,0x2B,0x15,0xEF,0x8C); 76 | 77 | 78 | MIDL_DEFINE_GUID(CLSID, CLSID_CompReg,0x879ADCC7,0x9EDE,0x48B1,0xA2,0x44,0xC2,0x68,0xDB,0xBE,0xB9,0x98); 79 | 80 | 81 | MIDL_DEFINE_GUID(CLSID, CLSID_MyClass,0xC705079D,0x5C40,0x4508,0x9A,0x3F,0x0F,0x17,0xC2,0x1B,0xD3,0xBE); 82 | 83 | #undef MIDL_DEFINE_GUID 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ComTest1ps.def: -------------------------------------------------------------------------------- 1 | 2 | LIBRARY 3 | 4 | EXPORTS 5 | DllGetClassObject PRIVATE 6 | DllCanUnloadNow PRIVATE 7 | DllRegisterServer PRIVATE 8 | DllUnregisterServer PRIVATE 9 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/MyClass.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/MyClass.cpp -------------------------------------------------------------------------------- /Use-ATL/ComTest1/MyClass.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/MyClass.h -------------------------------------------------------------------------------- /Use-ATL/ComTest1/MyClass.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | MyClass.math.1 = s 'MyClass Class' 4 | { 5 | CLSID = s '{C705079D-5C40-4508-9A3F-0F17C21BD3BE}' 6 | } 7 | MyClass.math = s 'MyClass Class' 8 | { 9 | CurVer = s 'MyClass.math.1' 10 | } 11 | NoRemove CLSID 12 | { 13 | ForceRemove {C705079D-5C40-4508-9A3F-0F17C21BD3BE} = s 'MyClass Class' 14 | { 15 | ProgID = s 'MyClass.math.1' 16 | VersionIndependentProgID = s 'MyClass.math' 17 | ForceRemove Programmable 18 | InprocServer32 = s '%MODULE%' 19 | { 20 | val ThreadingModel = s 'Apartment' 21 | } 22 | TypeLib = s '{11260EF9-876C-4EA4-A416-17F32B15EF8C}' 23 | Version = s '1.0' 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | 活动模板库 : ComTest1 项目概述 3 | ======================================================================== 4 | 5 | 应用程序向导已为您创建了此 ComTest1 项目,作为编写动态链接库 (DLL) 6 | 的起点。 7 | 8 | 本文件概要介绍组成项目的每个文件的内容。 9 | 10 | ComTest1.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件, 12 | 其中包含生成该文件的 Visual C++ 的版本信息, 13 | 以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 14 | 15 | ComTest1.vcxproj.filters 16 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。 17 | 它包含有关项目文件与筛选器之间的关联信息。 在 IDE 中,通过这种关联, 18 | 在特定节点下以分组形式显示具有相似扩展名的文件。 19 | 例如,“.cpp”文件与“源文件”筛选器关联。 20 | 21 | ComTest1.idl 22 | 此文件包含项目中定义的类型库、接口和组件类的 IDL 定义。 23 | 此文件将由 MIDL 编译器处理以生成: 24 | C++ 接口定义和 GUID 声明 (ComTest1.h) 25 | GUID 定义 (ComTest1_i.c) 26 | 类型库 (ComTest1.tlb) 27 | 封送处理代码 (ComTest1_p.c 和 28 | dlldata.c) 29 | 30 | ComTest1.h 31 | 此文件包含 ComTest1.idl 中定义的项目的 C++ 接口定义 32 | 和 GUID 声明。 它将在编译过程中由 MIDL 重新生成。 33 | 34 | ComTest1.cpp 35 | 此文件包含对象映射和 DLL 导出的实现。 36 | 37 | ComTest1.rc 38 | 这是程序使用的所有 Microsoft Windows 资源的列表。 39 | 40 | ComTest1.def 41 | 此模块定义文件为链接器提供有关 DLL 所要求的导出的信息, 42 | 它包含用于以下内容的导出: 43 | DllGetClassObject 44 | DllCanUnloadNow 45 | DllRegisterServer 46 | DllUnregisterServer 47 | DllInstall 48 | 49 | ///////////////////////////////////////////////////////////////////////////// 50 | 其他标准文件: 51 | 52 | StdAfx.h,StdAfx.cpp 53 | 这些文件用于生成名为 ComTest1.pch 的预编译头 (PCH) 文件和 54 | 名为 StdAfx.obj 的预编译类型文件。 55 | 56 | Resource.h 57 | 这是用于定义资源 ID 的标准头文件。 58 | 59 | ///////////////////////////////////////////////////////////////////////////// 60 | 代理/存根 (stub) DLL 项目和模块定义文件: 61 | 62 | ComTest1ps.vcxproj 63 | 此文件是用于生成代理/存根 (stub) DLL 的项目文件(若有必要)。主项目中的 IDL 64 | 文件必须至少包含一个接口,并且在生成代理/存根 (stub) DLL 之前必须先编译 IDL 65 | 文件。此进程生成 dlldata.c、ComTest1_i.c 和 66 | ComTest1_p.c,这些文件是生成代理/存根 (stub) DLL 所必需的。 67 | 68 | ComTest1ps.vcxproj.filters 69 | 此文件是代理/存根项目的筛选器文件。 它包含有关项目 70 | 文件与筛选器之间的关联信息。 在 IDE 中, 71 | 通过这种关联,在特定节点下以分组形式显示具有相似扩展名 72 | 的文件(例如,“.cpp”文件与“源文件”筛选器关联)。 73 | 74 | ComTest1ps.def 75 | 此模块定义文件为链接器提供有关代理/存根 (stub) 所要求的导出的信息。 76 | 77 | ///////////////////////////////////////////////////////////////////////////// 78 | 其他注释: 79 | 80 | “COM+ 1.0 支持”选项可用于将 COM+ 1.0 库构建到您的主干应用程序中, 81 | 从而让您能够使用 COM+ 1.0 类、对象和函数。 82 | 83 | ///////////////////////////////////////////////////////////////////////////// 84 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/compreg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/compreg.cpp -------------------------------------------------------------------------------- /Use-ATL/ComTest1/compreg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/compreg.h -------------------------------------------------------------------------------- /Use-ATL/ComTest1/dlldata.c: -------------------------------------------------------------------------------- 1 | /********************************************************* 2 | DllData file -- generated by MIDL compiler 3 | 4 | DO NOT ALTER THIS FILE 5 | 6 | This file is regenerated by MIDL on every IDL file compile. 7 | 8 | To completely reconstruct this file, delete it and rerun MIDL 9 | on all the IDL files in this DLL, specifying this file for the 10 | /dlldata command line option 11 | 12 | *********************************************************/ 13 | 14 | #define PROXY_DELEGATION 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | EXTERN_PROXY_FILE( ComTest1 ) 23 | 24 | 25 | PROXYFILE_LIST_START 26 | /* Start of list */ 27 | REFERENCE_PROXY_FILE( ComTest1 ), 28 | /* End of list */ 29 | PROXYFILE_LIST_END 30 | 31 | 32 | DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) 33 | 34 | #ifdef __cplusplus 35 | } /*extern "C" */ 36 | #endif 37 | 38 | /* end of generated dlldata file */ 39 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1/dllmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/dllmain.cpp -------------------------------------------------------------------------------- /Use-ATL/ComTest1/dllmain.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/dllmain.h -------------------------------------------------------------------------------- /Use-ATL/ComTest1/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/resource.h -------------------------------------------------------------------------------- /Use-ATL/ComTest1/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/stdafx.cpp -------------------------------------------------------------------------------- /Use-ATL/ComTest1/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/stdafx.h -------------------------------------------------------------------------------- /Use-ATL/ComTest1/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1/targetver.h -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/ComTest1Test.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1Test/ComTest1Test.cpp -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/ComTest1Test.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 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/ComTest1Test.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/ComTest1_i.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ 4 | 5 | /* link this file in with the server and any clients */ 6 | 7 | 8 | /* File created by MIDL compiler version 7.00.0555 */ 9 | /* at Mon Mar 23 14:23:53 2015 10 | */ 11 | /* Compiler settings for ComTest1.idl: 12 | Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 13 | protocol : dce , ms_ext, c_ext, robust 14 | error checks: allocation ref bounds_check enum stub_data 15 | VC __declspec() decoration level: 16 | __declspec(uuid()), __declspec(selectany), __declspec(novtable) 17 | DECLSPEC_UUID(), MIDL_INTERFACE() 18 | */ 19 | /* @@MIDL_FILE_HEADING( ) */ 20 | 21 | #pragma warning( disable: 4049 ) /* more than 64k source lines */ 22 | 23 | 24 | #ifdef __cplusplus 25 | extern "C"{ 26 | #endif 27 | 28 | 29 | #include 30 | #include 31 | 32 | #ifdef _MIDL_USE_GUIDDEF_ 33 | 34 | #ifndef INITGUID 35 | #define INITGUID 36 | #include 37 | #undef INITGUID 38 | #else 39 | #include 40 | #endif 41 | 42 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 43 | DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) 44 | 45 | #else // !_MIDL_USE_GUIDDEF_ 46 | 47 | #ifndef __IID_DEFINED__ 48 | #define __IID_DEFINED__ 49 | 50 | typedef struct _IID 51 | { 52 | unsigned long x; 53 | unsigned short s1; 54 | unsigned short s2; 55 | unsigned char c[8]; 56 | } IID; 57 | 58 | #endif // __IID_DEFINED__ 59 | 60 | #ifndef CLSID_DEFINED 61 | #define CLSID_DEFINED 62 | typedef IID CLSID; 63 | #endif // CLSID_DEFINED 64 | 65 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 66 | const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} 67 | 68 | #endif !_MIDL_USE_GUIDDEF_ 69 | 70 | MIDL_DEFINE_GUID(IID, IID_IComponentRegistrar,0xa817e7a2,0x43fa,0x11d0,0x9e,0x44,0x00,0xaa,0x00,0xb6,0x77,0x0a); 71 | 72 | 73 | MIDL_DEFINE_GUID(IID, IID_IMyClass,0xB4D46A93,0xFF10,0x46D8,0x87,0xD3,0x8E,0x68,0x1E,0x70,0xCB,0x80); 74 | 75 | 76 | MIDL_DEFINE_GUID(IID, LIBID_ComTest1Lib,0x11260EF9,0x876C,0x4EA4,0xA4,0x16,0x17,0xF3,0x2B,0x15,0xEF,0x8C); 77 | 78 | 79 | MIDL_DEFINE_GUID(CLSID, CLSID_CompReg,0x879ADCC7,0x9EDE,0x48B1,0xA2,0x44,0xC2,0x68,0xDB,0xBE,0xB9,0x98); 80 | 81 | 82 | MIDL_DEFINE_GUID(CLSID, CLSID_MyClass,0xC705079D,0x5C40,0x4508,0x9A,0x3F,0x0F,0x17,0xC2,0x1B,0xD3,0xBE); 83 | 84 | #undef MIDL_DEFINE_GUID 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | 控制台应用程序:ComTest1Test 项目概述 3 | ======================================================================== 4 | 5 | 应用程序向导已为您创建了此 ComTest1Test 应用程序。 6 | 7 | 本文件概要介绍组成 ComTest1Test 应用程序的每个文件的内容。 8 | 9 | 10 | ComTest1Test.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件, 12 | 其中包含生成该文件的 Visual C++ 13 | 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 14 | 15 | ComTest1Test.vcxproj.filters 16 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。 17 | 它包含有关项目文件与筛选器之间的关联信息。 在 IDE 18 | 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。 19 | 例如,“.cpp”文件与“源文件”筛选器关联。 20 | 21 | ComTest1Test.cpp 22 | 这是主应用程序源文件。 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | 其他标准文件: 26 | 27 | StdAfx.h,StdAfx.cpp 28 | 这些文件用于生成名为 ComTest1Test.pch 的预编译头 (PCH) 文件和 29 | 名为 StdAfx.obj 的预编译类型文件。 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | 其他注释: 33 | 34 | 应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 35 | 36 | ///////////////////////////////////////////////////////////////////////////// 37 | -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1Test/stdafx.cpp -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1Test/stdafx.h -------------------------------------------------------------------------------- /Use-ATL/ComTest1Test/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-ATL/ComTest1Test/targetver.h -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProtocol.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMProvider", "COMProvider\COMProvider.vcxproj", "{5F0FEA66-C5A2-4332-AEAE-6784CACC48DA}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMUser", "COMUser\COMUser.vcxproj", "{C2FEDB8C-96D0-41C1-A584-AD77364F750D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5F0FEA66-C5A2-4332-AEAE-6784CACC48DA}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {5F0FEA66-C5A2-4332-AEAE-6784CACC48DA}.Debug|Win32.Build.0 = Debug|Win32 16 | {5F0FEA66-C5A2-4332-AEAE-6784CACC48DA}.Release|Win32.ActiveCfg = Release|Win32 17 | {5F0FEA66-C5A2-4332-AEAE-6784CACC48DA}.Release|Win32.Build.0 = Release|Win32 18 | {C2FEDB8C-96D0-41C1-A584-AD77364F750D}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {C2FEDB8C-96D0-41C1-A584-AD77364F750D}.Debug|Win32.Build.0 = Debug|Win32 20 | {C2FEDB8C-96D0-41C1-A584-AD77364F750D}.Release|Win32.ActiveCfg = Release|Win32 21 | {C2FEDB8C-96D0-41C1-A584-AD77364F750D}.Release|Win32.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProtocol.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-Third-Party-Lib/COMProtocol.v12.suo -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/COMProvider.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | 3 | EXPORTS 4 | DllCanUnloadNow PRIVATE 5 | DllGetClassObject PRIVATE 6 | DllRegisterServer PRIVATE 7 | DllUnregisterServer PRIVATE 8 | DllInstall PRIVATE 9 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/COMProvider.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: ComProvider.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-04 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __COMPROVIDER_H_97EB4DBA_A79D_4DC8_AC54_C87893D91E88_INCLUDED__ 16 | #define __COMPROVIDER_H_97EB4DBA_A79D_4DC8_AC54_C87893D91E88_INCLUDED__ 17 | 18 | #include 19 | 20 | extern HMODULE g_hModule; 21 | extern LONG g_nModuleCount; 22 | 23 | 24 | #endif // #ifndef __COMPROVIDER_H_97EB4DBA_A79D_4DC8_AC54_C87893D91E88_INCLUDED__ 25 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/COMProvider.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 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | 46 | 47 | Source Files 48 | 49 | 50 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/ClassFactory.cpp: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: ClassFactory.cpp 6 | // Author: Streamlet 7 | // Create Time: 2012-09-06 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | 16 | #include "ClassFactory.h" 17 | #include "SampleClass.h" 18 | 19 | ClassFactory::ClassFactory(REFCLSID rclsid) 20 | { 21 | m_clsid = rclsid; 22 | } 23 | 24 | ClassFactory::~ClassFactory() 25 | { 26 | 27 | } 28 | 29 | STDMETHODIMP ClassFactory::CreateInstance(_In_opt_ IUnknown *pUnkOuter, 30 | _In_ REFIID riid, 31 | _COM_Outptr_ void **ppvObject) 32 | { 33 | if (riid == __uuidof(ISampleInterface) && m_clsid == __uuidof(SampleClass)) 34 | { 35 | ISampleInterface *p = new SampleClass; 36 | p->QueryInterface(riid, ppvObject); 37 | 38 | return S_OK; 39 | } 40 | 41 | return CLASS_E_CLASSNOTAVAILABLE; 42 | } 43 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/ClassFactory.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: ClassFactory.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-06 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __CLASSFACTORY_H_9DB2DE69_0493_4A97_9337_A9ABDAEE0849_INCLUDED__ 16 | #define __CLASSFACTORY_H_9DB2DE69_0493_4A97_9337_A9ABDAEE0849_INCLUDED__ 17 | 18 | 19 | #include "../xl/Win32/COM/InterfaceHelper/xlIClassFactoryImpl.h" 20 | #include "../xl/Win32/COM/xlComClass.h" 21 | #include "SampleClass.h" 22 | 23 | class ClassFactory : public xl::ComClass, 24 | public xl::IClassFactoryImpl<> 25 | { 26 | public: 27 | ClassFactory(REFCLSID rclsid); 28 | ~ClassFactory(); 29 | 30 | public: 31 | STDMETHOD(CreateInstance)(_In_opt_ IUnknown *pUnkOuter, 32 | _In_ REFIID riid, 33 | _COM_Outptr_ void **ppvObject); 34 | 35 | public: 36 | XL_COM_INTERFACE_BEGIN(ClassFactory) 37 | XL_COM_INTERFACE(IClassFactory) 38 | XL_COM_INTERFACE_END() 39 | 40 | private: 41 | CLSID m_clsid; 42 | }; 43 | 44 | 45 | #endif // #ifndef __CLASSFACTORY_H_9DB2DE69_0493_4A97_9337_A9ABDAEE0849_INCLUDED__ 46 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/DLLMain.cpp: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: DLLMain.cpp 6 | // Author: Streamlet 7 | // Create Time: 2012-09-04 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | 16 | #include 17 | 18 | HMODULE g_hModule = nullptr; 19 | 20 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) 21 | { 22 | switch (ul_reason_for_call) 23 | { 24 | case DLL_PROCESS_ATTACH: 25 | g_hModule = hModule; 26 | break; 27 | case DLL_THREAD_ATTACH: 28 | break; 29 | case DLL_THREAD_DETACH: 30 | break; 31 | case DLL_PROCESS_DETACH: 32 | break; 33 | default: 34 | break; 35 | } 36 | 37 | return TRUE; 38 | } 39 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/Interface.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: Interface.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-06 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __INTERFACE_H_F9F0BB86_D3F9_4C0A_91AE_E8A0C46675B9_INCLUDED__ 16 | #define __INTERFACE_H_F9F0BB86_D3F9_4C0A_91AE_E8A0C46675B9_INCLUDED__ 17 | 18 | 19 | #include 20 | 21 | struct __declspec(uuid("{83C783E3-F989-4E0D-BFC5-631273EDFFDA}")) 22 | ISampleInterface : public IUnknown 23 | { 24 | STDMETHOD(SampleMethod)() PURE; 25 | }; 26 | 27 | class __declspec(uuid("{0DECBFF5-A8A5-49E8-9962-3D18AAC6088E}")) 28 | SampleClass; 29 | 30 | 31 | #endif // #ifndef __INTERFACE_H_F9F0BB86_D3F9_4C0A_91AE_E8A0C46675B9_INCLUDED__ 32 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/SampClass.cpp: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: SampleClass.cpp 6 | // Author: Streamlet 7 | // Create Time: 2012-09-04 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | 16 | #include "SampleClass.h" 17 | #include 18 | 19 | SampleClass::SampleClass() 20 | { 21 | InterlockedIncrement(&g_nModuleCount); 22 | } 23 | 24 | SampleClass::~SampleClass() 25 | { 26 | InterlockedDecrement(&g_nModuleCount); 27 | } 28 | 29 | STDMETHODIMP SampleClass::SampleMethod() 30 | { 31 | int c; 32 | int a; 33 | int b; 34 | MessageBox(NULL, _T("Add SampleMethod called.\n"), _T("Begin"), MB_OK | MB_ICONINFORMATION); 35 | printf("a = "); 36 | scanf("%d", &a); 37 | printf("b = "); 38 | scanf("%d", &b); 39 | c = a + b; 40 | printf("c = a + b = %d", c); 41 | MessageBox(NULL, _T("Add SampleMethod finished.\n"), _T("End"), MB_OK | MB_ICONINFORMATION); 42 | return S_OK; 43 | } 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/SampleClass.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: SampleClass.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-06 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __SAMPLECLASS_H_4B81D513_4BB1_4FA8_8B09_192237846EAD_INCLUDED__ 16 | #define __SAMPLECLASS_H_4B81D513_4BB1_4FA8_8B09_192237846EAD_INCLUDED__ 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | #include "../xl/Win32/COM/xlComClass.h" 23 | #include "../xl/Win32/COM/InterfaceHelper/xlIUnknownImpl.h" 24 | #include "COMProvider.h" 25 | #include "Interface.h" 26 | 27 | class SampleClass : public xl::ComClass, 28 | public xl::IUnknownImpl 29 | { 30 | public: 31 | SampleClass(); 32 | ~SampleClass(); 33 | 34 | public: 35 | STDMETHOD(SampleMethod)(); 36 | 37 | public: 38 | XL_COM_INTERFACE_BEGIN(SampleClass) 39 | XL_COM_INTERFACE(ISampleInterface) 40 | XL_COM_INTERFACE_END() 41 | }; 42 | 43 | #endif // #ifndef __SAMPLECLASS_H_4B81D513_4BB1_4FA8_8B09_192237846EAD_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/xlComClass.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlComClass.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLCOMCLASS_H_EE07A885_D300_4CA6_81BE_DDFD9296BABE_INCLUDED__ 16 | #define __XLCOMCLASS_H_EE07A885_D300_4CA6_81BE_DDFD9296BABE_INCLUDED__ 17 | 18 | 19 | #include "../xlWin32Ver.h" 20 | #include "xlComDef.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class ComClass 27 | { 28 | public: 29 | ComClass(bool bAddObjRefCount = true) : m_nRefCount(0), m_bAddObjRefCount(bAddObjRefCount) 30 | { 31 | if (g_pComModule != nullptr && m_bAddObjRefCount) 32 | { 33 | g_pComModule->ObjectAddRef(); 34 | } 35 | } 36 | 37 | ~ComClass() 38 | { 39 | if (g_pComModule != nullptr && m_bAddObjRefCount) 40 | { 41 | g_pComModule->ObjectRelease(); 42 | } 43 | } 44 | 45 | public: 46 | STDMETHODIMP InternalQueryInterface(const InterfaceEntry *pEntries, REFIID riid, LPVOID *ppvObject) 47 | { 48 | *ppvObject = nullptr; 49 | T *pThis = (T *)this; 50 | 51 | IUnknown *pUnknown = (IUnknown *)((INT_PTR)pThis + pEntries->dwOffset); 52 | 53 | if (riid == __uuidof(IUnknown)) 54 | { 55 | *ppvObject = pUnknown; 56 | pUnknown->AddRef(); 57 | return S_OK; 58 | } 59 | 60 | for (const InterfaceEntry *pEntry = pEntries; pEntry->piid != nullptr; ++pEntry) 61 | { 62 | if (riid == *pEntry->piid) 63 | { 64 | *ppvObject = (IUnknown *)((INT_PTR)pThis + pEntry->dwOffset); 65 | pUnknown->AddRef(); 66 | return S_OK; 67 | } 68 | } 69 | 70 | return E_NOINTERFACE; 71 | } 72 | 73 | ULONG STDMETHODCALLTYPE InternalAddRef() 74 | { 75 | return (ULONG)InterlockedIncrement(&m_nRefCount); 76 | } 77 | 78 | ULONG STDMETHODCALLTYPE InternalRelease() 79 | { 80 | LONG nRefCount = InterlockedDecrement(&m_nRefCount); 81 | 82 | if (nRefCount <= 0) 83 | { 84 | delete (T *)this; 85 | } 86 | 87 | return (ULONG)nRefCount; 88 | } 89 | 90 | protected: 91 | LONG m_nRefCount; 92 | bool m_bAddObjRefCount; 93 | }; 94 | 95 | } // namespace xl 96 | 97 | 98 | #endif // #ifndef __XLCOMCLASS_H_EE07A885_D300_4CA6_81BE_DDFD9296BABE_INCLUDED__ 99 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMProvider/xlIUnknownImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIUnknownImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIUNKNOWNIMPL_H_02B7268E_6F8B_47E7_BF44_1EDB0C545C42_INCLUDED__ 16 | #define __XLIUNKNOWNIMPL_H_02B7268E_6F8B_47E7_BF44_1EDB0C545C42_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include 21 | #include 22 | 23 | namespace xl 24 | { 25 | 26 | template 27 | class IUnknownImpl : public T 28 | { 29 | public: 30 | IUnknownImpl() 31 | { 32 | 33 | } 34 | 35 | ~IUnknownImpl() 36 | { 37 | 38 | } 39 | }; 40 | 41 | } // namespace xl 42 | 43 | #endif // #ifndef __XLIUNKNOWNIMPL_H_02B7268E_6F8B_47E7_BF44_1EDB0C545C42_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMUser/COMUser.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 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/COMUser/Main.cpp: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: Main.cpp 6 | // Author: Streamlet 7 | // Create Time: 2012-09-04 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | 16 | #include 17 | #include 18 | #include 19 | #include "../COMProvider/Interface.h" 20 | 21 | using namespace std; 22 | 23 | 24 | int _tmain(int argc, TCHAR *argv[]) 25 | { 26 | HRESULT hr = CoInitialize(NULL); 27 | 28 | ISampleInterface *pSampleInterface = nullptr; 29 | hr = CoCreateInstance(__uuidof(SampleClass), 30 | nullptr, 31 | CLSCTX_INPROC_SERVER, 32 | __uuidof(ISampleInterface), 33 | (LPVOID *)&pSampleInterface); 34 | 35 | if (SUCCEEDED(hr)) 36 | { 37 | pSampleInterface->SampleMethod(); 38 | pSampleInterface->Release(); 39 | } 40 | 41 | CoUninitialize(); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Containers/xlPair.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlPair.h 6 | // Author: Streamlet 7 | // Create Time: 2009-11-07 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLPAIR_H_E7935E32_4626_4FB9_B582_4D3DA2D9CF69_INCLUDED__ 17 | #define __XLPAIR_H_E7935E32_4626_4FB9_B582_4D3DA2D9CF69_INCLUDED__ 18 | 19 | 20 | namespace xl 21 | { 22 | template 23 | class Pair 24 | { 25 | public: 26 | K Key; 27 | V Value; 28 | 29 | public: 30 | Pair(); 31 | Pair(const K &key); 32 | Pair(const K &key, const V &value); 33 | Pair(const Pair &that); 34 | Pair &operator = (const Pair &that); 35 | 36 | public: 37 | bool operator == (const Pair &that) const; 38 | bool operator != (const Pair &that) const; 39 | bool operator < (const Pair &that) const; 40 | bool operator > (const Pair &that) const; 41 | bool operator <= (const Pair &that) const; 42 | bool operator >= (const Pair &that) const; 43 | }; 44 | 45 | template 46 | Pair::Pair() 47 | { 48 | 49 | } 50 | 51 | template 52 | Pair::Pair(const K &key) 53 | : Key(key) 54 | { 55 | 56 | } 57 | 58 | template 59 | Pair::Pair(const K &key, const V &value) 60 | : Key(key), Value(value) 61 | { 62 | 63 | } 64 | 65 | template 66 | Pair::Pair(const Pair &that) 67 | : Key(that.Key), Value(that.Value) 68 | { 69 | 70 | } 71 | 72 | template 73 | Pair &Pair::operator = (const Pair &that) 74 | { 75 | if (this != &that) 76 | { 77 | this->Key = that.Key; 78 | this->Value = that.Value; 79 | } 80 | 81 | return *this; 82 | } 83 | 84 | template 85 | bool Pair::operator == (const Pair &that) const 86 | { 87 | return this->Key == that.Key; 88 | } 89 | 90 | template 91 | bool Pair::operator != (const Pair &that) const 92 | { 93 | return this->Key != that.Key; 94 | } 95 | 96 | template 97 | bool Pair::operator < (const Pair &that) const 98 | { 99 | return this->Key < that.Key; 100 | } 101 | 102 | template 103 | bool Pair::operator > (const Pair &that) const 104 | { 105 | return this->Key > that.Key; 106 | } 107 | 108 | template 109 | bool Pair::operator <= (const Pair &that) const 110 | { 111 | return this->Key <= that.Key; 112 | } 113 | 114 | template 115 | bool Pair::operator >= (const Pair &that) const 116 | { 117 | return this->Key >= that.Key; 118 | } 119 | 120 | } // namespace xl 121 | 122 | // 123 | // For convenience of debugging, put the following code to the [AutoExpand] section of 124 | // X:\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\autoexp.dat 125 | // 126 | // ;------------------------------------------------------------------------------ 127 | // ; xl::Pair 128 | // ;------------------------------------------------------------------------------ 129 | // xl::Pair<*>{ 130 | // preview ( 131 | // #( 132 | // $e.Key, 133 | // "->", 134 | // $e.Value 135 | // ) 136 | // ) 137 | // } 138 | // 139 | 140 | #endif // #ifndef __XLPAIR_H_E7935E32_4626_4FB9_B582_4D3DA2D9CF69_INCLUDED__ 141 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Math/xlMathBase.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlMathBase.h 6 | // Author: Streamlet 7 | // Create Time: 2012-06-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLMATHBASE_H_C306B62C_2117_45D0_A98E_11BE64AFC603_INCLUDED__ 17 | #define __XLMATHBASE_H_C306B62C_2117_45D0_A98E_11BE64AFC603_INCLUDED__ 18 | 19 | 20 | namespace xl 21 | { 22 | template 23 | auto Min(T t, U u) -> decltype(t <= u ? t : u) 24 | { 25 | return (t <= u ? t : u); 26 | } 27 | 28 | template 29 | auto Max(T t, U u) -> decltype(t >= u ? t : u) 30 | { 31 | return (t >= u ? t : u); 32 | } 33 | 34 | } // namespace xl 35 | 36 | #endif // #ifndef __XLMATHBASE_H_C306B62C_2117_45D0_A98E_11BE64AFC603_INCLUDED__ 37 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Meta/xlAssert.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlAssert.h 6 | // Author: Streamlet 7 | // Create Time: 2011-04-24 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLASSERT_H_BABCC0B2_7AD9_4F55_99F2_5DBB6EAD1F4D_INCLUDED__ 17 | #define __XLASSERT_H_BABCC0B2_7AD9_4F55_99F2_5DBB6EAD1F4D_INCLUDED__ 18 | 19 | 20 | namespace xl 21 | { 22 | 23 | #ifdef _DEBUG 24 | #define XL_ASSERT(expr) \ 25 | \ 26 | do \ 27 | { \ 28 | if (!(expr)) \ 29 | { \ 30 | throw "Assert fails."; \ 31 | } \ 32 | \ 33 | } while (false) 34 | #else 35 | #define XL_ASSERT(expr) 36 | #endif 37 | 38 | } // namespace xl 39 | 40 | #endif // #ifndef __XLASSERT_H_BABCC0B2_7AD9_4F55_99F2_5DBB6EAD1F4D_INCLUDED__ 41 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Meta/xlMetaBase.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlMetaBase.h 6 | // Author: Streamlet 7 | // Create Time: 2011-01-17 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLMETABASE_H_5432C693_BF0D_45B0_BB18_FA38C6913B74_INCLUDED__ 17 | #define __XLMETABASE_H_5432C693_BF0D_45B0_BB18_FA38C6913B74_INCLUDED__ 18 | 19 | 20 | namespace xl 21 | { 22 | struct NullType; 23 | 24 | struct EmptyType 25 | { 26 | 27 | }; 28 | 29 | } // namespace xl 30 | 31 | #endif // #ifndef __XLMETABASE_H_5432C693_BF0D_45B0_BB18_FA38C6913B74_INCLUDED__ 32 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Meta/xlScopeExit.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlScopeExit.h 6 | // Author: Streamlet 7 | // Create Time: 2012-04-22 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLSCOPEEXIT_H_8093BA2C_C4CA_4DB4_99C6_BAA42C6380F0_INCLUDED__ 17 | #define __XLSCOPEEXIT_H_8093BA2C_C4CA_4DB4_99C6_BAA42C6380F0_INCLUDED__ 18 | 19 | 20 | #include "../Meta/xlBind.h" 21 | #include "../Meta/xlMacros.h" 22 | 23 | namespace xl 24 | { 25 | class ScopeGuardImplBase 26 | { 27 | public: 28 | ScopeGuardImplBase() : m_bDismissed(false) 29 | { 30 | 31 | } 32 | 33 | ScopeGuardImplBase(ScopeGuardImplBase &that) : 34 | m_bDismissed(that.m_bDismissed) 35 | { 36 | that.Dismiss(); 37 | } 38 | 39 | ~ScopeGuardImplBase() 40 | { 41 | 42 | } 43 | 44 | protected: 45 | template 46 | static void StaticExecute(J &j) 47 | { 48 | if (!j.m_bDismissed) 49 | { 50 | j.Execute(); 51 | } 52 | } 53 | 54 | public: 55 | void Dismiss() const 56 | { 57 | m_bDismissed = true; 58 | } 59 | 60 | private: 61 | mutable bool m_bDismissed; 62 | }; 63 | 64 | typedef const ScopeGuardImplBase& ScopeGuard; 65 | 66 | template 67 | class ScopeGuardImpl : public ScopeGuardImplBase 68 | { 69 | public: 70 | ScopeGuardImpl(F fn) : 71 | ScopeGuardImplBase(), m_fn(fn) 72 | { 73 | 74 | } 75 | 76 | ~ScopeGuardImpl() 77 | { 78 | StaticExecute(*this); 79 | } 80 | 81 | void Execute() 82 | { 83 | m_fn(); 84 | } 85 | 86 | private: 87 | F m_fn; 88 | }; 89 | 90 | template 91 | inline ScopeGuardImpl MakeGuard(F f) 92 | { 93 | return ScopeGuardImpl(f); 94 | } 95 | 96 | #define XL_ON_BLOCK_EXIT(...) ::xl::ScopeGuard XL_CONN(sg, __LINE__) = ::xl::MakeGuard(::xl::Bind(__VA_ARGS__)) 97 | 98 | } // namespace xl 99 | 100 | #endif // #ifndef __XLSCOPEEXIT_H_8093BA2C_C4CA_4DB4_99C6_BAA42C6380F0_INCLUDED__ 101 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Meta/xlStaticAssert.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlStaticAssert.h 6 | // Author: Streamlet 7 | // Create Time: 2011-04-24 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLSTATICASSERT_H_8D45F3AE_6AA7_436B_AB6A_2C4D7A442220_INCLUDED__ 17 | #define __XLSTATICASSERT_H_8D45F3AE_6AA7_436B_AB6A_2C4D7A442220_INCLUDED__ 18 | 19 | 20 | #include "../Meta/xlMacros.h" 21 | 22 | namespace xl 23 | { 24 | template 25 | struct StaticAssert; 26 | 27 | template <> 28 | struct StaticAssert 29 | { 30 | 31 | }; 32 | 33 | template 34 | struct StaticAssertTest 35 | { 36 | 37 | }; 38 | 39 | #define XL_STATIC_ASSERT(expr) typedef xl::StaticAssertTest)> XL_CONN(StaticAssert_, __COUNTER__) 40 | 41 | #if (!defined(_MSC_VER) || _MSC_VER < 1600) 42 | #define static_assert(expr, msg) XL_STATIC_ASSERT(expr) 43 | #endif 44 | 45 | } // namespace xl 46 | 47 | 48 | 49 | #endif // #ifndef __XLSTATICASSERT_H_8D45F3AE_6AA7_436B_AB6A_2C4D7A442220_INCLUDED__ 50 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Meta/xlUtility.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlUtility.h 6 | // Author: Streamlet 7 | // Create Time: 2011-05-08 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLUTILITY_H_03E2673E_60F5_4875_BC62_73D1FAA5E5E2_INCLUDED__ 17 | #define __XLUTILITY_H_03E2673E_60F5_4875_BC62_73D1FAA5E5E2_INCLUDED__ 18 | 19 | 20 | namespace xl 21 | { 22 | class NonInstantiable 23 | { 24 | private: 25 | NonInstantiable(); 26 | }; 27 | 28 | class NonCopyable 29 | { 30 | public: 31 | NonCopyable() 32 | { 33 | 34 | } 35 | 36 | ~NonCopyable() 37 | { 38 | 39 | } 40 | 41 | private: 42 | NonCopyable(const NonCopyable &); 43 | NonCopyable &operator = (const NonCopyable &); 44 | }; 45 | 46 | } // namespace xl 47 | 48 | #endif // #ifndef __XLUTILITY_H_03E2673E_60F5_4875_BC62_73D1FAA5E5E2_INCLUDED__ 49 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Parser/xlRegExp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-Alibaba/COM-Example/4076eb1de53b9c29985292317f5090d9e13bc714/Use-Third-Party-Lib/xl/Parser/xlRegExp.h -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Test/xlUnitTest.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: UnitTestFrame.h 6 | // Author: Streamlet 7 | // Create Time: 2010-08-08 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __UNITTESTFRAME_H_D6074214_D6DB_4590_9EF3_B25B76DB713D_INCLUDED__ 17 | #define __UNITTESTFRAME_H_D6074214_D6DB_4590_9EF3_B25B76DB713D_INCLUDED__ 18 | 19 | 20 | #include "../Meta/xlAssert.h" 21 | #include "../Meta/xlMacros.h" 22 | 23 | namespace xl 24 | { 25 | #define XL_TEST_CLASS_NAME(name) XL_CONN(xlTestCase, name) 26 | #define XL_TEST_CLASS_INSTANCE_NAME(name) XL_CONN(XL_TEST_CLASS_NAME(name), name) 27 | 28 | #define XL_NAMED_TEST_CASE(name) \ 29 | \ 30 | class XL_TEST_CLASS_NAME(name) \ 31 | { \ 32 | public: \ 33 | XL_TEST_CLASS_NAME(name)(); \ 34 | \ 35 | } XL_TEST_CLASS_INSTANCE_NAME(name); \ 36 | \ 37 | XL_TEST_CLASS_NAME(name)::XL_TEST_CLASS_NAME(name)() 38 | 39 | #define XL_TEST_CASE() XL_NAMED_TEST_CASE(__LINE__) 40 | 41 | #define XL_TEST_ASSERT(expr) XL_ASSERT(expr) 42 | 43 | } // namespace xl 44 | 45 | #endif // #ifndef __UNITTESTFRAME_H_D6074214_D6DB_4590_9EF3_B25B76DB713D_INCLUDED__ 46 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlDWebBrowserEvents2Impl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlDWebBrowserEvents2Impl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLDWEBBROWSEREVENTS2IMPL_H_EA31A245_A931_42E6_9D29_E0C24E2B1ADC_INCLUDED__ 16 | #define __XLDWEBBROWSEREVENTS2IMPL_H_EA31A245_A931_42E6_9D29_E0C24E2B1ADC_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIDispatchImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class DWebBrowserEvents2Impl : public IDispatchImpl 27 | { 28 | 29 | }; 30 | 31 | } // namespace xl 32 | 33 | 34 | #endif // #ifndef __XLDWEBBROWSEREVENTS2IMPL_H_EA31A245_A931_42E6_9D29_E0C24E2B1ADC_INCLUDED__ 35 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlDWebBrowserEventsImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlDWebBrowserEventsImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLDWEBBROWSEREVENTSIMPL_H_E85FD4F8_60BC_4BF1_BE7A_841897301F0C_INCLUDED__ 16 | #define __XLDWEBBROWSEREVENTSIMPL_H_E85FD4F8_60BC_4BF1_BE7A_841897301F0C_INCLUDED__ 17 | 18 | 19 | namespace xl 20 | { 21 | 22 | } // namespace xl 23 | 24 | 25 | #endif // #ifndef __XLDWEBBROWSEREVENTSIMPL_H_E85FD4F8_60BC_4BF1_BE7A_841897301F0C_INCLUDED__ 26 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIClassFactoryImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIClassFactoryImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-05 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLICLASSFACTORYIMPL_H_04EDB751_8B92_43E3_A97B_AF1D75D51C05_INCLUDED__ 16 | #define __XLICLASSFACTORYIMPL_H_04EDB751_8B92_43E3_A97B_AF1D75D51C05_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | 22 | namespace xl 23 | { 24 | template 25 | class IClassFactoryImpl : public IUnknownImpl 26 | { 27 | public: 28 | STDMETHOD(CreateInstance)(IUnknown *pUnkOuter, 29 | REFIID riid, 30 | void **ppvObject) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHOD(LockServer)(BOOL fLock) 36 | { 37 | return E_NOTIMPL; 38 | } 39 | }; 40 | 41 | } // namespace xl 42 | 43 | #endif // #ifndef __XLICLASSFACTORYIMPL_H_04EDB751_8B92_43E3_A97B_AF1D75D51C05_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIDispatchImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIDispatchImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIDISPATCHIMPL_H_7A443B6E_EA9F_486C_B4D3_771DB7560CF8_INCLUDED__ 16 | #define __XLIDISPATCHIMPL_H_7A443B6E_EA9F_486C_B4D3_771DB7560CF8_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IDispatchImpl : public IUnknownImpl 27 | { 28 | public: // IDispatch Methods 29 | STDMETHOD(GetTypeInfoCount)(UINT *pctinfo) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(Invoke)(DISPID dispIdMember, 45 | REFIID riid, 46 | LCID lcid, 47 | WORD wFlags, 48 | DISPPARAMS *pDispParams, 49 | VARIANT *pVarResult, 50 | EXCEPINFO *pExcepInfo, 51 | UINT *puArgErr) 52 | { 53 | return E_NOTIMPL; 54 | } 55 | }; 56 | 57 | } // namespace xl 58 | 59 | 60 | #endif // #ifndef __XLIDISPATCHIMPL_H_7A443B6E_EA9F_486C_B4D3_771DB7560CF8_INCLUDED__ 61 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIDocHostUIHandlerImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIDocHostUIHandlerImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIDOCHOSTUIHANDLERIMPL_H_2BC6BA59_38F5_435F_A863_FEC9D1C1CD6F_INCLUDED__ 16 | #define __XLIDOCHOSTUIHANDLERIMPL_H_2BC6BA59_38F5_435F_A863_FEC9D1C1CD6F_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IDocHostUIHandlerImpl : public IUnknownImpl 27 | { 28 | public: // IDocHostUIHandler Methods 29 | STDMETHOD(ShowContextMenu)(DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(GetHostInfo)(DOCHOSTUIINFO *pInfo) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(ShowUI)(DWORD dwID, 40 | IOleInPlaceActiveObject *pActiveObject, 41 | IOleCommandTarget *pCommandTarget, 42 | IOleInPlaceFrame *pFrame, 43 | IOleInPlaceUIWindow *pDoc) 44 | { 45 | return E_NOTIMPL; 46 | } 47 | 48 | STDMETHOD(HideUI)() 49 | { 50 | return E_NOTIMPL; 51 | } 52 | 53 | STDMETHOD(UpdateUI)() 54 | { 55 | return E_NOTIMPL; 56 | } 57 | 58 | STDMETHOD(EnableModeless)(BOOL fEnable) 59 | { 60 | return E_NOTIMPL; 61 | } 62 | 63 | STDMETHOD(OnDocWindowActivate)(BOOL fActivate) 64 | { 65 | return E_NOTIMPL; 66 | } 67 | 68 | STDMETHOD(OnFrameWindowActivate)(BOOL fActivate) 69 | { 70 | return E_NOTIMPL; 71 | } 72 | 73 | STDMETHOD(ResizeBorder)(LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow) 74 | { 75 | return E_NOTIMPL; 76 | } 77 | 78 | STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID) 79 | { 80 | return E_NOTIMPL; 81 | } 82 | 83 | STDMETHOD(GetOptionKeyPath)(LPOLESTR *pchKey, DWORD dw) 84 | { 85 | return E_NOTIMPL; 86 | } 87 | 88 | STDMETHOD(GetDropTarget)(IDropTarget *pDropTarget, IDropTarget **ppDropTarget) 89 | { 90 | return E_NOTIMPL; 91 | } 92 | 93 | STDMETHOD(GetExternal)(IDispatch **ppDispatch) 94 | { 95 | return E_NOTIMPL; 96 | } 97 | 98 | STDMETHOD(TranslateUrl)(DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut) 99 | { 100 | return E_NOTIMPL; 101 | } 102 | 103 | STDMETHOD(FilterDataObject)(IDataObject *pDO, IDataObject **ppDORet) 104 | { 105 | return E_NOTIMPL; 106 | } 107 | }; 108 | 109 | } // namespace xl 110 | 111 | 112 | #endif // #ifndef __XLIDOCHOSTUIHANDLERIMPL_H_2BC6BA59_38F5_435F_A863_FEC9D1C1CD6F_INCLUDED__ 113 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIObjectWithSiteImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIObjectWithSiteImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-12-02 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIOBJECTWITHSITEIMPL_H_11E45695_BD45_422C_9222_FE0892155057_INCLUDED__ 16 | #define __XLIOBJECTWITHSITEIMPL_H_11E45695_BD45_422C_9222_FE0892155057_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IObjectWithSiteImpl : public IUnknownImpl 27 | { 28 | public: 29 | STDMETHOD(SetSite)(IUnknown *pUnkSite) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(GetSite)(REFIID riid, void **ppvSite) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | }; 39 | 40 | } // namespace xl 41 | 42 | 43 | #endif // #ifndef __XLIOBJECTWITHSITEIMPL_H_11E45695_BD45_422C_9222_FE0892155057_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIOleClientSiteImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIOleClientSiteImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIOLECLIENTSITEIMPL_H_2922E78C_E51C_4F47_8D7E_D651BFB23749_INCLUDED__ 16 | #define __XLIOLECLIENTSITEIMPL_H_2922E78C_E51C_4F47_8D7E_D651BFB23749_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IOleClientSiteImpl : public IUnknownImpl 27 | { 28 | public: // IOleClientSite Methods 29 | STDMETHOD(SaveObject)() 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(GetContainer)(IOleContainer **ppContainer) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(ShowObject)() 45 | { 46 | return E_NOTIMPL; 47 | } 48 | 49 | STDMETHOD(OnShowWindow)(BOOL fShow) 50 | { 51 | return E_NOTIMPL; 52 | } 53 | 54 | STDMETHOD(RequestNewObjectLayout)() 55 | { 56 | return E_NOTIMPL; 57 | } 58 | }; 59 | 60 | } // namespace xl 61 | 62 | 63 | #endif // #ifndef __XLIOLECLIENTSITEIMPL_H_2922E78C_E51C_4F47_8D7E_D651BFB23749_INCLUDED__ 64 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIOleInPlaceFrameImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIOleInPlaceFrameImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIOLEINPLACEFRAMEIMPL_H_2A1FC107_C15E_4C42_B807_69FF9E40419C_INCLUDED__ 16 | #define __XLIOLEINPLACEFRAMEIMPL_H_2A1FC107_C15E_4C42_B807_69FF9E40419C_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIOleInPlaceUIWindowImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IOleInPlaceFrameImpl : public IOleInPlaceUIWindowImpl 27 | { 28 | public: // IOleInPlaceFrame Methods 29 | STDMETHOD(InsertMenus)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(SetMenu)(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(RemoveMenus)(HMENU hmenuShared) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(SetStatusText)(LPCOLESTR pszStatusText) 45 | { 46 | return E_NOTIMPL; 47 | } 48 | 49 | STDMETHOD(EnableModeless)(BOOL fEnable) 50 | { 51 | return E_NOTIMPL; 52 | } 53 | 54 | STDMETHOD(TranslateAccelerator)(LPMSG lpmsg, WORD wID) 55 | { 56 | return E_NOTIMPL; 57 | } 58 | }; 59 | 60 | } // namespace xl 61 | 62 | #endif // #ifndef __XLIOLEINPLACEFRAMEIMPL_H_2A1FC107_C15E_4C42_B807_69FF9E40419C_INCLUDED__ 63 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIOleInPlaceSiteImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIOleInPlaceSiteImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIOLEINPLACESITEIMPL_H_3B8F8EF3_1F26_4BB1_8C31_AF9827AE5BFE_INCLUDED__ 16 | #define __XLIOLEINPLACESITEIMPL_H_3B8F8EF3_1F26_4BB1_8C31_AF9827AE5BFE_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIOleWindowImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IOleInPlaceSiteImpl : public IOleWindowImpl 27 | { 28 | public: // IOleInPlaceSite Methods 29 | STDMETHOD(CanInPlaceActivate)() 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(OnInPlaceActivate)() 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(OnUIActivate)() 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(GetWindowContext)(IOleInPlaceFrame **ppFrame, 45 | IOleInPlaceUIWindow **ppDoc, 46 | LPRECT lprcPosRect, 47 | LPRECT lprcClipRect, 48 | LPOLEINPLACEFRAMEINFO lpFrameInfo) 49 | { 50 | return E_NOTIMPL; 51 | } 52 | 53 | STDMETHOD(Scroll)(SIZE scrollExtant) 54 | { 55 | return E_NOTIMPL; 56 | } 57 | 58 | STDMETHOD(OnUIDeactivate)(BOOL fUndoable) 59 | { 60 | return E_NOTIMPL; 61 | } 62 | 63 | STDMETHOD(OnInPlaceDeactivate)() 64 | { 65 | return E_NOTIMPL; 66 | } 67 | 68 | STDMETHOD(DiscardUndoState)() 69 | { 70 | return E_NOTIMPL; 71 | } 72 | 73 | STDMETHOD(DeactivateAndUndo)() 74 | { 75 | return E_NOTIMPL; 76 | } 77 | 78 | STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect) 79 | { 80 | return E_NOTIMPL; 81 | } 82 | }; 83 | 84 | } // namespace xl 85 | 86 | #endif // #ifndef __XLIOLEINPLACESITEIMPL_H_3B8F8EF3_1F26_4BB1_8C31_AF9827AE5BFE_INCLUDED__ 87 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIOleInPlaceUIWindowImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIOleInPlaceUIWindowImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIOLEINPLACEUIWINDOWIMPL_H_9707BB77_FD58_471B_B7EE_0BCEAF30618D_INCLUDED__ 16 | #define __XLIOLEINPLACEUIWINDOWIMPL_H_9707BB77_FD58_471B_B7EE_0BCEAF30618D_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIOleWindowImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IOleInPlaceUIWindowImpl : public IOleWindowImpl 27 | { 28 | public: // IOleInPlaceUIWindow Methods 29 | STDMETHOD(GetBorder)(LPRECT lprectBorder) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(RequestBorderSpace)(LPCBORDERWIDTHS pborderwidths) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(SetBorderSpace)(LPCBORDERWIDTHS pborderwidths) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(SetActiveObject)(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName) 45 | { 46 | return E_NOTIMPL; 47 | } 48 | }; 49 | 50 | } // namespace xl 51 | 52 | #endif // #ifndef __XLIOLEINPLACEUIWINDOWIMPL_H_9707BB77_FD58_471B_B7EE_0BCEAF30618D_INCLUDED__ 53 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIOleObjectImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIOleObjectImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIOLEOBJECTIMPL_H_2BA5B8AA_904B_41C5_AFA8_23A51DEECC4E_INCLUDED__ 16 | #define __XLIOLEOBJECTIMPL_H_2BA5B8AA_904B_41C5_AFA8_23A51DEECC4E_INCLUDED__ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | namespace xl 23 | { 24 | template 25 | class IOleObjectImpl : public IOleObject, 26 | public IUnknownImpl 27 | { 28 | }; 29 | 30 | } // namespace xl 31 | 32 | 33 | #endif // #ifndef __XLIOLEOBJECTIMPL_H_2BA5B8AA_904B_41C5_AFA8_23A51DEECC4E_INCLUDED__ 34 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIOleWindowImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIOleObjectImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIOLEOBJECTIMPL_H_2BA5B8AA_904B_41C5_AFA8_23A51DEECC4E_INCLUDED__ 16 | #define __XLIOLEOBJECTIMPL_H_2BA5B8AA_904B_41C5_AFA8_23A51DEECC4E_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IOleWindowImpl : public IUnknownImpl 27 | { 28 | public: // IOleWindow Methods 29 | STDMETHOD(GetWindow)(HWND *phwnd) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | }; 39 | 40 | } // namespace xl 41 | 42 | 43 | #endif // #ifndef __XLIOLEOBJECTIMPL_H_2BA5B8AA_904B_41C5_AFA8_23A51DEECC4E_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfActiveLanguageProfileNotifySinkImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfActiveLanguageProfileNotifySinkImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFACTIVELANGUAGEPROFILENOTIFYSINKIMPL_H_EB9EF7CD_7C2B_4D18_8071_479348D16273_INCLUDED__ 16 | #define __XLITFACTIVELANGUAGEPROFILENOTIFYSINKIMPL_H_EB9EF7CD_7C2B_4D18_8071_479348D16273_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfActiveLanguageProfileNotifySinkImpl : public IUnknownImpl 28 | { 29 | public: // ITfActiveLanguageProfileNotifySink Methods 30 | STDMETHODIMP OnActivated(_In_ REFCLSID clsid, _In_ REFGUID guidProfile, _In_ BOOL isActivated) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | }; 35 | 36 | } // namespace xl 37 | 38 | 39 | #endif // #ifndef __XLITFACTIVELANGUAGEPROFILENOTIFYSINKIMPL_H_EB9EF7CD_7C2B_4D18_8071_479348D16273_INCLUDED__ 40 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfCompositionSinkImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfCompositionSinkImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFCOMPOSITIONSINKIMPL_H_D217E6E4_34F8_401F_95BA_FD716280536D_INCLUDED__ 16 | #define __XLITFCOMPOSITIONSINKIMPL_H_D217E6E4_34F8_401F_95BA_FD716280536D_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfCompositionSinkImpl : public IUnknownImpl 28 | { 29 | public: // ITfCompositionSink Methods 30 | STDMETHODIMP OnCompositionTerminated(TfEditCookie ecWrite, _In_ ITfComposition *pComposition) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | }; 35 | 36 | } // namespace xl 37 | 38 | 39 | #endif // #ifndef __XLITFCOMPOSITIONSINKIMPL_H_D217E6E4_34F8_401F_95BA_FD716280536D_INCLUDED__ 40 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfDisplayAttributeProviderImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfDisplayAttributeProviderImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFDISPLAYATTRIBUTEPROVIDERIMPL_H_A59B4B23_6587_4475_93EE_2F9736398252_INCLUDED__ 16 | #define __XLITFDISPLAYATTRIBUTEPROVIDERIMPL_H_A59B4B23_6587_4475_93EE_2F9736398252_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfDisplayAttributeProviderImpl : public IUnknownImpl 28 | { 29 | public: // ITfDisplayAttributeProvider Methods 30 | STDMETHODIMP EnumDisplayAttributeInfo(IEnumTfDisplayAttributeInfo **ppEnum) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP GetDisplayAttributeInfo(REFGUID guidInfo, ITfDisplayAttributeInfo **ppInfo) 36 | { 37 | return E_NOTIMPL; 38 | } 39 | }; 40 | 41 | } // namespace xl 42 | 43 | 44 | #endif // #ifndef __XLITFDISPLAYATTRIBUTEPROVIDERIMPL_H_A59B4B23_6587_4475_93EE_2F9736398252_INCLUDED__ 45 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfFnGetPreferredTouchKeyboardLayoutImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfFnGetPreferredTouchKeyboardLayoutImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFFNGETPREFERREDTOUCHKEYBOARDLAYOUTIMPL_H_A8C51C21_E0B9_4714_AB94_E2C7B47809F8_INCLUDED__ 16 | #define __XLITFFNGETPREFERREDTOUCHKEYBOARDLAYOUTIMPL_H_A8C51C21_E0B9_4714_AB94_E2C7B47809F8_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlITfFunctionImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfFnGetPreferredTouchKeyboardLayoutImpl : public ITfFunctionImpl 28 | { 29 | public: // ITfFnGetPreferredTouchKeyboardLayout Methods 30 | STDMETHODIMP GetLayout(TKBLayoutType *ptkblayoutType, WORD *pwPreferredLayoutId) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | }; 35 | 36 | } // namespace xl 37 | 38 | 39 | #endif // #ifndef __XLITFFNGETPREFERREDTOUCHKEYBOARDLAYOUTIMPL_H_A8C51C21_E0B9_4714_AB94_E2C7B47809F8_INCLUDED__ 40 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfFunctionImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfFnGetPreferredTouchKeyboardLayout.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFFNGETPREFERREDTOUCHKEYBOARDLAYOUT_H_AED6DB87_9E15_4E7A_BC5F_0B9D15CD6EC8_INCLUDED__ 16 | #define __XLITFFNGETPREFERREDTOUCHKEYBOARDLAYOUT_H_AED6DB87_9E15_4E7A_BC5F_0B9D15CD6EC8_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfFunctionImpl : public IUnknownImpl 28 | { 29 | public: // ITfFunction Methods 30 | STDMETHODIMP GetDisplayName(BSTR *pbstrDisplayName) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | }; 35 | 36 | } // namespace xl 37 | 38 | 39 | #endif // #ifndef __XLITFFNGETPREFERREDTOUCHKEYBOARDLAYOUT_H_AED6DB87_9E15_4E7A_BC5F_0B9D15CD6EC8_INCLUDED__ 40 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfFunctionProviderImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfFunctionProviderImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFFUNCTIONPROVIDERIMPL_H_4F4231A0_87DC_43C2_94FC_2DFF66CB0EFA_INCLUDED__ 16 | #define __XLITFFUNCTIONPROVIDERIMPL_H_4F4231A0_87DC_43C2_94FC_2DFF66CB0EFA_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfFunctionProviderImpl : public IUnknownImpl 28 | { 29 | public: // ITfFunctionProvider Methods 30 | STDMETHODIMP GetType(GUID *pguid) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP GetDescription(BSTR *pbstrDesc) 36 | { 37 | return E_NOTIMPL; 38 | } 39 | 40 | STDMETHODIMP GetFunction(REFGUID rguid, REFIID riid, IUnknown **ppunk) 41 | { 42 | return E_NOTIMPL; 43 | } 44 | }; 45 | 46 | } // namespace xl 47 | 48 | 49 | #endif // #ifndef __XLITFFUNCTIONPROVIDERIMPL_H_4F4231A0_87DC_43C2_94FC_2DFF66CB0EFA_INCLUDED__ 50 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfKeyEventSinkImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfKeyEventSinkImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFKEYEVENTSINKIMPL_H_E452CAC4_CCA8_4304_872A_F96529E6B926_INCLUDED__ 16 | #define __XLITFKEYEVENTSINKIMPL_H_E452CAC4_CCA8_4304_872A_F96529E6B926_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfKeyEventSinkImpl : public IUnknownImpl 28 | { 29 | public: // ITfKeyEventSink Methods 30 | STDMETHODIMP OnSetFocus(BOOL fForeground) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP OnTestKeyDown(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pIsEaten) 36 | { 37 | return E_NOTIMPL; 38 | } 39 | 40 | STDMETHODIMP OnKeyDown(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pIsEaten) 41 | { 42 | return E_NOTIMPL; 43 | } 44 | 45 | STDMETHODIMP OnTestKeyUp(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pIsEaten) 46 | { 47 | return E_NOTIMPL; 48 | } 49 | 50 | STDMETHODIMP OnKeyUp(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pIsEaten) 51 | { 52 | return E_NOTIMPL; 53 | } 54 | 55 | STDMETHODIMP OnPreservedKey(ITfContext *pContext, REFGUID rguid, BOOL *pIsEaten) 56 | { 57 | return E_NOTIMPL; 58 | } 59 | }; 60 | 61 | } // namespace xl 62 | 63 | 64 | #endif // #ifndef __XLITFKEYEVENTSINKIMPL_H_E452CAC4_CCA8_4304_872A_F96529E6B926_INCLUDED__ 65 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfLangBarItemButtonImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfLangBarItemButtonImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2015-02-24 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFLANGBARITEMBUTTONIMPL_H_511FC759_FA0A_4EBA_A28A_FFBD9344A008_INCLUDED__ 16 | #define __XLITFLANGBARITEMBUTTONIMPL_H_511FC759_FA0A_4EBA_A28A_FFBD9344A008_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlITfLangBarItemImpl.h" 21 | 22 | 23 | namespace xl 24 | { 25 | template 26 | class ITfLangBarItemButtonImpl : public ITfLangBarItemImpl 27 | { 28 | public: // ITfLangBarItemButton Methods 29 | STDMETHODIMP OnClick(TfLBIClick click, POINT pt, __RPC__in const RECT *prcArea) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHODIMP InitMenu(ITfMenu *pMenu) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHODIMP OnMenuSelect(UINT wID) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHODIMP GetIcon(HICON *phIcon) 45 | { 46 | return E_NOTIMPL; 47 | } 48 | 49 | STDMETHODIMP GetText(BSTR *pbstrText) 50 | { 51 | return E_NOTIMPL; 52 | } 53 | }; 54 | 55 | } // namespace xl 56 | 57 | #endif // #ifndef __XLITFLANGBARITEMBUTTONIMPL_H_511FC759_FA0A_4EBA_A28A_FFBD9344A008_INCLUDED__ 58 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfLangBarItemImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfLangBarItem.h 6 | // Author: Streamlet 7 | // Create Time: 2015-02-24 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFLANGBARITEM_H_B7ECDEF3_B73C_40E9_85F6_58D10368115F_INCLUDED__ 16 | #define __XLITFLANGBARITEM_H_B7ECDEF3_B73C_40E9_85F6_58D10368115F_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfLangBarItemImpl : public IUnknownImpl 28 | { 29 | public: // ITfLangBarItem Methods 30 | STDMETHODIMP GetInfo(TF_LANGBARITEMINFO *pInfo) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP GetStatus(DWORD *pdwStatus) 36 | { 37 | return E_NOTIMPL; 38 | } 39 | 40 | STDMETHODIMP Show(BOOL fShow) 41 | { 42 | return E_NOTIMPL; 43 | } 44 | 45 | STDMETHODIMP GetTooltipString(BSTR *pbstrToolTip) 46 | { 47 | return E_NOTIMPL; 48 | } 49 | }; 50 | 51 | } // namespace xl 52 | 53 | #endif // #ifndef __XLITFLANGBARITEM_H_B7ECDEF3_B73C_40E9_85F6_58D10368115F_INCLUDED__ 54 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfSourceImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfSourceImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2015-02-24 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFSOURCEIMPL_H_D0194DCB_B5EA_4E44_A5AD_A52F68D19A1D_INCLUDED__ 16 | #define __XLITFSOURCEIMPL_H_D0194DCB_B5EA_4E44_A5AD_A52F68D19A1D_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfSourceImpl : public IUnknownImpl 28 | { 29 | public: // ITfSource Methods 30 | STDMETHODIMP AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP UnadviseSink(DWORD dwCookie) 36 | { 37 | return E_NOTIMPL; 38 | } 39 | }; 40 | 41 | } // namespace xl 42 | 43 | #endif // #ifndef __XLITFSOURCEIMPL_H_D0194DCB_B5EA_4E44_A5AD_A52F68D19A1D_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfTextEditSinkImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfTextEditSinkImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2015-01-06 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFTEXTEDITSINKIMPL_H_9550B0F8_00ED_4203_9D30_B4B8A42510D0_INCLUDED__ 16 | #define __XLITFTEXTEDITSINKIMPL_H_9550B0F8_00ED_4203_9D30_B4B8A42510D0_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfTextEditSinkImpl : public IUnknownImpl 28 | { 29 | public: // ITfTextEditSink Methods 30 | STDMETHODIMP OnEndEdit(ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | }; 35 | 36 | } // namespace xl 37 | 38 | #endif // #ifndef __XLITFTEXTEDITSINKIMPL_H_9550B0F8_00ED_4203_9D30_B4B8A42510D0_INCLUDED__ 39 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfTextInputProcessorExImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfTextInputProcessorExImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFTEXTINPUTPROCESSOREXIMPL_H_91E181C4_A55D_43FE_88B8_8F93A4D62F6A_INCLUDED__ 16 | #define __XLITFTEXTINPUTPROCESSOREXIMPL_H_91E181C4_A55D_43FE_88B8_8F93A4D62F6A_INCLUDED__ 17 | 18 | 19 | #include "xlITfTextInputProcessorImpl.h" 20 | 21 | 22 | namespace xl 23 | { 24 | template 25 | class ITfTextInputProcessorExImpl : public ITfTextInputProcessorImpl 26 | { 27 | public: // ITfTextInputProcessorEx Methods 28 | STDMETHODIMP ActivateEx(ITfThreadMgr *ptim, TfClientId tid, DWORD dwFlags) 29 | { 30 | return E_NOTIMPL; 31 | } 32 | }; 33 | 34 | } // namespace xl 35 | 36 | 37 | #endif // #ifndef __XLITFTEXTINPUTPROCESSOREXIMPL_H_91E181C4_A55D_43FE_88B8_8F93A4D62F6A_INCLUDED__ 38 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfTextInputProcessorImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfTextInputProcessorImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFTEXTINPUTPROCESSORIMPL_H_57FEFBAA_A653_401C_9696_F62A9DA3DA2E_INCLUDED__ 16 | #define __XLITFTEXTINPUTPROCESSORIMPL_H_57FEFBAA_A653_401C_9696_F62A9DA3DA2E_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfTextInputProcessorImpl : public IUnknownImpl 28 | { 29 | public: // ITfTextInputProcessor Methods 30 | STDMETHODIMP Activate(ITfThreadMgr *ptim, TfClientId tid) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP Deactivate() 36 | { 37 | return E_NOTIMPL; 38 | } 39 | }; 40 | 41 | } // namespace xl 42 | 43 | #endif // #ifndef __XLITFTEXTINPUTPROCESSORIMPL_H_57FEFBAA_A653_401C_9696_F62A9DA3DA2E_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfThreadFocusSinkImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfThreadFocusSinkImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2014-12-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFTHREADFOCUSSINKIMPL_H_A703B446_4A44_4867_B1B2_BB54C969155B_INCLUDED__ 16 | #define __XLITFTHREADFOCUSSINKIMPL_H_A703B446_4A44_4867_B1B2_BB54C969155B_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfThreadFocusSinkImpl : public IUnknownImpl 28 | { 29 | public: // ITfThreadFocusSink Methods 30 | STDMETHODIMP OnSetThreadFocus() 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP OnKillThreadFocus() 36 | { 37 | return E_NOTIMPL; 38 | } 39 | }; 40 | 41 | } // namespace xl 42 | 43 | 44 | #endif // #ifndef __XLITFTHREADFOCUSSINKIMPL_H_A703B446_4A44_4867_B1B2_BB54C969155B_INCLUDED__ 45 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITfThreadMgrEventSinkImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITfThreadMgrEventSinkImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2015-01-06 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITFTHREADMGREVENTSINKIMPL_H_7345FEB4_6F04_49FA_8B02_96FD02309A02_INCLUDED__ 16 | #define __XLITFTHREADMGREVENTSINKIMPL_H_7345FEB4_6F04_49FA_8B02_96FD02309A02_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | 24 | namespace xl 25 | { 26 | template 27 | class ITfThreadMgrEventSinkImpl : public IUnknownImpl 28 | { 29 | public: // ITfThreadMgrEventSink Methods 30 | STDMETHODIMP OnInitDocumentMgr(ITfDocumentMgr *pdim) 31 | { 32 | return E_NOTIMPL; 33 | } 34 | 35 | STDMETHODIMP OnUninitDocumentMgr(ITfDocumentMgr *pdim) 36 | { 37 | return E_NOTIMPL; 38 | } 39 | 40 | STDMETHODIMP OnSetFocus(ITfDocumentMgr *pdimFocus, ITfDocumentMgr *pdimPrevFocus) 41 | { 42 | return E_NOTIMPL; 43 | } 44 | 45 | STDMETHODIMP OnPushContext(ITfContext *pic) 46 | { 47 | return E_NOTIMPL; 48 | } 49 | 50 | STDMETHODIMP OnPopContext(ITfContext *pic) 51 | { 52 | return E_NOTIMPL; 53 | } 54 | }; 55 | 56 | } // namespace xl 57 | 58 | #endif // #ifndef __XLITFTHREADMGREVENTSINKIMPL_H_7345FEB4_6F04_49FA_8B02_96FD02309A02_INCLUDED__ 59 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITypeCompImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITypeCompImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-07 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITYPECOMPIMPL_H_04D4952F_296C_4D54_9FEA_9E9D46F3A2A6_INCLUDED__ 16 | #define __XLITYPECOMPIMPL_H_04D4952F_296C_4D54_9FEA_9E9D46F3A2A6_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class ITypeCompImpl : public IUnknownImpl 27 | { 28 | public: // ITypeComp Methods 29 | STDMETHOD(Bind)(LPOLESTR szName, 30 | ULONG lHashVal, 31 | WORD wFlags, 32 | ITypeInfo **ppTInfo, 33 | DESCKIND *pDescKind, 34 | BINDPTR *pBindPtr) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(BindType)(LPOLESTR szName, 40 | ULONG lHashVal, 41 | ITypeInfo **ppTInfo, 42 | ITypeComp **ppTComp) 43 | { 44 | return E_NOTIMPL; 45 | } 46 | }; 47 | 48 | } // namespace xl 49 | 50 | #endif // #ifndef __XLITYPECOMPIMPL_H_04D4952F_296C_4D54_9FEA_9E9D46F3A2A6_INCLUDED__ 51 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlITypeLibImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlITypeInfoImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-07 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLITYPEINFOIMPL_H_BE0F75E0_E2D3_4D0E_AEFC_293D13F8DB08_INCLUDED__ 16 | #define __XLITYPEINFOIMPL_H_BE0F75E0_E2D3_4D0E_AEFC_293D13F8DB08_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIUnknownImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class ITypeLibImpl : public IUnknownImpl 27 | { 28 | public: // ITypeLib Methods 29 | STDMETHOD(GetTypeInfoCount)() 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(GetTypeInfo)(UINT index, ITypeInfo **ppTInfo) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(GetTypeInfoType)(UINT index, TYPEKIND *pTKind) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(GetTypeInfoOfGuid)(REFGUID guid, 45 | ITypeInfo **ppTinfo) 46 | { 47 | return E_NOTIMPL; 48 | } 49 | 50 | STDMETHOD(GetLibAttr)(TLIBATTR **ppTLibAttr) 51 | { 52 | return E_NOTIMPL; 53 | } 54 | 55 | STDMETHOD(GetTypeComp)(ITypeComp **ppTComp) 56 | { 57 | return E_NOTIMPL; 58 | } 59 | 60 | STDMETHOD(GetDocumentation)(INT index, 61 | BSTR *pBstrName, 62 | BSTR *pBstrDocString, 63 | DWORD *pdwHelpContext, 64 | BSTR *pBstrHelpFile) 65 | { 66 | return E_NOTIMPL; 67 | } 68 | 69 | STDMETHOD(IsName)(LPOLESTR szNameBuf, 70 | ULONG lHashVal, 71 | BOOL *pfName) 72 | { 73 | return E_NOTIMPL; 74 | } 75 | 76 | STDMETHOD(FindName)(LPOLESTR szNameBuf, 77 | ULONG lHashVal, 78 | ITypeInfo **ppTInfo, 79 | MEMBERID *rgMemId, 80 | USHORT *pcFound) 81 | { 82 | return E_NOTIMPL; 83 | } 84 | 85 | STDMETHOD(ReleaseTLibAttr)(TLIBATTR *pTLibAttr) 86 | { 87 | return E_NOTIMPL; 88 | } 89 | }; 90 | 91 | } // namespace xl 92 | 93 | #endif // #ifndef __XLITYPEINFOIMPL_H_BE0F75E0_E2D3_4D0E_AEFC_293D13F8DB08_INCLUDED__ 94 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIUnknownImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIUnknownImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIUNKNOWNIMPL_H_02B7268E_6F8B_47E7_BF44_1EDB0C545C42_INCLUDED__ 16 | #define __XLIUNKNOWNIMPL_H_02B7268E_6F8B_47E7_BF44_1EDB0C545C42_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include 21 | #include 22 | 23 | namespace xl 24 | { 25 | 26 | template 27 | class IUnknownImpl : public T 28 | { 29 | public: 30 | IUnknownImpl() 31 | { 32 | 33 | } 34 | 35 | ~IUnknownImpl() 36 | { 37 | 38 | } 39 | }; 40 | 41 | } // namespace xl 42 | 43 | #endif // #ifndef __XLIUNKNOWNIMPL_H_02B7268E_6F8B_47E7_BF44_1EDB0C545C42_INCLUDED__ 44 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIWMPCoreImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIWMPCoreImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIWMPCOREIMPL_H_DD8CA807_093F_4DD8_BD06_46191EA16371_INCLUDED__ 16 | #define __XLIWMPCOREIMPL_H_DD8CA807_093F_4DD8_BD06_46191EA16371_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIDispatchImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IWMPCoreImpl : public IDispatchImpl 27 | { 28 | public: 29 | STDMETHOD(close)() 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(get_URL)(BSTR *pbstrURL) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(put_URL)(BSTR bstrURL) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(get_openState)(WMPOpenState *pwmpos) 45 | { 46 | return E_NOTIMPL; 47 | } 48 | 49 | STDMETHOD(get_playState)(WMPPlayState *pwmpps) 50 | { 51 | return E_NOTIMPL; 52 | } 53 | 54 | STDMETHOD(get_controls)(IWMPControls **ppControl) 55 | { 56 | return E_NOTIMPL; 57 | } 58 | 59 | STDMETHOD(get_settings)(IWMPSettings **ppSettings) 60 | { 61 | return E_NOTIMPL; 62 | } 63 | 64 | STDMETHOD(get_currentMedia)(IWMPMedia **ppMedia) 65 | { 66 | return E_NOTIMPL; 67 | } 68 | 69 | STDMETHOD(put_currentMedia)(IWMPMedia *pMedia) 70 | { 71 | return E_NOTIMPL; 72 | } 73 | 74 | STDMETHOD(get_mediaCollection)(IWMPMediaCollection **ppMediaCollection) 75 | { 76 | return E_NOTIMPL; 77 | } 78 | 79 | STDMETHOD(get_playlistCollection)(IWMPPlaylistCollection **ppPlaylistCollection) 80 | { 81 | return E_NOTIMPL; 82 | } 83 | 84 | STDMETHOD(get_versionInfo)(BSTR *pbstrVersionInfo) 85 | { 86 | return E_NOTIMPL; 87 | } 88 | 89 | STDMETHOD(launchURL)(BSTR bstrURL) 90 | { 91 | return E_NOTIMPL; 92 | } 93 | 94 | STDMETHOD(get_network)(IWMPNetwork **ppQNI) 95 | { 96 | return E_NOTIMPL; 97 | } 98 | 99 | STDMETHOD(get_currentPlaylist)(IWMPPlaylist **ppPL) 100 | { 101 | return E_NOTIMPL; 102 | } 103 | 104 | STDMETHOD(put_currentPlaylist)(IWMPPlaylist *pPL) 105 | { 106 | return E_NOTIMPL; 107 | } 108 | 109 | STDMETHOD(get_cdromCollection)(IWMPCdromCollection **ppCdromCollection) 110 | { 111 | return E_NOTIMPL; 112 | } 113 | 114 | STDMETHOD(get_closedCaption)(IWMPClosedCaption **ppClosedCaption) 115 | { 116 | return E_NOTIMPL; 117 | } 118 | 119 | STDMETHOD(get_isOnline)(VARIANT_BOOL *pfOnline) 120 | { 121 | return E_NOTIMPL; 122 | } 123 | 124 | STDMETHOD(get_error)(IWMPError **ppError) 125 | { 126 | return E_NOTIMPL; 127 | } 128 | 129 | STDMETHOD(get_status)(BSTR *pbstrStatus) 130 | { 131 | return E_NOTIMPL; 132 | } 133 | }; 134 | 135 | } // namespace xl 136 | 137 | #endif // #ifndef __XLIWMPCOREIMPL_H_DD8CA807_093F_4DD8_BD06_46191EA16371_INCLUDED__ 138 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/InterfaceHelper/xlIWMPPlayerImpl.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlIWMPPlayerImpl.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLIWMPPLAYERIMPL_H_1346CAD0_4217_46CB_A45A_C7C6525000FF_INCLUDED__ 16 | #define __XLIWMPPLAYERIMPL_H_1346CAD0_4217_46CB_A45A_C7C6525000FF_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "xlIWMPCoreImpl.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class IWMPPlayerImpl : public IWMPCoreImpl 27 | { 28 | public: 29 | STDMETHOD(get_enabled)(VARIANT_BOOL *pbEnabled) 30 | { 31 | return E_NOTIMPL; 32 | } 33 | 34 | STDMETHOD(put_enabled)(VARIANT_BOOL bEnabled) 35 | { 36 | return E_NOTIMPL; 37 | } 38 | 39 | STDMETHOD(get_fullScreen)(VARIANT_BOOL *pbFullScreen) 40 | { 41 | return E_NOTIMPL; 42 | } 43 | 44 | STDMETHOD(put_fullScreen)(VARIANT_BOOL bFullScreen) 45 | { 46 | return E_NOTIMPL; 47 | } 48 | 49 | STDMETHOD(get_enableContextMenu)(VARIANT_BOOL *pbEnableContextMenu) 50 | { 51 | return E_NOTIMPL; 52 | } 53 | 54 | STDMETHOD(put_enableContextMenu)(VARIANT_BOOL bEnableContextMenu) 55 | { 56 | return E_NOTIMPL; 57 | } 58 | 59 | STDMETHOD(put_uiMode)(BSTR bstrMode) 60 | { 61 | return E_NOTIMPL; 62 | } 63 | 64 | STDMETHOD(get_uiMode)(BSTR *pbstrMode) 65 | { 66 | return E_NOTIMPL; 67 | } 68 | }; 69 | 70 | } // namespace xl 71 | 72 | #endif // #ifndef __XLIWMPPLAYERIMPL_H_1346CAD0_4217_46CB_A45A_C7C6525000FF_INCLUDED__ 73 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/Objects/xlMediaPlayer.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlMediaPlayer.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-01 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLMEDIAPLAYER_H_90C6295E_B667_44F2_98D6_BA0F435FECB0_INCLUDED__ 16 | #define __XLMEDIAPLAYER_H_90C6295E_B667_44F2_98D6_BA0F435FECB0_INCLUDED__ 17 | 18 | 19 | #include "../../xlWin32Ver.h" 20 | #include "../InterfaceHelper/xlIDispatchImpl.h" 21 | #include "xlOleContainer.h" 22 | #include 23 | 24 | namespace xl 25 | { 26 | class MediaPlayerImpl : public OleContainerImpl, 27 | public IDispatchImpl<> 28 | { 29 | public: 30 | MediaPlayerImpl() : m_pWMPPlayer(nullptr) 31 | { 32 | 33 | } 34 | 35 | ~MediaPlayerImpl() 36 | { 37 | DestroyMediaPlayer(); 38 | } 39 | 40 | public: 41 | bool CreateMediaPlayer(HWND hWnd, LPCRECT lpRect = nullptr) 42 | { 43 | DestroyMediaPlayer(); 44 | 45 | if (!CreateOleObject(__uuidof(WindowsMediaPlayer))) 46 | { 47 | return false; 48 | } 49 | 50 | if (!InPlaceActive(hWnd, lpRect)) 51 | { 52 | return false; 53 | } 54 | 55 | HRESULT hr = m_pOleObj->QueryInterface(__uuidof(IWMPPlayer), (LPVOID *)&m_pWMPPlayer); 56 | 57 | if (FAILED(hr)) 58 | { 59 | return false; 60 | } 61 | 62 | return true; 63 | } 64 | 65 | void DestroyMediaPlayer() 66 | { 67 | if (m_pWMPPlayer != NULL) 68 | { 69 | m_pWMPPlayer->Release(); 70 | m_pWMPPlayer = nullptr; 71 | } 72 | 73 | DestroyOleObject(); 74 | } 75 | 76 | protected: 77 | IWMPPlayer *m_pWMPPlayer; 78 | }; 79 | 80 | class MediaPlayer : public ComClass, 81 | public MediaPlayerImpl 82 | { 83 | public: 84 | MediaPlayer() 85 | { 86 | 87 | } 88 | 89 | ~MediaPlayer() 90 | { 91 | DestroyMediaPlayer(); 92 | } 93 | 94 | public: 95 | XL_COM_INTERFACE_BEGIN(MediaPlayer) 96 | XL_COM_INTERFACE(IOleClientSite) 97 | XL_COM_INTERFACE(IOleInPlaceSite) 98 | XL_COM_INTERFACE(IOleInPlaceFrame) 99 | XL_COM_INTERFACE(IDispatch) 100 | XL_COM_INTERFACE_END() 101 | }; 102 | 103 | } // namespace xl 104 | 105 | #endif // #ifndef __XLMEDIAPLAYER_H_90C6295E_B667_44F2_98D6_BA0F435FECB0_INCLUDED__ 106 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/xlClassFactory.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlClassFactory.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-09 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLCLASSFACTORY_H_30C5A972_4508_453D_AC45_B489268F1183_INCLUDED__ 16 | #define __XLCLASSFACTORY_H_30C5A972_4508_453D_AC45_B489268F1183_INCLUDED__ 17 | 18 | 19 | #include "xlComClass.h" 20 | #include "InterfaceHelper/xlIClassFactoryImpl.h" 21 | 22 | namespace xl 23 | { 24 | template 25 | class ClassFactory : public ComClass>, 26 | public IClassFactoryImpl<> 27 | { 28 | public: 29 | static IClassFactory *CreateFactory(bool bAddObjRefCount = true) 30 | { 31 | return new ClassFactory(bAddObjRefCount); 32 | } 33 | 34 | public: 35 | ClassFactory(bool bAddObjRefCount = true) : 36 | ComClass>(bAddObjRefCount) 37 | { 38 | 39 | } 40 | 41 | ~ClassFactory() 42 | { 43 | 44 | } 45 | 46 | public: 47 | STDMETHOD(CreateInstance)(IUnknown *pUnkOuter, 48 | REFIID riid, 49 | void **ppvObject) 50 | { 51 | T *p = new T; 52 | return p->QueryInterface(riid, ppvObject); 53 | } 54 | 55 | STDMETHOD(LockServer)(BOOL fLock) 56 | { 57 | if (g_pComModule == nullptr) 58 | { 59 | return E_NOTIMPL; 60 | } 61 | 62 | if (fLock) 63 | { 64 | g_pComModule->LockAddRef(); 65 | } 66 | else 67 | { 68 | g_pComModule->LockAddRef(); 69 | } 70 | 71 | return S_OK; 72 | } 73 | 74 | public: 75 | XL_COM_INTERFACE_BEGIN(ClassFactory) 76 | XL_COM_INTERFACE(IClassFactory) 77 | XL_COM_INTERFACE_END() 78 | }; 79 | 80 | } // namespace xl 81 | 82 | #endif // #ifndef __XLCLASSFACTORY_H_30C5A972_4508_453D_AC45_B489268F1183_INCLUDED__ 83 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/xlComClass.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlComClass.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLCOMCLASS_H_EE07A885_D300_4CA6_81BE_DDFD9296BABE_INCLUDED__ 16 | #define __XLCOMCLASS_H_EE07A885_D300_4CA6_81BE_DDFD9296BABE_INCLUDED__ 17 | 18 | 19 | #include "../xlWin32Ver.h" 20 | #include "xlComDef.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | template 26 | class ComClass 27 | { 28 | public: 29 | ComClass(bool bAddObjRefCount = true) : m_nRefCount(0), m_bAddObjRefCount(bAddObjRefCount) 30 | { 31 | if (g_pComModule != nullptr && m_bAddObjRefCount) 32 | { 33 | g_pComModule->ObjectAddRef(); 34 | } 35 | } 36 | 37 | ~ComClass() 38 | { 39 | if (g_pComModule != nullptr && m_bAddObjRefCount) 40 | { 41 | g_pComModule->ObjectRelease(); 42 | } 43 | } 44 | 45 | public: 46 | STDMETHODIMP InternalQueryInterface(const InterfaceEntry *pEntries, REFIID riid, LPVOID *ppvObject) 47 | { 48 | *ppvObject = nullptr; 49 | T *pThis = (T *)this; 50 | 51 | IUnknown *pUnknown = (IUnknown *)((INT_PTR)pThis + pEntries->dwOffset); 52 | 53 | if (riid == __uuidof(IUnknown)) 54 | { 55 | *ppvObject = pUnknown; 56 | pUnknown->AddRef(); 57 | return S_OK; 58 | } 59 | 60 | for (const InterfaceEntry *pEntry = pEntries; pEntry->piid != nullptr; ++pEntry) 61 | { 62 | if (riid == *pEntry->piid) 63 | { 64 | *ppvObject = (IUnknown *)((INT_PTR)pThis + pEntry->dwOffset); 65 | pUnknown->AddRef(); 66 | return S_OK; 67 | } 68 | } 69 | 70 | return E_NOINTERFACE; 71 | } 72 | 73 | ULONG STDMETHODCALLTYPE InternalAddRef() 74 | { 75 | return (ULONG)InterlockedIncrement(&m_nRefCount); 76 | } 77 | 78 | ULONG STDMETHODCALLTYPE InternalRelease() 79 | { 80 | LONG nRefCount = InterlockedDecrement(&m_nRefCount); 81 | 82 | if (nRefCount <= 0) 83 | { 84 | delete (T *)this; 85 | } 86 | 87 | return (ULONG)nRefCount; 88 | } 89 | 90 | protected: 91 | LONG m_nRefCount; 92 | bool m_bAddObjRefCount; 93 | }; 94 | 95 | } // namespace xl 96 | 97 | 98 | #endif // #ifndef __XLCOMCLASS_H_EE07A885_D300_4CA6_81BE_DDFD9296BABE_INCLUDED__ 99 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/xlComInclude.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlComInclude.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-16 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLCOMINCLUDE_H_E69B2947_244B_4D2B_8BB8_8DA405476903_INCLUDED__ 16 | #define __XLCOMINCLUDE_H_E69B2947_244B_4D2B_8BB8_8DA405476903_INCLUDED__ 17 | 18 | 19 | #include "xlComDef.h" 20 | #include "xlComClass.h" 21 | #include "xlClassFactory.h" 22 | #include "xlDispatcher.h" 23 | #include "xlComModule.h" 24 | #include "xlComLoader.h" 25 | 26 | #endif // #ifndef __XLCOMINCLUDE_H_E69B2947_244B_4D2B_8BB8_8DA405476903_INCLUDED__ 27 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/xlComPtr.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlComPtr.h 6 | // Author: Streamlet 7 | // Create Time: 2013-04-20 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLCOMPTR_H_E52D7EAE_DC76_4D71_8CB0_A22C1AAB5463_INCLUDED__ 16 | #define __XLCOMPTR_H_E52D7EAE_DC76_4D71_8CB0_A22C1AAB5463_INCLUDED__ 17 | 18 | 19 | #include "../xlWin32Ver.h" 20 | #include 21 | 22 | namespace xl 23 | { 24 | template 25 | class ComPtr 26 | { 27 | public: 28 | ComPtr() : 29 | m_pData(nullptr) 30 | { 31 | } 32 | 33 | ComPtr(T *pData) : 34 | m_pData(pData) 35 | { 36 | if (m_pData != nullptr) 37 | { 38 | AddRef(); 39 | } 40 | } 41 | 42 | ComPtr(const ComPtr &that) : 43 | m_pData(nullptr) 44 | { 45 | this->m_pData = that.m_pData; 46 | 47 | AddRef(); 48 | } 49 | 50 | ComPtr &operator=(const ComPtr &that) 51 | { 52 | if (this != &that && this->m_pData != that.m_pData) 53 | { 54 | Release(); 55 | 56 | this->m_pData = that.m_pData; 57 | 58 | if (m_pData != nullptr) 59 | { 60 | AddRef(); 61 | } 62 | } 63 | 64 | return *this; 65 | } 66 | 67 | ~ComPtr() 68 | { 69 | Release(); 70 | } 71 | 72 | public: 73 | bool operator==(const ComPtr &that) const 74 | { 75 | return this->m_pData == that.m_pData; 76 | } 77 | 78 | bool operator!=(const ComPtr &that) const 79 | { 80 | return this->m_pData != that.m_pData; 81 | } 82 | 83 | bool operator==(const T *pThat) const 84 | { 85 | return this->m_pData == pThat; 86 | } 87 | 88 | bool operator!=(const T *pThat) const 89 | { 90 | return this->m_pData != pThat; 91 | } 92 | 93 | public: 94 | T &operator*() const 95 | { 96 | return *this->m_pData; 97 | } 98 | 99 | T *operator->() const 100 | { 101 | return this->m_pData; 102 | } 103 | 104 | const T &operator[](int i) const 105 | { 106 | return this->m_pData[i]; 107 | } 108 | 109 | T &operator[](int i) 110 | { 111 | return this->m_pData[i]; 112 | } 113 | 114 | public: 115 | operator T * () const 116 | { 117 | return this->m_pData; 118 | } 119 | 120 | private: 121 | void AddRef() 122 | { 123 | if (m_pData != nullptr) 124 | { 125 | m_pData->AddRef(); 126 | } 127 | } 128 | 129 | void Release() 130 | { 131 | if (m_pData != nullptr) 132 | { 133 | m_pData->Release(); 134 | } 135 | } 136 | 137 | private: 138 | T *m_pData; 139 | }; 140 | 141 | } // namespace xl 142 | 143 | #endif // #ifndef __XLCOMPTR_H_E52D7EAE_DC76_4D71_8CB0_A22C1AAB5463_INCLUDED__ 144 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/COM/xlDispatcher.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlDispatcher.h 6 | // Author: Streamlet 7 | // Create Time: 2012-09-10 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLDISPATCHER_H_E1D7EF30_0567_480C_A31C_C0463DD8EC33_INCLUDED__ 16 | #define __XLDISPATCHER_H_E1D7EF30_0567_480C_A31C_C0463DD8EC33_INCLUDED__ 17 | 18 | 19 | #include "../xlWin32Ver.h" 20 | #include "xlComDef.h" 21 | #include "InterfaceHelper/xlIDispatchImpl.h" 22 | #include 23 | #include 24 | 25 | namespace xl 26 | { 27 | template 28 | class Dispatcher : public IDispatchImpl 29 | { 30 | public: 31 | Dispatcher() : m_pTypeInfo(nullptr) 32 | { 33 | if (g_pComModule != nullptr) 34 | { 35 | g_pComModule->GetTypeInfo(__uuidof(T), &m_pTypeInfo); 36 | } 37 | } 38 | 39 | ~Dispatcher() 40 | { 41 | if (m_pTypeInfo != nullptr) 42 | { 43 | m_pTypeInfo->Release(); 44 | m_pTypeInfo = nullptr; 45 | } 46 | 47 | } 48 | 49 | public: // IDispatch Methods 50 | STDMETHOD(GetTypeInfoCount)(UINT *pctinfo) 51 | { 52 | if (g_pComModule == nullptr) 53 | { 54 | return E_NOTIMPL; 55 | } 56 | 57 | if (pctinfo == nullptr) 58 | { 59 | return E_INVALIDARG; 60 | } 61 | 62 | *pctinfo = 1; 63 | return S_OK; 64 | } 65 | 66 | STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) 67 | { 68 | if (g_pComModule == nullptr) 69 | { 70 | return E_NOTIMPL; 71 | } 72 | 73 | if (iTInfo != 0) 74 | { 75 | return DISP_E_BADINDEX; 76 | } 77 | 78 | if (m_pTypeInfo == nullptr) 79 | { 80 | return E_FAIL; 81 | } 82 | 83 | *ppTInfo = m_pTypeInfo; 84 | (*ppTInfo)->AddRef(); 85 | 86 | return S_OK; 87 | } 88 | 89 | STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 90 | { 91 | if (g_pComModule == nullptr) 92 | { 93 | return E_NOTIMPL; 94 | } 95 | 96 | if (riid != IID_NULL) 97 | { 98 | return E_INVALIDARG; 99 | } 100 | 101 | if (m_pTypeInfo == nullptr) 102 | { 103 | return E_FAIL; 104 | } 105 | 106 | return DispGetIDsOfNames(m_pTypeInfo, rgszNames, cNames, rgDispId); 107 | } 108 | 109 | STDMETHOD(Invoke)(DISPID dispIdMember, 110 | REFIID riid, 111 | LCID lcid, 112 | WORD wFlags, 113 | DISPPARAMS *pDispParams, 114 | VARIANT *pVarResult, 115 | EXCEPINFO *pExcepInfo, 116 | UINT *puArgErr) 117 | { 118 | if (g_pComModule == nullptr) 119 | { 120 | return E_NOTIMPL; 121 | } 122 | 123 | if (riid != IID_NULL) 124 | { 125 | return E_INVALIDARG; 126 | } 127 | 128 | if (m_pTypeInfo == nullptr) 129 | { 130 | return E_FAIL; 131 | } 132 | 133 | return DispInvoke(this, m_pTypeInfo, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 134 | } 135 | 136 | private: 137 | ITypeInfo *m_pTypeInfo; 138 | }; 139 | 140 | } // namespace xl 141 | 142 | #endif // #ifndef __XLDISPATCHER_H_E1D7EF30_0567_480C_A31C_C0463DD8EC33_INCLUDED__ 143 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/GUI/xlCommCtrlInitializer.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlCommCtrlInitializer.h 6 | // Author: Streamlet 7 | // Create Time: 2011-03-04 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLCOMMCTRLINITIALIZER_H_D4ADA173_6B10_43C9_A817_E1BB6F16BC5F_INCLUDED__ 17 | #define __XLCOMMCTRLINITIALIZER_H_D4ADA173_6B10_43C9_A817_E1BB6F16BC5F_INCLUDED__ 18 | 19 | 20 | #include "../../Meta/xlUtility.h" 21 | #include "../xlWin32Ver.h" 22 | #include 23 | #include 24 | #pragma comment(lib, "Comctl32.lib") 25 | 26 | namespace xl 27 | { 28 | class CommCtrlInitializer : public NonCopyable 29 | { 30 | public: 31 | CommCtrlInitializer() 32 | { 33 | INITCOMMONCONTROLSEX iccx = { sizeof(INITCOMMONCONTROLSEX), 0xffffffff }; 34 | InitCommonControlsEx(&iccx); 35 | } 36 | 37 | ~CommCtrlInitializer() 38 | { 39 | 40 | } 41 | }; 42 | 43 | } // namespace xl 44 | 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_IA64 48 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") 49 | #elif defined _M_X64 50 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 51 | #else 52 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 53 | #endif 54 | 55 | #endif // #ifndef __XLCOMMCTRLINITIALIZER_H_D4ADA173_6B10_43C9_A817_E1BB6F16BC5F_INCLUDED__ 56 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/GUI/xlMenuBase.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlMenuBase.h 6 | // Author: Streamlet 7 | // Create Time: 2011-05-08 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLMENUBASE_H_C208C619_17E7_4147_BBFD_C815FAFA7324_INCLUDED__ 17 | #define __XLMENUBASE_H_C208C619_17E7_4147_BBFD_C815FAFA7324_INCLUDED__ 18 | 19 | 20 | #include "../..//Meta/xlUtility.h" 21 | #include "../xlWin32Ver.h" 22 | #include 23 | 24 | namespace xl 25 | { 26 | class MenuBase : public NonCopyable 27 | { 28 | public: 29 | MenuBase() : 30 | m_hMenu(nullptr) 31 | { 32 | 33 | } 34 | 35 | MenuBase(HMENU hMenu) : 36 | m_hMenu(nullptr) 37 | { 38 | Attach(hMenu); 39 | } 40 | 41 | ~MenuBase() 42 | { 43 | Destroy(); 44 | Detach(); 45 | } 46 | 47 | public: 48 | bool Create() 49 | { 50 | if (m_hMenu != nullptr) 51 | { 52 | return false; 53 | } 54 | 55 | m_hMenu = CreateMenu(); 56 | 57 | if (m_hMenu == nullptr) 58 | { 59 | return false; 60 | } 61 | 62 | return true; 63 | } 64 | 65 | bool CreatePopup() 66 | { 67 | if (m_hMenu != nullptr) 68 | { 69 | return false; 70 | } 71 | 72 | m_hMenu = CreatePopupMenu(); 73 | 74 | if (m_hMenu == nullptr) 75 | { 76 | return false; 77 | } 78 | 79 | return true; 80 | } 81 | 82 | bool Destroy() 83 | { 84 | if (m_hMenu == nullptr) 85 | { 86 | return false; 87 | } 88 | 89 | if (!DestroyMenu(m_hMenu)) 90 | { 91 | return false; 92 | } 93 | 94 | return true; 95 | } 96 | 97 | public: 98 | bool Attach(HMENU hMenu) 99 | { 100 | if (m_hMenu != nullptr) 101 | { 102 | return false; 103 | } 104 | 105 | m_hMenu = hMenu; 106 | 107 | return true; 108 | } 109 | 110 | HMENU Detach() 111 | { 112 | HMENU hMenu = m_hMenu; 113 | 114 | if (m_hMenu != nullptr) 115 | { 116 | m_hMenu = nullptr; 117 | } 118 | 119 | return hMenu; 120 | } 121 | 122 | protected: 123 | HMENU m_hMenu; 124 | }; 125 | 126 | } // namespace xl 127 | 128 | 129 | #endif // #ifndef __XLMENUBASE_H_C208C619_17E7_4147_BBFD_C815FAFA7324_INCLUDED__ 130 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/GUI/xlStdLink.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlStdLink.h 6 | // Author: Streamlet 7 | // Create Time: 2011-03-07 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLSTDLINK_H_FEA6F574_15DC_4178_8DFA_83C8226EC770_INCLUDED__ 17 | #define __XLSTDLINK_H_FEA6F574_15DC_4178_8DFA_83C8226EC770_INCLUDED__ 18 | 19 | 20 | #include "xlWindow.h" 21 | 22 | namespace xl 23 | { 24 | class StdLink : public Window 25 | { 26 | public: 27 | StdLink() 28 | { 29 | 30 | } 31 | 32 | StdLink(HWND hWnd) : 33 | Window(hWnd) 34 | { 35 | 36 | } 37 | 38 | ~StdLink() 39 | { 40 | 41 | } 42 | 43 | protected: 44 | static LPCTSTR GetClassName() 45 | { 46 | return WC_LINK; 47 | } 48 | 49 | public: 50 | bool Create(UINT nID, 51 | Window *pParent, 52 | int x = CW_USEDEFAULT, 53 | int y = CW_USEDEFAULT, 54 | int nWidth = CW_USEDEFAULT, 55 | int nHeight = CW_USEDEFAULT, 56 | DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP, 57 | DWORD dwExStyle = 0, 58 | HINSTANCE hInstance = nullptr) 59 | { 60 | if (!Window::Create(x, 61 | y, 62 | nWidth, 63 | nHeight, 64 | pParent, 65 | GetClassName(), 66 | dwStyle, 67 | dwExStyle, 68 | (HMENU)nID, 69 | hInstance)) 70 | { 71 | return false; 72 | } 73 | 74 | return true; 75 | } 76 | 77 | public: // Attributes 78 | 79 | int GetIdealHeight(int cxMaxWidth = 0) 80 | { 81 | return (int)::SendMessage(m_hWnd, LM_GETIDEALHEIGHT, cxMaxWidth, 0L); 82 | } 83 | 84 | BOOL GetItem(PLITEM pLItem) 85 | { 86 | return (BOOL)::SendMessage(m_hWnd, LM_GETITEM, 0, (LPARAM)pLItem); 87 | } 88 | 89 | BOOL SetItem(PLITEM pLItem) 90 | { 91 | return (BOOL)::SendMessage(m_hWnd, LM_SETITEM, 0, (LPARAM)pLItem); 92 | } 93 | 94 | public: // Vista only 95 | 96 | int GetIdealSize(SIZE& size, int cxMaxWidth = 0) const 97 | { 98 | return (int)::SendMessage(m_hWnd, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size); 99 | } 100 | 101 | public: // Operations 102 | 103 | BOOL HitTest(PLHITTESTINFO pLHitTestInfo) const 104 | { 105 | return (BOOL)::SendMessage(m_hWnd, LM_HITTEST, 0, (LPARAM)pLHitTestInfo); 106 | } 107 | }; 108 | 109 | } // namespace xl 110 | 111 | #endif // #ifndef __XLSTDLINK_H_FEA6F574_15DC_4178_8DFA_83C8226EC770_INCLUDED__ 112 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/GUI/xlStdScrollBar.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlStdScrollBar.h 6 | // Author: Streamlet 7 | // Create Time: 2011-03-04 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLSTDSCROLLBAR_H_CE421D01_3A90_4DFA_A59F_74C911033E2A_INCLUDED__ 17 | #define __XLSTDSCROLLBAR_H_CE421D01_3A90_4DFA_A59F_74C911033E2A_INCLUDED__ 18 | 19 | 20 | #include "xlWindow.h" 21 | 22 | namespace xl 23 | { 24 | class StdScrollBar : public Window 25 | { 26 | public: 27 | StdScrollBar() 28 | { 29 | 30 | } 31 | 32 | StdScrollBar(HWND hWnd) : 33 | Window(hWnd) 34 | { 35 | 36 | } 37 | 38 | ~StdScrollBar() 39 | { 40 | 41 | } 42 | 43 | protected: 44 | static LPCTSTR GetClassName() 45 | { 46 | return WC_SCROLLBAR; 47 | } 48 | 49 | public: 50 | bool Create(UINT nID, 51 | Window *pParent, 52 | int x = CW_USEDEFAULT, 53 | int y = CW_USEDEFAULT, 54 | int nWidth = CW_USEDEFAULT, 55 | int nHeight = CW_USEDEFAULT, 56 | DWORD dwStyle = WS_CHILD | WS_VISIBLE | SBS_VERT, 57 | DWORD dwExStyle = 0, 58 | HINSTANCE hInstance = nullptr) 59 | { 60 | if (!Window::Create(x, 61 | y, 62 | nWidth, 63 | nHeight, 64 | pParent, 65 | GetClassName(), 66 | dwStyle, 67 | dwExStyle, 68 | (HMENU)nID, 69 | hInstance)) 70 | { 71 | return false; 72 | } 73 | 74 | return true; 75 | } 76 | 77 | public: // Attributes 78 | 79 | int SetScrollPos(int nPos, BOOL bRedraw = TRUE) 80 | { 81 | return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw); 82 | } 83 | 84 | void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) 85 | { 86 | ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); 87 | } 88 | 89 | BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo) const 90 | { 91 | return ::GetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo); 92 | } 93 | 94 | int SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) 95 | { 96 | return ::SetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo, bRedraw); 97 | } 98 | 99 | #if (WINVER >= 0x0500) 100 | 101 | BOOL GetScrollBarInfo(PSCROLLBARINFO pScrollBarInfo) const 102 | { 103 | #if (_WIN32_WINNT >= 0x0501) 104 | return (BOOL)::SendMessage(m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo); 105 | #else // !(_WIN32_WINNT >= 0x0501) 106 | return ::GetScrollBarInfo(m_hWnd, OBJID_CLIENT, pScrollBarInfo); 107 | #endif // !(_WIN32_WINNT >= 0x0501) 108 | } 109 | 110 | #endif // (WINVER >= 0x0500) 111 | 112 | public: // Operations 113 | 114 | void ShowScrollBar(BOOL bShow = TRUE) 115 | { 116 | ::ShowScrollBar(m_hWnd, SB_CTL, bShow); 117 | } 118 | 119 | BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH) 120 | { 121 | return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags); 122 | } 123 | }; 124 | 125 | } // namespace xl 126 | 127 | #endif // #ifndef __XLSTDSCROLLBAR_H_CE421D01_3A90_4DFA_A59F_74C911033E2A_INCLUDED__ 128 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/GUI/xlStdStatic.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlStdStatic.h 6 | // Author: Streamlet 7 | // Create Time: 2011-02-13 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLSTDSTATIC_H_1715D513_4BF0_431F_BC57_C347432395BB_INCLUDED__ 17 | #define __XLSTDSTATIC_H_1715D513_4BF0_431F_BC57_C347432395BB_INCLUDED__ 18 | 19 | 20 | #include "xlWindow.h" 21 | 22 | namespace xl 23 | { 24 | class StdStatic : public Window 25 | { 26 | public: 27 | StdStatic() 28 | { 29 | 30 | } 31 | 32 | StdStatic(HWND hWnd) : 33 | Window(hWnd) 34 | { 35 | 36 | } 37 | 38 | ~StdStatic() 39 | { 40 | 41 | } 42 | 43 | protected: 44 | static LPCTSTR GetClassName() 45 | { 46 | return WC_STATIC; 47 | } 48 | 49 | public: 50 | bool Create(UINT nID, 51 | Window *pParent, 52 | int x = CW_USEDEFAULT, 53 | int y = CW_USEDEFAULT, 54 | int nWidth = CW_USEDEFAULT, 55 | int nHeight = CW_USEDEFAULT, 56 | DWORD dwStyle = WS_CHILD | WS_VISIBLE, 57 | DWORD dwExStyle = 0, 58 | HINSTANCE hInstance = nullptr) 59 | { 60 | if (!Window::Create(x, 61 | y, 62 | nWidth, 63 | nHeight, 64 | pParent, 65 | GetClassName(), 66 | dwStyle, 67 | dwExStyle, 68 | (HMENU)nID, 69 | hInstance)) 70 | { 71 | return false; 72 | } 73 | 74 | return true; 75 | } 76 | 77 | public: 78 | HICON GetIcon() const 79 | { 80 | return (HICON)::SendMessage(m_hWnd, STM_GETICON, 0, 0); 81 | } 82 | 83 | HICON SetIcon(HICON hIcon) 84 | { 85 | return (HICON)::SendMessage(m_hWnd, STM_SETICON, (WPARAM)hIcon, 0); 86 | } 87 | 88 | HENHMETAFILE GetEnhMetaFile() const 89 | { 90 | return (HENHMETAFILE)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0); 91 | } 92 | 93 | HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile) 94 | { 95 | return (HENHMETAFILE)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile); 96 | } 97 | 98 | HBITMAP GetBitmap() const 99 | { 100 | return (HBITMAP)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0); 101 | } 102 | 103 | HBITMAP SetBitmap(HBITMAP hBitmap) 104 | { 105 | return (HBITMAP)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap); 106 | } 107 | 108 | HCURSOR GetCursor() const 109 | { 110 | return (HCURSOR)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0); 111 | } 112 | 113 | HCURSOR SetCursor(HCURSOR hCursor) 114 | { 115 | return (HCURSOR)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor); 116 | } 117 | }; 118 | 119 | } // namespace xl 120 | 121 | #endif // #ifndef __XLSTDSTATIC_H_1715D513_4BF0_431F_BC57_C347432395BB_INCLUDED__ 122 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/GUI/xlThunk.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlThunk.h 6 | // Author: Streamlet 7 | // Create Time: 2010-12-20 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLTHUNK_H_41B69CAE_F597_427A_88C1_193B95C8AB06_INCLUDED__ 17 | #define __XLTHUNK_H_41B69CAE_F597_427A_88C1_193B95C8AB06_INCLUDED__ 18 | 19 | 20 | #include "../Memory/xlHeap.h" 21 | #include "../xlWin32Ver.h" 22 | #include 23 | 24 | namespace xl 25 | { 26 | template 27 | class Thunk 28 | { 29 | private: 30 | 31 | #ifdef _WIN64 32 | 33 | #pragma pack(push, 1) 34 | typedef struct _StdCallThunk 35 | { 36 | USHORT m_mov_rcx; // mov rcx, pThis 37 | ULONG64 m_this; 38 | USHORT m_mov_rax; // mov rax, target 39 | ULONG64 m_relproc; 40 | USHORT m_jmp; // jmp target 41 | 42 | } StdCallThunk; 43 | #pragma pack(pop) 44 | 45 | #else 46 | 47 | #pragma pack(push, 1) 48 | typedef struct _StdCallThunk 49 | { 50 | DWORD m_mov; // mov dword ptr [esp+4], pThis 51 | DWORD m_this; 52 | BYTE m_jmp; // jmp pWndProc 53 | DWORD m_relproc; 54 | 55 | } StdCallThunk; 56 | #pragma pack(pop) 57 | 58 | #endif 59 | 60 | private: 61 | static HANDLE ms_hThunkHeap; 62 | HeapHandle m_Heap; 63 | StdCallThunk *m_pThunk; 64 | 65 | public: 66 | Thunk() 67 | : m_pThunk(nullptr) 68 | { 69 | m_Heap.Attach(ms_hThunkHeap); 70 | 71 | if (!m_Heap.IsValid()) 72 | { 73 | m_Heap.Create(HEAP_CREATE_ENABLE_EXECUTE); 74 | } 75 | 76 | m_pThunk = (StdCallThunk *)m_Heap.Alloc(sizeof(StdCallThunk)); 77 | 78 | #ifdef _WIN64 79 | m_pThunk->m_mov_rcx = 0xb948; // mov rcx, pThis 80 | m_pThunk->m_this = 0; 81 | m_pThunk->m_mov_rax = 0xb848; // mov rax, target 82 | m_pThunk->m_relproc = 0; 83 | m_pThunk->m_jmp = 0xe0ff; // jmp rax 84 | #else 85 | m_pThunk->m_mov = 0x042444c7; // mov dword ptr [esp+4], pThis 86 | m_pThunk->m_this = 0; 87 | m_pThunk->m_jmp = 0xe9; // jmp pWndProc 88 | m_pThunk->m_relproc = 0; 89 | #endif 90 | } 91 | 92 | ~Thunk() 93 | { 94 | if (m_pThunk != nullptr) 95 | { 96 | m_Heap.Free(m_pThunk); 97 | m_pThunk = nullptr; 98 | } 99 | 100 | m_Heap.Detach(); 101 | } 102 | 103 | template 104 | void SetObject(const U *pObject) 105 | { 106 | #ifdef _WIN64 107 | m_pThunk->m_this = (ULONG64)pObject; 108 | #else 109 | m_pThunk->m_this = (DWORD)pObject; 110 | #endif 111 | } 112 | 113 | void SetRealProc(T pProc) 114 | { 115 | #ifdef _WIN64 116 | m_pThunk->m_relproc = (ULONG64)pProc; 117 | #else 118 | m_pThunk->m_relproc = (ULONG64)pProc - ((ULONG64)m_pThunk + sizeof(StdCallThunk)); 119 | #endif 120 | } 121 | 122 | T GetThunkProc() 123 | { 124 | return (T)m_pThunk; 125 | } 126 | }; 127 | 128 | template 129 | __declspec(selectany) HANDLE Thunk::ms_hThunkHeap = nullptr; 130 | 131 | } // namespace xl 132 | 133 | #endif // #ifndef __XLTHUNK_H_41B69CAE_F597_427A_88C1_193B95C8AB06_INCLUDED__ 134 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/Memory/xlHeap.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlHeapMgr.h 6 | // Author: Streamlet 7 | // Create Time: 2010-12-20 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLHEAP_H_7B115181_B9FB_4BCD_8E2C_2CDE8814D08A_INCLUDED__ 17 | #define __XLHEAP_H_7B115181_B9FB_4BCD_8E2C_2CDE8814D08A_INCLUDED__ 18 | 19 | 20 | #include "../../Meta/xlUtility.h" 21 | #include "../xlHandle.h" 22 | #include "../xlWin32Ver.h" 23 | #include 24 | 25 | namespace xl 26 | { 27 | struct HeapDestroyer 28 | { 29 | static bool CloseHandle(HANDLE hHandle) 30 | { 31 | return !!::HeapDestroy(hHandle); 32 | } 33 | }; 34 | 35 | template 36 | class HeapT : public NonCopyable, public HandleT 37 | { 38 | public: 39 | HeapT(HANDLE hHeap = nullptr) : HandleT(hHeap) 40 | { 41 | 42 | } 43 | 44 | ~HeapT() 45 | { 46 | 47 | } 48 | 49 | public: 50 | bool Create(DWORD dwOptions, DWORD_PTR dwInitialSize = 0, DWORD_PTR dwMaximumSize = 0) 51 | { 52 | m_hHeap = HeapCreate(dwOptions, dwInitialSize, dwMaximumSize); 53 | return IsValid(); 54 | } 55 | 56 | public: 57 | LPVOID Alloc(size_t nSize) 58 | { 59 | if (m_hHeap == NULL) 60 | { 61 | return NULL; 62 | } 63 | 64 | return HeapAlloc(m_hHeap, 0, nSize); 65 | } 66 | 67 | BOOL Free(LPVOID pMem) 68 | { 69 | if (m_hHeap == NULL) 70 | { 71 | return FALSE; 72 | } 73 | 74 | return HeapFree(m_hHeap, 0, pMem); 75 | } 76 | 77 | private: 78 | HANDLE m_hHeap; 79 | }; 80 | 81 | typedef HeapT<> Heap; 82 | typedef HeapT HeapHandle; 83 | 84 | } // namespace xl 85 | 86 | #endif // #ifndef __XLHEAP_H_7B115181_B9FB_4BCD_8E2C_2CDE8814D08A_INCLUDED__ 87 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/Memory/xlSafeSmartPtr.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlSafeSmartPtr.h 6 | // Author: Streamlet 7 | // Create Time: 2011-05-21 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLSAFESMARTPTR_H_E74125A8_C767_44A2_8659_D350F7638ED6_INCLUDED__ 17 | #define __XLSAFESMARTPTR_H_E74125A8_C767_44A2_8659_D350F7638ED6_INCLUDED__ 18 | 19 | 20 | #include "../../Memory/xlSmartPtr.h" 21 | #include "../xlWin32Ver.h" 22 | #include 23 | 24 | namespace xl 25 | { 26 | class WinSafeRefCounter 27 | { 28 | public: 29 | WinSafeRefCounter() : 30 | m_nCount(0) 31 | { 32 | 33 | } 34 | 35 | ~WinSafeRefCounter() 36 | { 37 | 38 | } 39 | 40 | public: 41 | int Increase() 42 | { 43 | return (int)InterlockedIncrement(&m_nCount); 44 | } 45 | 46 | int Decrease() 47 | { 48 | return (int)InterlockedDecrement(&m_nCount); 49 | } 50 | 51 | private: 52 | LONG m_nCount; 53 | }; 54 | 55 | template 56 | class SafeSharedPtr : public SmartPtr 57 | { 58 | protected: 59 | typedef SmartPtr SmartPtrBase; 60 | 61 | public: 62 | SafeSharedPtr() 63 | { 64 | 65 | } 66 | 67 | SafeSharedPtr(T *pData) : 68 | SmartPtrBase(pData) 69 | { 70 | 71 | } 72 | 73 | SafeSharedPtr(const SafeSharedPtr &that) : 74 | SmartPtrBase(that) 75 | { 76 | 77 | } 78 | 79 | }; 80 | 81 | template 82 | class SafeSharedArray : public SmartPtr 83 | { 84 | protected: 85 | typedef SmartPtr SmartPtrBase; 86 | 87 | public: 88 | SafeSharedArray() 89 | { 90 | 91 | } 92 | 93 | SafeSharedArray(T *pData) : 94 | SmartPtrBase(pData) 95 | { 96 | 97 | } 98 | 99 | SafeSharedArray(const SafeSharedArray &that) : 100 | SmartPtrBase(that) 101 | { 102 | 103 | } 104 | }; 105 | 106 | } // namespace xl 107 | 108 | #endif // #ifndef __XLSAFESMARTPTR_H_E74125A8_C767_44A2_8659_D350F7638ED6_INCLUDED__ 109 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/Threads/xlCriticalSection.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlCriticalSection.h 6 | // Author: Streamlet 7 | // Create Time: 2011-01-04 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLCRITICALSECTION_H_C580E922_6ED8_483E_8223_2174E0EF7310_INCLUDED__ 17 | #define __XLCRITICALSECTION_H_C580E922_6ED8_483E_8223_2174E0EF7310_INCLUDED__ 18 | 19 | 20 | #include "../../Meta/xlUtility.h" 21 | #include "../../Meta/xlScopeExit.h" 22 | #include "../xlWin32Ver.h" 23 | #include 24 | 25 | namespace xl 26 | { 27 | class CriticalSection : public NonCopyable 28 | { 29 | public: 30 | CriticalSection() 31 | { 32 | InitializeCriticalSection(&m_CriticalSection); 33 | } 34 | 35 | ~CriticalSection() 36 | { 37 | DeleteCriticalSection(&m_CriticalSection); 38 | } 39 | 40 | public: 41 | void Lock() 42 | { 43 | EnterCriticalSection(&m_CriticalSection); 44 | } 45 | 46 | void UnLock() 47 | { 48 | LeaveCriticalSection(&m_CriticalSection); 49 | } 50 | 51 | bool TryLock() 52 | { 53 | if (!TryEnterCriticalSection(&m_CriticalSection)) 54 | { 55 | return false; 56 | } 57 | 58 | return true; 59 | } 60 | 61 | private: 62 | CRITICAL_SECTION m_CriticalSection; 63 | }; 64 | 65 | #define XL_SCOPED_CRITICAL_SECTION(cs) \ 66 | \ 67 | cs.Lock(); \ 68 | XL_ON_BLOCK_EXIT(&cs, &xl::CriticalSection::UnLock) 69 | 70 | } // namespace xl 71 | 72 | #endif // #ifndef __XLCRITICALSECTION_H_C580E922_6ED8_483E_8223_2174E0EF7310_INCLUDED__ 73 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/Threads/xlEvent.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlEvent.h 6 | // Author: Streamlet 7 | // Create Time: 2013-05-15 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLEVENT_H_7BC8461C_EA45_496E_B383_023E9D4FFCD7_INCLUDED__ 16 | #define __XLEVENT_H_7BC8461C_EA45_496E_B383_023E9D4FFCD7_INCLUDED__ 17 | 18 | 19 | #include "../xlHandle.h" 20 | #include "../xlWin32Ver.h" 21 | #include 22 | 23 | namespace xl 24 | { 25 | class Event : public Handle 26 | { 27 | public: 28 | Event() 29 | { 30 | 31 | } 32 | 33 | ~Event() 34 | { 35 | 36 | } 37 | 38 | public: 39 | bool Create(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR lpName) 40 | { 41 | m_hHandle = CreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName); 42 | 43 | if (m_hHandle == nullptr) 44 | { 45 | return false; 46 | } 47 | 48 | return true; 49 | } 50 | 51 | bool Open(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCTSTR lpName) 52 | { 53 | m_hHandle = OpenEvent(dwDesiredAccess, bInheritHandle, lpName); 54 | 55 | if (m_hHandle == nullptr) 56 | { 57 | return false; 58 | } 59 | 60 | return true; 61 | } 62 | 63 | bool Reset() 64 | { 65 | if (!ResetEvent(m_hHandle)) 66 | { 67 | return false; 68 | } 69 | 70 | return true; 71 | } 72 | 73 | bool Set() 74 | { 75 | if (!SetEvent(m_hHandle)) 76 | { 77 | return false; 78 | } 79 | 80 | return true; 81 | } 82 | }; 83 | 84 | } // namespace xl 85 | 86 | #endif // #ifndef __XLEVENT_H_7BC8461C_EA45_496E_B383_023E9D4FFCD7_INCLUDED__ 87 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/Threads/xlTls.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlTls.h 6 | // Author: Streamlet 7 | // Create Time: 2010-12-20 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLTLS_H_227ED6E5_E819_4DAF_8ACB_51EBFA717AFC_INCLUDED__ 17 | #define __XLTLS_H_227ED6E5_E819_4DAF_8ACB_51EBFA717AFC_INCLUDED__ 18 | 19 | 20 | #include "../../Meta/xlUtility.h" 21 | #include "../xlWin32Ver.h" 22 | #include 23 | 24 | namespace xl 25 | { 26 | class Tls : public NonCopyable 27 | { 28 | public: 29 | Tls() : 30 | m_dwTlsIndex(TLS_OUT_OF_INDEXES) 31 | { 32 | m_dwTlsIndex = TlsAlloc(); 33 | } 34 | 35 | ~Tls() 36 | { 37 | if (m_dwTlsIndex != TLS_OUT_OF_INDEXES) 38 | { 39 | TlsFree(m_dwTlsIndex); 40 | m_dwTlsIndex = TLS_OUT_OF_INDEXES; 41 | } 42 | } 43 | 44 | public: 45 | BOOL Set(LPVOID lpValue) 46 | { 47 | if (m_dwTlsIndex == TLS_OUT_OF_INDEXES) 48 | { 49 | return FALSE; 50 | } 51 | 52 | return TlsSetValue(m_dwTlsIndex, lpValue); 53 | } 54 | 55 | LPVOID Get() 56 | { 57 | if (m_dwTlsIndex == TLS_OUT_OF_INDEXES) 58 | { 59 | return NULL; 60 | } 61 | 62 | return TlsGetValue(m_dwTlsIndex); 63 | } 64 | 65 | private: 66 | DWORD m_dwTlsIndex; 67 | }; 68 | 69 | } // namespace xl 70 | 71 | #endif // #ifndef __XLTLS_H_227ED6E5_E819_4DAF_8ACB_51EBFA717AFC_INCLUDED__ 72 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/Timer/xlTimer.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlTimer.h 6 | // Author: Streamlet 7 | // Create Time: 2013-06-24 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLTIMER_H_39C0A466_0EB3_4D32_879B_1984722D3AEE_INCLUDED__ 16 | #define __XLTIMER_H_39C0A466_0EB3_4D32_879B_1984722D3AEE_INCLUDED__ 17 | 18 | 19 | #include "../../Meta/xlFunction.h" 20 | #include "../GUI/xlThunk.h" 21 | #include "../xlWin32Ver.h" 22 | #include 23 | 24 | namespace xl 25 | { 26 | typedef Function TimerCallback; 27 | 28 | class Timer 29 | { 30 | public: 31 | Timer() : m_uTimerId(0) 32 | { 33 | 34 | } 35 | 36 | ~Timer() 37 | { 38 | Kill(); 39 | } 40 | 41 | public: 42 | bool Set(UINT uElapse, TimerCallback fnCallback) 43 | { 44 | if (m_uTimerId != 0) 45 | { 46 | return false; 47 | } 48 | 49 | m_fnCallback = fnCallback; 50 | m_thunk.SetObject(this); 51 | m_thunk.SetRealProc(StaticTimerProc); 52 | 53 | m_uTimerId = SetTimer(nullptr, 0, uElapse, m_thunk.GetThunkProc()); 54 | 55 | if (m_uTimerId == 0) 56 | { 57 | return false; 58 | } 59 | 60 | return true; 61 | } 62 | 63 | void Kill() 64 | { 65 | if (m_uTimerId != 0) 66 | { 67 | KillTimer(nullptr, m_uTimerId); 68 | m_uTimerId = 0; 69 | } 70 | } 71 | 72 | protected: 73 | static VOID CALLBACK StaticTimerProc(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) 74 | { 75 | return ((Timer *)hWnd)->m_fnCallback(dwTime); 76 | } 77 | 78 | protected: 79 | UINT_PTR m_uTimerId; 80 | Thunk m_thunk; 81 | TimerCallback m_fnCallback; 82 | }; 83 | 84 | } // namespace xl 85 | 86 | #endif // #ifndef __XLTIMER_H_39C0A466_0EB3_4D32_879B_1984722D3AEE_INCLUDED__ 87 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/xlHandle.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------- 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlHandle.h 6 | // Author: Streamlet 7 | // Create Time: 2013-05-15 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | //-------------------------------------------------------------------- 14 | 15 | #ifndef __XLHANDLE_H_39C0A466_0EB3_4D32_879B_1984722D3AED_INCLUDED__ 16 | #define __XLHANDLE_H_39C0A466_0EB3_4D32_879B_1984722D3AED_INCLUDED__ 17 | 18 | 19 | #include 20 | 21 | namespace xl 22 | { 23 | struct DefaultHandleCloser 24 | { 25 | static bool CloseHandle(HANDLE hHandle) 26 | { 27 | return !!::CloseHandle(hHandle); 28 | } 29 | }; 30 | 31 | template 32 | class HandleT 33 | { 34 | public: 35 | HandleT(HANDLE hHandle = nullptr) : 36 | m_hHandle(hHandle) 37 | { 38 | 39 | } 40 | 41 | virtual ~HandleT() 42 | { 43 | if (bManaged) 44 | { 45 | Close(); 46 | } 47 | else 48 | { 49 | Detach(); 50 | } 51 | } 52 | 53 | public: 54 | HANDLE Attach(HANDLE hHandle) 55 | { 56 | HANDLE hPrevious = m_hHandle; 57 | m_hHandle = hHandle; 58 | return hPrevious; 59 | } 60 | 61 | HANDLE Detach() 62 | { 63 | return Attach(nullptr); 64 | } 65 | 66 | bool Close() 67 | { 68 | if (m_hHandle == nullptr) 69 | { 70 | return true; 71 | } 72 | 73 | if (!HandleCloser::CloseHandle(m_hHandle)) 74 | { 75 | return false; 76 | } 77 | 78 | m_hHandle = nullptr; 79 | 80 | return true; 81 | } 82 | 83 | public: 84 | operator HANDLE() const 85 | { 86 | return m_hHandle; 87 | } 88 | 89 | bool IsValid() const 90 | { 91 | return m_hHandle != nullptr && m_hHandle != INVALID_HANDLE_VALUE; 92 | } 93 | 94 | protected: 95 | HANDLE m_hHandle; 96 | }; 97 | 98 | typedef HandleT<> Handle; 99 | 100 | } // namespace xl 101 | 102 | #endif // #ifndef __XLHANDLE_H_39C0A466_0EB3_4D32_879B_1984722D3AED_INCLUDED__ 103 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/Win32/xlWin32Ver.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlWin32Ver.h 6 | // Author: Streamlet 7 | // Create Time: 2011-02-27 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLWIN32VER_H_0AF602A1_81D0_4829_88DB_7DD912BD2A35_INCLUDED__ 17 | #define __XLWIN32VER_H_0AF602A1_81D0_4829_88DB_7DD912BD2A35_INCLUDED__ 18 | 19 | 20 | // Including SDKDDKVer.h defines the highest available Windows platform. 21 | 22 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 23 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 24 | 25 | #include 26 | 27 | 28 | #endif // #ifndef __XLWIN32VER_H_0AF602A1_81D0_4829_88DB_7DD912BD2A35_INCLUDED__ 29 | -------------------------------------------------------------------------------- /Use-Third-Party-Lib/xl/xlDef.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (C) Streamlet. All rights reserved. 4 | // 5 | // File Name: xlDef.h 6 | // Author: Streamlet 7 | // Create Time: 2010-10-14 8 | // Description: 9 | // 10 | // Version history: 11 | // 12 | // 13 | // 14 | //------------------------------------------------------------------------------ 15 | 16 | #ifndef __XLDEF_H_1C304B99_7B3A_4BDB_9BE7_0C76AD3C1126_INCLUDED__ 17 | #define __XLDEF_H_1C304B99_7B3A_4BDB_9BE7_0C76AD3C1126_INCLUDED__ 18 | 19 | 20 | namespace xl 21 | { 22 | 23 | #if defined(_MSC_VER) 24 | # define XL_SIZE_T_DEFINED 25 | # if _MSC_VER >= 1600 26 | # define XL_NULLPTR_DEFINED 27 | # endif 28 | #elif defined(__GNUC__) 29 | # if !defined(size_t) 30 | typedef unsigned int size_t; 31 | # endif 32 | #endif 33 | 34 | #ifndef XL_NULLPTR_DEFINED 35 | #define nullptr 0 36 | #endif 37 | 38 | } // namespace xl 39 | 40 | #endif // #ifndef __XLDEF_H_1C304B99_7B3A_4BDB_9BE7_0C76AD3C1126_INCLUDED__ 41 | --------------------------------------------------------------------------------