描述:
我写了支持mfc的组建,发现居然 互斥量不能用了(原来在非mfc支持的atl中,我用过的没问题),
我这里有简单的代码,来看一看,留email
基本代码如下
static CRITICAL_SECTION CriticalSection;
BOOL CMfcComApp::InitInstance()
{
#ifdef _MERGE_PROXYSTUB
hProxyDll = m_hInstance;
#endif
InitializeCriticalSection(&CriticalSection);
AfxMessageBox("instance");
_Module.Init(ObjectMap, m_hInstance, &LIBID_MFCCOMLib);
return CWinApp::InitInstance();
}
int CMfcComApp::ExitInstance()
{
_Module.Term();
DeleteCriticalSection(&CriticalSection);
AfxMessageBox("uninstance");
return CWinApp::ExitInstance();
}
STDMETHODIMP CMfcCom1::Test()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
// try
// {
AfxMessageBox("before entercriticalsection");
EnterCriticalSection(&CriticalSection);
AfxMessageBox("after entercriticalsection");
AfxMessageBox("before leave criticalsection");
LeaveCriticalSection(&CriticalSection);
AfxMessageBox("after leave criticalsection");
// }
// catch ()
// {
// }
return S_OK;
}
您可能想查找下面的文章:
- [奇怪的问题!],郁闷ing!想清理word的打开文件的历史记录,通过code,自己写了点code结果没有生效!大牛们给点建议!或者解决方案!
- 关于视频聊天插件,请各位大牛帮帮忙!!
- win32sdk中如何与flash通信?下面的源程序,可是编译出错,大牛请帮助
- 公司要招人,特向各位大牛征集VC笔试题和面试题!!!有的速报!
- ##求助大牛!webbrowser设置为silence后JavaScript出错后停止了脚本执行,如何重新启动脚本引擎??
- 按照凤之焚、jameshooo两位大牛的思路做mimefilter
- 求大牛看看,richedit添加qq的imageoledll显示gif的时候闪烁的厉害。在线等
- 大牛救我,关于waitforsingleobject的疑惑
- 请教一个关于隐藏应用程序在任务栏图标的问题。大牛请进
- 大牛!请帮忙解决!@VS2010@x64DEBUG不能正常运行?