{app.exe!_com_error::'vector delete destructor'(unsigned int)}

{app.exe!_com_error::`vector deleting destructor'(unsigned int)}

本文关键字:destructor unsigned int delete vector error exe app com      更新时间:2023-10-16

我在Visual Studio 2017中创建MSMQqueue时遇到异常,请在下面找到代码和异常详细信息:

Exception details :
app.exe!`queue::CreateQueue'::`1'::catch$3() Line 56    C++ Symbols loaded.

请建议队列实现串口读写。

队列.cpp

#include "stdafx.h"
#include "MSMQ_Queue.h"
#import "mqoa.dll"
using namespace MSMQ;
queue::queue()  {}
queue::~queue() {}
HRESULT queue::CreateQueue(WCHAR *wszPathName)
{
    HRESULT hr = S_OK;
    if (wszPathName == NULL)
    {
        return MQ_ERROR_INVALID_PARAMETER;
    }
    try
    {
        IMSMQQueueInfoPtr pInfo("MSMQ.MSMQQueueInfo");
        // Set the queue's path name and label.  
        pInfo->PathName = wszPathName;
        pInfo->Label = "TestQueue";
        // Create the queue.  
        **pInfo->Create();**//Hitting exception at this point
        WCHAR wszMessage[1024] = { 0 };     
    }
    catch (const _com_error& comerr)
    {
        hr = comerr.Error();            
        WCHAR wszMessage[2048] = { 0 };
    }
    return hr;
}

主.cpp

#include "stdafx.h"
#include"queue.h"    
#include <stdio.h>      // for printf
int main()
{    
    wchar_t name[] = L".\vniqueue";
    queue msmqueue; 
    //CoInitialize(0);
    OleInitialize(NULL);
    HRESULT returnValue = msmqueue.CreateQueue(name);
    getchar();
    return 0;
}

异常创建队列

最后我找到了解决方案。

我提供了公共路径而不是私人拍拍。 将".//queuename"更改为.//private$//queuename"。

相关文章: