本文整理匯總了C++中AfxGetModuleState函數的典型用法代碼示例。如果您正苦於以下問題:C++ AfxGetModuleState函數的具體用法?C++ AfxGetModuleState怎麽用?C++ AfxGetModuleState使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AfxGetModuleState函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AfxOleUnlockApp
void AFXAPI AfxOleUnlockApp() {
AfxGetModuleState()->m_comModule.Unlock();
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
if (AfxOleCanExitApp()) {
AfxOleOnReleaseAllObjects();
}
}
示例2: m_pGeneralClass
CComClass::CComClass(CComGeneralClass *gc)
: m_pGeneralClass(gc)
, m_pModuleState(AfxGetModuleState())
{
ZeroStruct(m_iid);
if (gc) {
AFX_MODULE_STATE *pMS = AfxGetModuleState();
if (!pMS->m_typeLib.m_iTypeLib)
pMS->m_typeLib.Load();
AfxGetModuleThreadState()->m_classList.push_back(unique_ptr<CComClass>(this));
}
}
示例3: AfxCoreInitModule
void AFXAPI AfxCoreInitModule()
{
ASSERT(AfxGetModuleState() != AfxGetAppModuleState());
// construct new dynlink library in this context for core resources
CDynLinkLibrary* pDLL = new CDynLinkLibrary(coreDLL, TRUE);
ASSERT(pDLL != NULL);
pDLL->m_factoryList.m_pHead = NULL;
// borrow resources from language specific DLL if loaded
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
AFX_MODULE_STATE* pAppState = AfxGetAppModuleState();
if (pModuleState->m_appLangDLL == NULL)
pModuleState->m_appLangDLL = pAppState->m_appLangDLL;
}
示例4: AFX_MANAGE_STATE
HRESULT CTRiASToolBar::InsertButton (
int iIndex, const TBBUTTON *pBttn, ITRiASUIOwner *pIOwner)
{
AFX_MANAGE_STATE(AfxGetModuleState());
ASSERT_VALID(this);
ASSERT(::IsWindow(m_hWnd));
// jetzt Owner zusammen mit dem ID speichern
if (!((pBttn -> fsStyle & TBSTYLE_SEP) && 0 == pBttn -> idCommand)) { // Separators not handled here
pair<UIOwners::iterator, bool> p = m_Owners.insert (pBttn -> idCommand, pIOwner);
ASSERT(p.second);
if (!p.second)
return ResultFromScode (E_FAIL);
}
// und zur Toolbar hinzufügen
#if !defined(_USE_SEC_CLASSES)
// wenn dieses der erste Zugriff ist, dann Separator entfernen
if (m_fHasDummySep) {
DeleteItem (0);
m_fHasDummySep = false;
}
CToolBarCtrl &rTB = GetToolBarCtrl();
HRESULT hr = (rTB.InsertButton (iIndex, const_cast<TBBUTTON *>(pBttn))) ? NOERROR : S_FALSE;
#else
HRESULT hr = m_pMainFrm -> InsertButton (this, iIndex, pBttn, pIOwner);
#endif // _USE_SEC_CLASSES
if (S_OK == hr && IsWindowVisible())
m_pMainFrm -> DelayRecalcLayout();
return hr;
}
示例5: _AfxMsgFilterHook
static LRESULT CALLBACK _AfxMsgFilterHook(int code, WPARAM wParam, LPARAM lParam) {
CWinThread* pThread;
if (AfxGetModuleState()->m_bDLL || (code < 0 && code != MSGF_DDEMGR) || !(pThread = AfxGetThread()))
return AfxGetThreadState()->m_hookMsg.CallNext(code, wParam, lParam);
ASSERT(pThread != NULL);
return (LRESULT)pThread->ProcessMessageFilter(code, (LPMSG)lParam);
}
示例6: AfxGetModuleState
BOOL PASCAL COleObjectFactory::UpdateRegistryAll(BOOL bRegister)
{
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
AfxLockGlobals(CRIT_OBJECTFACTORYLIST);
for (COleObjectFactory* pFactory = pModuleState->m_factoryList;
pFactory != NULL; pFactory = pFactory->m_pNextFactory)
{
if (!pFactory->UpdateRegistry(bRegister))
{
AfxUnlockGlobals(CRIT_OBJECTFACTORYLIST);
return FALSE;
}
}
AfxUnlockGlobals(CRIT_OBJECTFACTORYLIST);
#ifdef _AFXDLL
AfxLockGlobals(CRIT_DYNLINKLIST);
// register extension DLL factories
for (CDynLinkLibrary* pDLL = pModuleState->m_libraryList; pDLL != NULL;
pDLL = pDLL->m_pNextDLL)
{
for (pFactory = pDLL->m_factoryList;
pFactory != NULL; pFactory = pFactory->m_pNextFactory)
{
if (!pFactory->UpdateRegistry(bRegister))
{
AfxUnlockGlobals(CRIT_DYNLINKLIST);
return FALSE;
}
}
}
AfxUnlockGlobals(CRIT_DYNLINKLIST);
#endif
return TRUE;
}
示例7: RawDllMain
BOOL WINAPI RawDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
{
UNUSED_ALWAYS(hInstance);
if (dwReason == DLL_PROCESS_ATTACH)
{
// Prevent the MFC DLL from being unloaded prematurely
LoadLibraryA(MFC42_DLL);
// make sure we have enough memory to attempt to start (8kb)
void* pMinHeap = LocalAlloc(NONZEROLPTR, 0x2000);
if (pMinHeap == NULL)
return FALSE; // fail if memory alloc fails
LocalFree(pMinHeap);
// save critical data pointers before running the constructors
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
pModuleState->m_pClassInit = pModuleState->m_classList;
pModuleState->m_pFactoryInit = pModuleState->m_factoryList;
pModuleState->m_classList.m_pHead = NULL;
pModuleState->m_factoryList.m_pHead = NULL;
}
else if (dwReason == DLL_PROCESS_DETACH)
{
// Now it's OK for the MFC DLL to be unloaded (see LoadLibrary above)
FreeLibrary(GetModuleHandleA(MFC42_DLL));
}
return TRUE; // ok
}
示例8: AfxNetInitModule
void AFXAPI AfxNetInitModule()
{
ASSERT(AfxGetModuleState() != AfxGetAppModuleState());
CDynLinkLibrary* pDLL = new CDynLinkLibrary(extensionDLL, TRUE);
ASSERT(pDLL != NULL);
}
示例9: AfxSetTerminate
AFX_TERM_PROC AFXAPI AfxSetTerminate(AFX_TERM_PROC pfnNew)
{
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
AFX_TERM_PROC pfnOld = pModuleState->m_pfnTerminate;
pState->m_pfnTerminate = pfnNew;
return pfnOld;
}
示例10: AfxTermExtensionModule
void AFXAPI AfxTermExtensionModule(AFX_EXTENSION_MODULE& state, BOOL bAll)
{
// make sure initialized
if (!state.bInitialized)
return;
// search for CDynLinkLibrary matching state.hModule and delete it
ASSERT(state.hModule != NULL);
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
AfxLockGlobals(CRIT_DYNLINKLIST);
for (CDynLinkLibrary* pDLL = pModuleState->m_libraryList; pDLL != NULL; )
{
CDynLinkLibrary* pNextDLL = pDLL->m_pNextDLL;
if (bAll || pDLL->m_hModule == state.hModule)
delete pDLL; // will unwire itself
pDLL = pNextDLL;
}
AfxUnlockGlobals(CRIT_DYNLINKLIST);
// delete any local storage attached to this module
AfxTermLocalData(state.hModule, TRUE);
// remove any entries from the CWnd message map cache
AfxResetMsgCache();
}
示例11: AfxGetModuleState
//---------------------------------------------------------------------------
void TFileZillaIntf::SetResourceModule(void * ResourceHandle)
{
// set afx resource handles, taken from AfxWinInit (mfc/appinit.cpp)
AFX_MODULE_STATE * ModuleState = AfxGetModuleState();
ModuleState->m_hCurrentInstanceHandle = static_cast<HINSTANCE>(ResourceHandle);
ModuleState->m_hCurrentResourceHandle = static_cast<HINSTANCE>(ResourceHandle);
}
示例12: AfxInitExtensionModule
BOOL AFXAPI AfxInitExtensionModule(AFX_EXTENSION_MODULE& state, HMODULE hModule)
{
// only initialize once
if (state.bInitialized)
{
AfxInitLocalData(hModule);
return TRUE;
}
state.bInitialized = TRUE;
// save the current HMODULE information for resource loading
ASSERT(hModule != NULL);
state.hModule = hModule;
state.hResource = hModule;
// save the start of the runtime class list
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
state.pFirstSharedClass = pModuleState->m_classList.GetHead();
pModuleState->m_classList.m_pHead = pModuleState->m_pClassInit;
#ifndef _AFX_NO_OLE_SUPPORT
// save the start of the class factory list
state.pFirstSharedFactory = pModuleState->m_factoryList.GetHead();
pModuleState->m_factoryList.m_pHead = pModuleState->m_pFactoryInit;
#endif
return TRUE;
}
示例13: AfxOleLockControl
BOOL AFXAPI AfxOleLockControl(REFCLSID clsid)
{
COleControlLock* pLock = NULL;
TRY
{
pLock = new COleControlLock(clsid);
if (pLock->m_pClassFactory == NULL)
{
delete pLock;
pLock = NULL;
}
else
{
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
AfxLockGlobals(CRIT_CTLLOCKLIST);
pModuleState->m_lockList.AddHead(pLock);
AfxUnlockGlobals(CRIT_CTLLOCKLIST);
}
}
CATCH_ALL (e)
{
// Note: DELETE_EXCEPTION(e) not necessary
pLock = NULL;
}
END_CATCH_ALL
return pLock != NULL;
}
示例14: m_pUnkOuter
CComObjectRootBase::CComObjectRootBase()
: m_pUnkOuter(0)
{
AFX_MODULE_STATE *pMS = AfxGetModuleState();
if (!pMS->m_pComClass.get())
pMS->m_pComClass.reset(new CComClass);
m_pClass = pMS->m_pComClass.get();
//!!!R pMS->m_comModule.Lock();
}
示例15: AFX_MANAGE_STATE
LRESULT CRoboEx::QueryInformation(UINT uQueryID, WPARAM wParam, LPARAM lParam)
{
AFX_MANAGE_STATE(AfxGetModuleState());
EXT_MSG_STRUCT msg;
msg.wParam = wParam;
msg.lParam = lParam;
return AfxGetApp()->m_pMainWnd->SendMessage(WM_QAPI, (WPARAM)uQueryID, (LPARAM)&msg);
}