我要在dll里使用MSMQ队列,代码如下:
try
{
VARIANT vt;
V_VT(&vt) = VT_I4;
V_I4(&vt) = 1;//Begin Notification

VARIANT vtRecTime;
V_VT(&vtRecTime) = VT_I4;
V_INT(&vtRecTime) = -1;

IMSMQEventPtr m_lpEvent("MSMQ.MSMQEvent");
m_pMsmqQueuePtr->EnableNotification(m_lpEvent,&vt,&vtRecTime); m_bConnectionAdvised = GetConnectedToSink();
    }
catch (_com_error openerr) 
{
string str=openerr.Description();
CFile file4("C:\\client.txt",CFile::modeWrite);
file4.SeekToEnd();
file4.Write(str.c_str(),str.length());
file4.Close();
return FALSE;
}
程序总在m_pMsmqQueuePtr->EnableNotification(m_lpEvent,&vt,&vtRecTime);处抛出异常,而且string str=openerr.Description();处会报读写错误,因此无法确定错误的详细情况,而同样的代码在非dll的程序里就可以运行,为什么?要怎么解决?