在公司的局域网内,我想在本机上创建队列到服务器上,为何返回的错误总是:对于workgroup安装计算机,操作不受支持!
不好意思,虽然很急,但是最多也只能给100分!
代码如下:
HRESULT CAppMsmqDlg::CreateXactQueue()
{
LPCTSTR wszTempPathName;
LPCTSTR wszComputerName=NULL,wszQueueName=NULL;
IMSMQQueuePtr pQueue; wszTempPathName=_T(".\\MyQueueName");
HRESULT hr = S_OK;
try
{
IMSMQQueueInfoPtr pInfo("MSMQ.MSMQQueueInfo");
_variant_t varTrue;
varTrue.ChangeType(VT_BOOL);
varTrue.boolVal=TRUE;
// Set the path name and label of the queue.
pInfo->PathName = wszPathName;
pInfo->Label = "TestQueue";
// Create the queue, setting the transaction parameter.
pInfo->Create(&varTrue);
// Display the successful message.
TCHAR szMessage[1024];
wsprintf(szMessage, "The queue %S was created successfully.", wszPathName);
MessageBox( szMessage, NULL, MB_OK);
}
catch (_com_error comerr)
{
HRESULT hr = comerr.Error();
// Display error message.
MessageBox(comerr.Description(),NULL,MB_OK);
}
return hr;}
不好意思,虽然很急,但是最多也只能给100分!
代码如下:
HRESULT CAppMsmqDlg::CreateXactQueue()
{
LPCTSTR wszTempPathName;
LPCTSTR wszComputerName=NULL,wszQueueName=NULL;
IMSMQQueuePtr pQueue; wszTempPathName=_T(".\\MyQueueName");
HRESULT hr = S_OK;
try
{
IMSMQQueueInfoPtr pInfo("MSMQ.MSMQQueueInfo");
_variant_t varTrue;
varTrue.ChangeType(VT_BOOL);
varTrue.boolVal=TRUE;
// Set the path name and label of the queue.
pInfo->PathName = wszPathName;
pInfo->Label = "TestQueue";
// Create the queue, setting the transaction parameter.
pInfo->Create(&varTrue);
// Display the successful message.
TCHAR szMessage[1024];
wsprintf(szMessage, "The queue %S was created successfully.", wszPathName);
MessageBox( szMessage, NULL, MB_OK);
}
catch (_com_error comerr)
{
HRESULT hr = comerr.Error();
// Display error message.
MessageBox(comerr.Description(),NULL,MB_OK);
}
return hr;}
public queue 不同于private queue
建议参考msdn