當前位置: 首頁>>代碼示例>>C++>>正文


C++ AfxGetModuleState函數代碼示例

本文整理匯總了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();
	}
}
開發者ID:sirmax1,項目名稱:coin,代碼行數:7,代碼來源:com-module.cpp

示例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));
	}
}
開發者ID:sirmax1,項目名稱:coin,代碼行數:12,代碼來源:com-module.cpp

示例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;
}
開發者ID:VectorDM,項目名稱:VC98,代碼行數:15,代碼來源:DLLINIT.CPP

示例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;
}
開發者ID:hkaiser,項目名稱:TRiAS,代碼行數:35,代碼來源:TRiASToolBar.cpp

示例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);
}
開發者ID:sirmax1,項目名稱:coin,代碼行數:7,代碼來源:win-thread.cpp

示例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;
}
開發者ID:anyue100,項目名稱:winscp,代碼行數:35,代碼來源:olefact.cpp

示例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
}
開發者ID:VectorDM,項目名稱:VC98,代碼行數:28,代碼來源:DLLNET.CPP

示例8: AfxNetInitModule

void AFXAPI AfxNetInitModule()
{
	ASSERT(AfxGetModuleState() != AfxGetAppModuleState());

	CDynLinkLibrary* pDLL = new CDynLinkLibrary(extensionDLL, TRUE);
	ASSERT(pDLL != NULL);
}
開發者ID:VectorDM,項目名稱:VC98,代碼行數:7,代碼來源:DLLNET.CPP

示例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;
}
開發者ID:rickerliang,項目名稱:OpenNT,代碼行數:7,代碼來源:except.cpp

示例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();
}
開發者ID:VectorDM,項目名稱:VC98,代碼行數:25,代碼來源:DLLINIT.CPP

示例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);
}
開發者ID:kocicjelena,項目名稱:Far-NetBox,代碼行數:8,代碼來源:FileZillaIntf.cpp

示例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;
}
開發者ID:VectorDM,項目名稱:VC98,代碼行數:28,代碼來源:DLLINIT.CPP

示例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;
}
開發者ID:Rupan,項目名稱:winscp,代碼行數:29,代碼來源:occlock.cpp

示例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();
}
開發者ID:sirmax1,項目名稱:coin,代碼行數:9,代碼來源:com-module.cpp

示例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);
}
開發者ID:MXControl,項目名稱:Metis,代碼行數:10,代碼來源:RoboEx.cpp


注:本文中的AfxGetModuleState函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。