ReactOS 0.4.16-dev-401-g45b008d
ATL::CAtlExeModuleT< T > Class Template Reference

#include <atlbase.h>

Inheritance diagram for ATL::CAtlExeModuleT< T >:
Collaboration diagram for ATL::CAtlExeModuleT< T >:

Public Member Functions

 CAtlExeModuleT ()
 
 ~CAtlExeModuleT ()
 
int WinMain (int nShowCmd)
 
HRESULT Run (int nShowCmd=SW_HIDE)
 
LONG Lock ()
 
LONG Unlock ()
 
bool ParseCommandLine (LPCTSTR lpCmdLine, HRESULT *pnRetCode)
 
HRESULT PreMessageLoop (int nShowCmd)
 
void RunMessageLoop ()
 
HRESULT PostMessageLoop ()
 
HRESULT RegisterClassObjects (DWORD dwClsContext, DWORD dwFlags)
 
HRESULT RevokeClassObjects ()
 
- Public Member Functions inherited from ATL::CAtlModuleT< T >
HRESULT RegisterServer (BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
 
HRESULT UnregisterServer (BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
 
virtual HRESULT AddCommonRGSReplacements (IRegistrarBase *pRegistrar)
 
- Public Member Functions inherited from ATL::CAtlModule
 CAtlModule ()
 
virtual LONG GetLockCount ()
 
virtual LONG Lock ()
 
virtual LONG Unlock ()
 
virtual HRESULT AddCommonRGSReplacements (IRegistrarBase *)=0
 
HRESULT WINAPI UpdateRegistryFromResource (LPCTSTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
 
HRESULT WINAPI UpdateRegistryFromResource (UINT nResID, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
 

Static Public Member Functions

static HRESULT InitializeCom ()
 
static void UninitializeCom ()
 
- Static Public Member Functions inherited from ATL::CAtlModuleT< T >
static LPCOLESTR GetAppId ()
 

Public Attributes

DWORD m_dwMainThreadID
 
- Public Attributes inherited from ATL::_ATL_MODULE70
UINT cbSize
 
LONG m_nLockCnt
 
_ATL_TERMFUNC_ELEMm_pTermFuncs
 
CComCriticalSection m_csStaticDataInitAndTypeInfo
 

Additional Inherited Members

- Static Public Attributes inherited from ATL::CAtlModule
static GUID m_libid
 

Detailed Description

template<class T>
class ATL::CAtlExeModuleT< T >

Definition at line 741 of file atlbase.h.

Constructor & Destructor Documentation

◆ CAtlExeModuleT()

template<class T >
ATL::CAtlExeModuleT< T >::CAtlExeModuleT ( )
inline

Definition at line 751 of file atlbase.h.

753 {
754 _AtlComModule.ExecuteObjectMain(true);
755 }
DWORD m_dwMainThreadID
Definition: atlbase.h:746
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

◆ ~CAtlExeModuleT()

template<class T >
ATL::CAtlExeModuleT< T >::~CAtlExeModuleT ( )
inline

Definition at line 757 of file atlbase.h.

758 {
759 _AtlComModule.ExecuteObjectMain(false);
760 }

Member Function Documentation

◆ InitializeCom()

template<class T >
static HRESULT ATL::CAtlExeModuleT< T >::InitializeCom ( )
inlinestatic

Definition at line 850 of file atlbase.h.

851 {
852#if defined(_ATL_FREE_THREADED)
853 constexpr COINIT coInit = COINIT_MULTITHREADED;
854#else
855 constexpr COINIT coInit = COINIT_APARTMENTTHREADED;
856#endif
857 return ::CoInitializeEx(NULL, coInit);
858 }
#define NULL
Definition: types.h:112
enum tagCOINIT COINIT
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
@ COINIT_MULTITHREADED
Definition: objbase.h:279

◆ Lock()

template<class T >
LONG ATL::CAtlExeModuleT< T >::Lock ( )
inlinevirtual

Reimplemented from ATL::CAtlModule.

Definition at line 797 of file atlbase.h.

798 {
799 return CoAddRefServerProcess();
800 }
ULONG WINAPI CoAddRefServerProcess(void)
Definition: compobj.c:4162

◆ ParseCommandLine()

template<class T >
bool ATL::CAtlExeModuleT< T >::ParseCommandLine ( LPCTSTR  lpCmdLine,
HRESULT pnRetCode 
)
inline

Definition at line 812 of file atlbase.h.

813 {
814 // unimplemented!
815 return true;
816 }

◆ PostMessageLoop()

template<class T >
HRESULT ATL::CAtlExeModuleT< T >::PostMessageLoop ( )
inline

Definition at line 834 of file atlbase.h.

835 {
836 T* pThis = static_cast<T*>(this);
837 return pThis->RevokeClassObjects();
838 }
#define T
Definition: mbstring.h:31

◆ PreMessageLoop()

template<class T >
HRESULT ATL::CAtlExeModuleT< T >::PreMessageLoop ( int  nShowCmd)
inline

Definition at line 818 of file atlbase.h.

819 {
820 T* pThis = static_cast<T*>(this);
821 return pThis->RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE);
822 }
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:393

◆ RegisterClassObjects()

template<class T >
HRESULT ATL::CAtlExeModuleT< T >::RegisterClassObjects ( DWORD  dwClsContext,
DWORD  dwFlags 
)
inline

Definition at line 840 of file atlbase.h.

841 {
842 return AtlComModuleRegisterClassObjects(&_AtlComModule, dwClsContext, dwFlags);
843 }
HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE *module, DWORD context, DWORD flags)
Definition: atlbase.h:1902
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by START_TEST().

◆ RevokeClassObjects()

template<class T >
HRESULT ATL::CAtlExeModuleT< T >::RevokeClassObjects ( )
inline

Definition at line 845 of file atlbase.h.

846 {
847 return AtlComModuleRevokeClassObjects(&_AtlComModule);
848 }
HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE *module)
Definition: atlbase.h:1935

◆ Run()

template<class T >
HRESULT ATL::CAtlExeModuleT< T >::Run ( int  nShowCmd = SW_HIDE)
inline

Definition at line 781 of file atlbase.h.

782 {
783 HRESULT hr = S_OK;
784
785 T* pThis = static_cast<T*>(this);
786 hr = pThis->PreMessageLoop(nShowCmd);
787
788 if (hr == S_OK)
789 {
790 pThis->RunMessageLoop();
791 hr = pThis->PostMessageLoop();
792 }
793
794 return hr;
795 }
#define S_OK
Definition: intsafe.h:52
HRESULT hr
Definition: shlfolder.c:183

◆ RunMessageLoop()

template<class T >
void ATL::CAtlExeModuleT< T >::RunMessageLoop ( )
inline

Definition at line 824 of file atlbase.h.

825 {
826 MSG msg;
827 while (GetMessage(&msg, 0, 0, 0) > 0)
828 {
831 }
832 }
#define msg(x)
Definition: auth_time.c:54
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define GetMessage
Definition: winuser.h:5802
#define DispatchMessage
Definition: winuser.h:5777

◆ UninitializeCom()

template<class T >
static void ATL::CAtlExeModuleT< T >::UninitializeCom ( )
inlinestatic

Definition at line 860 of file atlbase.h.

861 {
863 }
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067

◆ Unlock()

template<class T >
LONG ATL::CAtlExeModuleT< T >::Unlock ( )
inlinevirtual

Reimplemented from ATL::CAtlModule.

Definition at line 802 of file atlbase.h.

803 {
805 if (lRet == 0)
806 {
808 }
809 return lRet;
810 }
ULONG WINAPI CoReleaseServerProcess(void)
Definition: compobj.c:4193
long LONG
Definition: pedump.c:60
#define WM_QUIT
Definition: winuser.h:1626
#define PostThreadMessage
Definition: winuser.h:5845

◆ WinMain()

template<class T >
int ATL::CAtlExeModuleT< T >::WinMain ( int  nShowCmd)
inline

Definition at line 762 of file atlbase.h.

763 {
764 HRESULT hr = T::InitializeCom();
765 if (FAILED(hr))
766 return hr;
767
768 T* pThis = static_cast<T*>(this);
769
770 LPCTSTR lpCommandLine = GetCommandLine();
771 if (pThis->ParseCommandLine(lpCommandLine, &hr))
772 {
773 hr = pThis->Run(nShowCmd);
774 }
775
776 T::UninitializeCom();
777 return hr;
778 }
#define FAILED(hr)
Definition: intsafe.h:51
#define GetCommandLine
Definition: winbase.h:3824
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

Member Data Documentation

◆ m_dwMainThreadID

template<class T >
DWORD ATL::CAtlExeModuleT< T >::m_dwMainThreadID

Definition at line 746 of file atlbase.h.

Referenced by ATL::CAtlExeModuleT< T >::Unlock().


The documentation for this class was generated from the following file: