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

时间:2018-01-22 07:31:41

标签: c++

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

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

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

queue.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;
}

的main.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;
}

Exception create queue

1 个答案:

答案 0 :(得分:0)

最后我找到了解决方案......

我给了公共道路而不是私人拍。将“.//queuename”更改为.// private $ // queuename“。