Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7650943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:22:54+00:00 2026-05-31T11:22:54+00:00

I need to replace an ActiveX control with a new one for use in

  • 0

I need to replace an ActiveX control with a new one for use in an existing application, without modifying the existing application.

I have the original ocx file and the code for the wrapper class that creates and uses the ActiveX control in the existing application.

I have created a test console app in VS 2005, using the wrapper class from the existing application, which can create and use the old ActiveX control.

I have created a new ActiveX control with the same interface as the old, modified all the Class Ids to match and registered the new ocx. The new control can be created, but on calling any of the methods I get a Catastrophic failure with error code 7fff0001.

I took a step back and created another new ActiveX control with the same interface, but didn’t modify the Class Ids. I then built a new test console app using the wrapper class and compiled it for this new control. But I still get a Catastrophic failure when calling the control’s methods.

I have searched for an answer, but most refer to problems calling ActiveX methods from managed c# applications and don’t provide any help for my situation.

Please see the code for the wrapper and ActiveX control import files below, any help would be appreciated thanks.

ClientWrapper.h

#if !defined(AFX_CLIENTWRAPPER_H__D8C23AC2_6F22_11D6_9F45_0003B3008F24__INCLUDED_)
#define AFX_CLIENTWRAPPER_H__D8C23AC2_6F22_11D6_9F45_0003B3008F24__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#import <Msxml3.dll>

#import "ACDCLIENTX.OCX"

#include <atlbase.h>
#include <atlconv.h>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <map>
#include <assert.h>
#ifdef ASSERT
    #undef ASSERT
#endif
#define ASSERT assert

class CParsedResponse  
{
public:
    CParsedResponse():m_bIsApproved(false),m_bIsCaptured(false),
                      m_bIsSuccess(false),m_bIsError(false){;}
    virtual ~CParsedResponse(){;};
    CParsedResponse(const CParsedResponse& copy){*this = copy;}
    CParsedResponse& operator = (const CParsedResponse& that)
    {
        if(this == &that ) return *this;
        m_strErrorNo        =   that.m_strErrorNo;
        m_strVerbage        =   that.m_strVerbage;
        m_strBalance        =   that.m_strBalance; 
        m_strPrePaidExp     =   that.m_strPrePaidExp;
        m_strAuthCode       =   that.m_strAuthCode;
        m_strReferenceNo    =   that.m_strReferenceNo;
        m_strAcctNo         =   that.m_strAcctNo;
        m_strExpDate        =   that.m_strExpDate;
        m_strPurchaseAmount =   that.m_strPurchaseAmount;
        m_strInvoiceNo      =   that.m_strInvoiceNo;
        m_strOpId           =   that.m_strOpId;
        m_strAcqRefData     =   that.m_strAcqRefData;
        m_strOrigin         =   that.m_strOrigin;
        m_bIsApproved       =   that.m_bIsApproved;     
        m_bIsCaptured       =   that.m_bIsCaptured;
        m_bIsSuccess        =   that.m_bIsSuccess;
        m_bIsError          =   that.m_bIsError;
        return *this;
    }
    void Empty()
    {
        m_strErrorNo        =   
        m_strVerbage        =
        m_strBalance        =
        m_strPrePaidExp     =   
        m_strAuthCode       =   
        m_strReferenceNo    =   
        m_strAcctNo         =   
        m_strExpDate        =   
        m_strPurchaseAmount =   
        m_strInvoiceNo      =   
        m_strOpId           =   
        m_strAcqRefData     =   
        m_strOrigin         = "";   

        m_bIsApproved       =   
        m_bIsCaptured       =   
        m_bIsSuccess        =   
        m_bIsError          =   false;
    }

    std::string     m_strErrorNo,
            m_strVerbage,
            m_strBalance,
            m_strPrePaidExp,
            m_strAuthCode,
            m_strReferenceNo,
            m_strAcctNo,
            m_strExpDate,
            m_strPurchaseAmount,
            m_strInvoiceNo,
            m_strOpId,
            m_strAcqRefData,
            m_strOrigin;
    bool    m_bIsApproved,          
            m_bIsCaptured,
            m_bIsSuccess,
            m_bIsError;

};

class CClientWrapper  
{
    std::string m_strName;
    bool LooksLikeIp(const std::string IPorHostName);
    std::string GetIPAddressFromHostName(const std::string& Ip);
    bool GetIPFromXML(const std::string XML,std::string& Ip);
    void AddToStore(std::string & s,const std::string & ip);
    int GetNumIPStoredIPFromXML(const std::string XML);
    std::string BuildErrorResponse(const int ErrNo, const std::string strErrText);
    std::string BuildErrorResponse(const std::string ErrNo, const std::string strErrText);
    std::string CClientWrapper::BuildErrorResponse(const _com_error ComError);
public:
    std::string m_strError;
    std::string m_strServerPassword;
    CParsedResponse ExtractTransResponse(const std::string XmlResponse);
    std::string SendRequestReturnXML(const std::string strXML);
    CParsedResponse SendRequest(const std::string strXML);
    bool DoServerIp(const std::vector<std::string>& IpList);
    std::string PingStoredServerListReturnXML();

private:
    ACDCLIENTXLib::_DACDCLientXPtr m_pClient;   
    bool m_bComInit;
    bool m_bControlInit;

public:
    void Destroy();
    bool Create();
    void Cancel();
    CClientWrapper();
    virtual ~CClientWrapper();
    int SetConnectTimeout(const int t);
    int SetResponseTimeout(const int t);
    CParsedResponse PingStoredServerList();
    // 0 dialog // 1 no dialog  // 2 not currently supported in wrapper
    SHORT m_nDialogControl; 

};

#endif // !defined(AFX_CLIENTWRAPPER_H__D8C23AC2_6F22_11D6_9F45_0003B3008F24__INCLUDED_)

ClientWrapper.cpp

#include "StdAfx.h"

#include "ClientWrapper.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
#define WRAP_ERROR "900999"
CClientWrapper::CClientWrapper():m_bComInit(false),m_bControlInit(false),
    m_nDialogControl(0),m_strServerPassword("")
{

}

CClientWrapper::~CClientWrapper()
{
    Destroy();
}

void  CClientWrapper::Destroy()
{
    if(m_bControlInit)
    {
        m_pClient.Release();
        m_bControlInit = false;
    }

    if(m_bComInit)
    {
        ::CoUninitialize();
        m_bComInit = false;
    }

}
bool CClientWrapper::Create()
{

    USES_CONVERSION;
    Destroy();
    ASSERT(!m_bComInit);
    HRESULT hr = ::CoInitialize(NULL);     
    if (FAILED(hr))     
    {          
        m_strError = "CoInitialize Failed - Fatal Error!";
        return false;
    }
    m_bComInit = true;

    ASSERT(!m_bControlInit);
    hr = m_pClient.CreateInstance(__uuidof(ACDCLIENTXLib::ACDCLientX)); 
    if(FAILED(hr) )
    {
        m_strError = "Failed to Create ACDCLientX.ocx you may need to reinstall the product - Fatal Error!";
        return false;

    }
    m_bControlInit = true;
    // make sure xml parser is available 
    try
    {
        MSXML2::IXMLDOMDocumentPtr pDOMDoc(__uuidof(MSXML2::DOMDocument));
    }
    catch(_com_error e)
    {
        m_strError = "Msxml3.dll required for this application. You may need to reinstall the product - Fatal Error!";
        return false;
    }
    return true;

}



#pragma warning(disable:4786)

std::string CClientWrapper::GetIPAddressFromHostName(const std::string& Ip)
{
    std::string rv;
    USES_CONVERSION;
    _bstr_t strIp(Ip.c_str());
    try
    {
        rv = W2T(m_pClient->GetIPAddressFromHostName(strIp,m_nDialogControl));
    }
    catch(const _com_error &e)
    {
        throw e;
    }

    return rv;
}

bool CClientWrapper::DoServerIp(const std::vector<std::string>& IpList)
{
    std::vector<std::string>::const_iterator i;
    USES_CONVERSION;
    assert(m_bComInit && m_bControlInit);
    ////
    ////
    try          
    {               
        std::string IpStore("");
        i = IpList.begin();
        while(i != IpList.end())
        {
            std::string Ip = *i;
            if(!Ip.length() )
            {
                ++ i;
                continue;
            }
            if(!LooksLikeIp(Ip) )
            {
                std::string  xml = GetIPAddressFromHostName(Ip);
                if(GetIPFromXML(xml,Ip) )
                {
                    AddToStore(IpStore,Ip);
                }
            }
            else
            {
                AddToStore(IpStore,Ip);
            }
            ++ i;
        }
        if(!IpStore.length())
        {
            m_strError = "No Resolved Ip Address.";
            return false;
        }
        _bstr_t strIpStore(IpStore.c_str());
        std::string  xml = W2T(m_pClient->ServerIPConfig(strIpStore,m_nDialogControl));
        if(GetNumIPStoredIPFromXML(xml) <= 0 )
        {
            m_strError = "No Resolved Ip Address.";
            return false;
        }

        //defaults to 10 seconds connect - 300 seconds response 
        #ifdef _DEBUG
            ASSERT(m_pClient->SetConnectTimeout(5) == 5);
        #else
            m_pClient->SetConnectTimeout(5);
        #endif
        //  VERIFY(m_pClient->SetConnectTimeout(5) == 5);
        //VERIFY(m_pClient->SetResponseTimeout(300) == 300);
        // you may wish to 'ping' the servers at this point
        // using PingStoredServerList(..)
        // or you could ping each before you store the ServerIpConfig(..)
        // using PingServer(..)
        // it is up to you whether you want your 
        // app not to start or give some other message because a server is down
        // if you decide not to ping AND the Server is DOWN when you attempt
        // an authorization the control will return an appropriate error. 

    }
    catch (const _com_error &ComError)
    {               
        m_strError = ComError.ErrorMessage() + std::string(" Fatal Error!");
        return false;

    }
    catch (...)
    {
        m_strError = "ATL/COM Error" + std::string(" Fatal Error!");
        return false;

    }
    char nameBuffer[101] = {0};
    DWORD size = 100;
    if(::GetUserName(nameBuffer,&size) )
        m_strName = nameBuffer;

    return true;

}

bool CClientWrapper::LooksLikeIp(const std::string IPorHostName)
{

    std::map<int,std::string> Map;
    std::map<int,std::string>::const_iterator iter;
    const std::string& s = IPorHostName;
    int x(0),len = s.length();
    char c,fsep = '.';
    std::string fieldText;
    int NumOctets (0);
    while(x < len)
    {
        c = s[x];
        if(c != fsep)
            fieldText += c;
        else
        {
            Map[NumOctets++]=fieldText;
            fieldText = "";
        }
        x++;
    }
    if(fieldText.length() )
        Map[NumOctets++]=fieldText;


    if(NumOctets != 4)
        return false;

    for(x = 0; x < 4 ; x ++ )
    {
        std::string octect;
        if((iter = Map.find(x))==Map.end() )
            return false;
        octect = (*iter).second;
        int val = _ttoi(octect.c_str());
        if(val == 0 )
        {
            //octect.TrimLeft();
            int len = octect.length();
            std::string temp("");
            for(int xx= 0; xx < len ; xx ++ )
            {
                char c = octect[xx];
                if(temp.length() || c != ' ' )
                {
                    temp += c;
                }
            }
            octect = temp;
            if(!octect.length() || octect[0] < 0x30 || octect[0] > 0x39)
                return false;
        }
        if(val < 0 || val > 255)
            return false;
    }
    return true;

}

bool CClientWrapper::GetIPFromXML(const std::string XML,std::string& Ip)
{

    USES_CONVERSION;
    try
    {
        _bstr_t strXML (XML.c_str());   
        MSXML2::IXMLDOMDocumentPtr pDOMDoc(__uuidof(MSXML2::DOMDocument));
        VARIANT_BOOL  varResult = pDOMDoc->loadXML(strXML);
        // any error is bad 
        if (VARIANT_FALSE == varResult)
            return false;
        MSXML2::IXMLDOMNodePtr pNode = pDOMDoc->selectSingleNode("//CmdStatus");
        if(0 == pNode )
            return false;
        std::string Result = W2T(pNode->Gettext() );
        if("Success" != Result)
            return false;
        pNode = pDOMDoc->selectSingleNode("//IpAddress");
        if(0 == pNode )
            return false;
        Ip = W2T(pNode->Gettext());
        return true;
    }
    catch(_com_error e)
    {
        #ifdef _DEBUG
        std::cerr << std::string("Caught Exception: GetIPFromXML") << std::endl;
        #endif
    }
    catch(...)
    {
        #ifdef _DEBUG
        std::cerr << std::string("Caught Exception: GetIPFromXML") << std::endl;
        #endif

    }
    return false;



}


void CClientWrapper::AddToStore(std::string & s,const std::string& ip)
{
    // if ip is empty ignore it 
    if(!ip.length() )
        return;
    // if the store is not empty it is ';' separated
    if(s.length() )
        s += std::string(";") + ip;
    else
        s = ip;

}


int CClientWrapper::GetNumIPStoredIPFromXML(const std::string XML)
{
    USES_CONVERSION;
    try
    {
        _bstr_t strXML (XML.c_str());   
        MSXML2::IXMLDOMDocumentPtr pDOMDoc(__uuidof(MSXML2::DOMDocument));
        VARIANT_BOOL  varResult = pDOMDoc->loadXML(strXML);
        // any error is bad 
        if (VARIANT_FALSE == varResult)
            return 0;
        MSXML2::IXMLDOMNodePtr pNode = pDOMDoc->selectSingleNode("//CmdStatus");
        if(0 == pNode )
            return 0;
        std::string Result = W2T(pNode->Gettext() );
        if("Success" != Result)
            return 0;
        pNode = pDOMDoc->selectSingleNode("//TextResponse");
        if(0 == pNode )
            return 0;
        return _ttoi(W2T(pNode->Gettext() ) );

    }
    catch(_com_error e)
    {
        #ifdef _DEBUG
        std::cerr << std::string("Caught Exception: GetNumIPStoredIPFromXML") << std::endl;
        #endif
    }
    catch(...)
    {
        #ifdef _DEBUG
        std::cerr << std::string("Caught Exception: GetNumIPStoredIPFromXML") << std::endl;
        #endif
    }
    return 0;


}







std::string CClientWrapper::BuildErrorResponse(const _com_error ComError)
{
    std::stringstream ssErrNo;
    ssErrNo << ComError.Error();


    return BuildErrorResponse(ssErrNo.str(), ComError.ErrorMessage());

}
std::string CClientWrapper::BuildErrorResponse(const std::string ErrNo, const std::string strErrText)
{
    return BuildErrorResponse(_ttoi(ErrNo.c_str()),  strErrText);
}
std::string CClientWrapper::BuildErrorResponse(const int ErrNo, const std::string strErrText)
{
#define TAB "\t"
#define CRLF "\r\n"

    std::ostringstream oss;
    oss <<  "<?xml version=\"1.0\"?>"CRLF
            "<RStream>"CRLF
            TAB "<CmdResponse>"CRLF
            TAB TAB "<ACDXReturnCode>"
        << std::setw(6) << std::setfill('0') << ErrNo
        <<  "</ACDXReturnCode>"CRLF
            TAB TAB "<CmdStatus>Error</CmdStatus>"CRLF
            TAB TAB "<TextResponse>"
        << strErrText.c_str()
        <<  "</TextResponse>"CRLF
            TAB "</CmdResponse>"CRLF
            "</RStream>"CRLF
        << std::endl;
    std::string rv(oss.str());
    return rv;
}








std::string CClientWrapper::PingStoredServerListReturnXML()
{
    USES_CONVERSION;
    std::string rv;
    try
    {
        rv = W2T(m_pClient->PingStoredServerList("",m_nDialogControl) );
    }
    catch (const _com_error &ComError)
    {   
        rv = BuildErrorResponse(ComError);
    }
    catch (...)
    {
        rv = BuildErrorResponse(WRAP_ERROR,"ATLCOM ERROR");
    }
    return rv;


}





void CClientWrapper::Cancel()
{
    try
    {
        m_pClient->CancelRequest();
    }
    catch (const _com_error &ComError)
    {   
        std::string s = BuildErrorResponse(WRAP_ERROR,ComError.ErrorMessage() );
        #ifdef _DEBUG
        std :: cerr << s << std::endl;
        #endif
    }
    catch (...)
    {
        std::string s = BuildErrorResponse(WRAP_ERROR,"ATLCOM ERROR");
        #ifdef _DEBUG
        std :: cerr << s << std::endl;
        #endif

    }

}

CParsedResponse  CClientWrapper::SendRequest(const std::string strXML)
{
    return ExtractTransResponse(SendRequestReturnXML(strXML) );
}

std::string CClientWrapper::SendRequestReturnXML(const std::string strXML)
{
    USES_CONVERSION;
    std::string rv;

    try
    {
        _bstr_t strXml(strXML.c_str());
        _bstr_t strPasswd(m_strServerPassword.c_str());
        _bstr_t strName(m_strName.c_str());
        rv = W2T(m_pClient->ProcessTransaction(
                                        strXml,
                                        m_nDialogControl,
                                        strPasswd,
                                        strName) );
    }
    catch (const _com_error &ComError)
    {   
        rv = BuildErrorResponse(WRAP_ERROR,ComError.ErrorMessage() );
    }
    catch (...)
    {
        rv = BuildErrorResponse(WRAP_ERROR,"ATLCOM ERROR");
    }
    return rv;
}




CParsedResponse CClientWrapper::ExtractTransResponse(const std::string XmlResponse)
{
    CParsedResponse rv;
    USES_CONVERSION;
    try
    {
        _bstr_t strXML (XmlResponse.c_str());   
        MSXML2::IXMLDOMDocumentPtr pDOMDoc(__uuidof(MSXML2::DOMDocument));
        VARIANT_BOOL  varResult = pDOMDoc->loadXML(strXML);
        if (VARIANT_FALSE == varResult)
        {
            MSXML2::IXMLDOMParseErrorPtr pParseError = pDOMDoc->GetparseError();
            long dwError = pParseError->GeterrorCode();
            _bstr_t bstrReason = pParseError->Getreason();
            long num = pParseError->Getline();
            std::ostringstream oss;
            std::string strReason = W2T(bstrReason);
            oss << "XML Parse Error at line#:" << num << "\r\n" << strReason << std::endl;
            std::string error (oss.str() );

            rv.m_strErrorNo  = WRAP_ERROR;
            rv.m_strVerbage    = error;
            rv.m_bIsError = true;
            return rv;

        }
        MSXML2::IXMLDOMNodePtr pNode = pDOMDoc->selectSingleNode("//TextResponse");
        if(pNode)
        {
            rv.m_strVerbage = W2T(pNode->Gettext() );
        }
        pNode = pDOMDoc->selectSingleNode("//Balance");
        if(pNode)
        {
            rv.m_strBalance = W2T(pNode->Gettext() );
        }
        pNode = pDOMDoc->selectSingleNode("//PrePaidExp");
        if(pNode)
        {
            rv.m_strPrePaidExp = W2T(pNode->Gettext() );
        }

        pNode = pDOMDoc->selectSingleNode("//ResponseOrigin");
        if(pNode)
        {
            rv.m_strOrigin = W2T(pNode->Gettext() );
        }
        pNode = pDOMDoc->selectSingleNode("//ACDXReturnCode");
        if(pNode)
        {
            rv.m_strErrorNo = W2T(pNode->Gettext() );
        }               

        pNode = pDOMDoc->selectSingleNode("//CmdStatus");
        if(pNode)
        {
            std::string strText;
            strText = W2T(pNode->Gettext() );
            if("Approved" == strText ) 
            {
                rv.m_bIsApproved = true;                
                rv.m_strVerbage = "APPROVED";
                pNode = pDOMDoc->selectSingleNode("//AuthCode");
                if(pNode)
                {
                    rv.m_strAuthCode = W2T(pNode->Gettext());
                }
                pNode = pDOMDoc->selectSingleNode("//CaptureStatus");
                if(pNode)
                {
                    #if defined(__USING__MFC)
                    if("Captured" == CString(W2T(pNode->Gettext()) )  )
                    #else
                    if("Captured" == std::string(W2T(pNode->Gettext()) )  )
                    #endif  
                    {
                        rv.m_bIsCaptured = true;

                    }
                }       
                pNode = pDOMDoc->selectSingleNode("//RefNo");
                if(pNode)
                {
                    rv.m_strReferenceNo = W2T(pNode->Gettext());
                }
                pNode = pDOMDoc->selectSingleNode("//AccountNo");
                if(pNode)
                {
                    rv.m_strAcctNo   = W2T(pNode->Gettext()); 
                }       
                pNode = pDOMDoc->selectSingleNode("//ExpDate");
                if(pNode)
                {
                    rv.m_strExpDate   = W2T(pNode->Gettext());              
                }       
                pNode = pDOMDoc->selectSingleNode("//Purchase");
                if(pNode)
                {
                    rv.m_strPurchaseAmount  = W2T(pNode->Gettext());
                }       

                pNode = pDOMDoc->selectSingleNode("//InvoiceNo");
                if(pNode)
                {
                    rv.m_strInvoiceNo  = W2T(pNode->Gettext());
                }       
                pNode = pDOMDoc->selectSingleNode("//OperatorId");
                if(pNode)
                {
                    rv.m_strOpId  = W2T(pNode->Gettext());
                }       
                pNode = pDOMDoc->selectSingleNode("//AcqRefData");
                if(pNode)
                {
                    rv.m_strAcqRefData  = W2T(pNode->Gettext());
                }       

            }
            else if("Declined" == strText)
            {
                rv.m_bIsApproved = false;
                rv.m_bIsCaptured = false;
            }
            else  if("Success" == strText )
            {
                rv.m_bIsSuccess  =true;
            }
            else    if("Error" == strText )
            {
                rv.m_bIsError       =  true;
            }

            else
            {
                rv.m_strVerbage = "Received Invalid Result from ACDClientX Control.- \r\n"+ XmlResponse;
                rv.m_strErrorNo  = WRAP_ERROR;  
            }

        }
    }
    catch(_com_error e)
    {
        #ifdef _DEBUG
        std::cerr<< std::string("Caught Exception: ExtractTransResponse")<< std::endl;
        #endif
        rv.m_strErrorNo = WRAP_ERROR;
        rv.m_strVerbage = e.ErrorMessage();
        rv.m_bIsError       = true;

    }
    catch(...)
    {
        #ifdef _DEBUG
        std::cerr<< std::string("Caught Exception: ExtractTransResponse")<< std::endl;
        #endif
        rv.m_strErrorNo = WRAP_ERROR;
        rv.m_strVerbage = "Msxml3 Open Error";
        rv.m_bIsError      = true;
    }
    return rv;
}

CParsedResponse CClientWrapper::PingStoredServerList()
{
    return ExtractTransResponse(PingStoredServerListReturnXML() );

}

int CClientWrapper::SetResponseTimeout(const int t)
{
    USES_CONVERSION;
    int rv;
    try
    {
        rv = m_pClient->SetResponseTimeout(t);
    }
    catch (const _com_error &ComError)
    {   
        m_strError = BuildErrorResponse(WRAP_ERROR,ComError.ErrorMessage() );
        rv = -1;
    }
    catch (...)
    {
        m_strError = BuildErrorResponse(WRAP_ERROR,"ATLCOM ERROR");
        rv = -1;
    }
    return rv;

}

int CClientWrapper::SetConnectTimeout(const int t)
{
    USES_CONVERSION;
    int rv;
    try
    {
        rv = m_pClient->SetConnectTimeout(t);
    }
    catch (const _com_error &ComError)
    {   
        m_strError = BuildErrorResponse(WRAP_ERROR,ComError.ErrorMessage() );
        rv = -1;
    }
    catch (...)
    {
        m_strError = BuildErrorResponse(WRAP_ERROR,"ATLCOM ERROR");
        rv = -1;
    }
    return rv;

}

acdclientx.tlh

#pragma once
#pragma pack(push, 8)

#include <comdef.h>

namespace ACDCLIENTXLib {

//
// Forward references and typedefs
//

struct __declspec(uuid("87476f1d-9a0f-4e4e-bd38-0378b35d71b8"))
/* LIBID */ __ACDCLIENTXLib;
struct __declspec(uuid("4ff86764-9448-4e1d-a160-4e55c7151c3d"))
/* dispinterface */ _DACDCLientX;
struct __declspec(uuid("fd6514db-1fa1-43c2-982a-9bf3a4f63c71"))
/* dispinterface */ _DACDCLientXEvents;
struct /* coclass */ ACDCLientX;

//
// Smart pointer typedef declarations
//

_COM_SMARTPTR_TYPEDEF(_DACDCLientX, __uuidof(_DACDCLientX));
_COM_SMARTPTR_TYPEDEF(_DACDCLientXEvents, __uuidof(_DACDCLientXEvents));

//
// Type library items
//

struct __declspec(uuid("4ff86764-9448-4e1d-a160-4e55c7151c3d"))
_DACDCLientX : IDispatch
{
    //
    // Wrapper methods for error-handling
    //

    // Methods:
    _bstr_t ProcessTransaction (
        _bstr_t XMLCommand,
        short ProcessControl,
        _bstr_t ClientServerPassword,
        _bstr_t UserTraceData );
    _bstr_t ServerIPConfig (
        _bstr_t HostList,
        short ProcessControl );
    _bstr_t PingStoredServerList (
        _bstr_t IpPort,
        short ProcessControl );
    long CancelRequest ( );
    _bstr_t GetIPAddressFromHostName (
        _bstr_t HostName,
        short ProcessControl );
    _bstr_t PingServer (
        _bstr_t IpAddress,
        _bstr_t IpPort,
        short ProcessControl );
    short SetConnectTimeout (
        short TimeoutSec );
    short SetResponseTimeout (
        short TimeoutSec );
    _bstr_t ProcessCanadianTransaction (
        _bstr_t XMLCommand,
        short ProcessControl,
        _bstr_t ClientServerPassword,
        _bstr_t UserTraceData );
};

struct __declspec(uuid("fd6514db-1fa1-43c2-982a-9bf3a4f63c71"))
_DACDCLientXEvents : IDispatch
{};

struct __declspec(uuid("d76e402e-c138-4480-a8a3-bc840d6a2a4e"))
ACDCLientX;
    // [ default ] dispinterface _DACDCLientX
    // [ default, source ] dispinterface _DACDCLientXEvents

//
// Wrapper method implementations
//

#include "acdclientx.tli"

} // namespace ACDCLIENTXLib

#pragma pack(pop)

acdclientx.tli

#pragma once

//
// dispinterface _DACDCLientX wrapper method implementations
//

inline _bstr_t _DACDCLientX::ProcessTransaction ( _bstr_t XMLCommand, short ProcessControl, _bstr_t ClientServerPassword, _bstr_t UserTraceData ) {
    BSTR _result = 0;
    _com_dispatch_method(this, 0x1, DISPATCH_METHOD, VT_BSTR, (void*)&_result, 
        L"\x0008\x0002\x0008\x0008", (BSTR)XMLCommand, ProcessControl, (BSTR)ClientServerPassword, (BSTR)UserTraceData);
    return _bstr_t(_result, false);
}

inline _bstr_t _DACDCLientX::ServerIPConfig ( _bstr_t HostList, short ProcessControl ) {
    BSTR _result = 0;
    _com_dispatch_method(this, 0x2, DISPATCH_METHOD, VT_BSTR, (void*)&_result, 
        L"\x0008\x0002", (BSTR)HostList, ProcessControl);
    return _bstr_t(_result, false);
}

inline _bstr_t _DACDCLientX::PingStoredServerList ( _bstr_t IpPort, short ProcessControl ) {
    BSTR _result = 0;
    _com_dispatch_method(this, 0x3, DISPATCH_METHOD, VT_BSTR, (void*)&_result, 
        L"\x0008\x0002", (BSTR)IpPort, ProcessControl);
    return _bstr_t(_result, false);
}

inline long _DACDCLientX::CancelRequest ( ) {
    long _result = 0;
    _com_dispatch_method(this, 0x4, DISPATCH_METHOD, VT_I4, (void*)&_result, NULL);
    return _result;
}

inline _bstr_t _DACDCLientX::GetIPAddressFromHostName ( _bstr_t HostName, short ProcessControl ) {
    BSTR _result = 0;
    _com_dispatch_method(this, 0x5, DISPATCH_METHOD, VT_BSTR, (void*)&_result, 
        L"\x0008\x0002", (BSTR)HostName, ProcessControl);
    return _bstr_t(_result, false);
}

inline _bstr_t _DACDCLientX::PingServer ( _bstr_t IpAddress, _bstr_t IpPort, short ProcessControl ) {
    BSTR _result = 0;
    _com_dispatch_method(this, 0x6, DISPATCH_METHOD, VT_BSTR, (void*)&_result, 
        L"\x0008\x0008\x0002", (BSTR)IpAddress, (BSTR)IpPort, ProcessControl);
    return _bstr_t(_result, false);
}

inline short _DACDCLientX::SetConnectTimeout ( short TimeoutSec ) {
    short _result = 0;
    _com_dispatch_method(this, 0x7, DISPATCH_METHOD, VT_I2, (void*)&_result, 
        L"\x0002", TimeoutSec);
    return _result;
}

inline short _DACDCLientX::SetResponseTimeout ( short TimeoutSec ) {
    short _result = 0;
    _com_dispatch_method(this, 0x8, DISPATCH_METHOD, VT_I2, (void*)&_result, 
        L"\x0002", TimeoutSec);
    return _result;
}

inline _bstr_t _DACDCLientX::ProcessCanadianTransaction ( _bstr_t XMLCommand, short ProcessControl, _bstr_t ClientServerPassword, _bstr_t UserTraceData ) {
    BSTR _result = 0;
    _com_dispatch_method(this, 0x9, DISPATCH_METHOD, VT_BSTR, (void*)&_result, 
        L"\x0008\x0002\x0008\x0008", (BSTR)XMLCommand, ProcessControl, (BSTR)ClientServerPassword, (BSTR)UserTraceData);
    return _bstr_t(_result, false);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:22:55+00:00Added an answer on May 31, 2026 at 11:22 am

    Found the answer in:
    http://support.microsoft.com/kb/146120/EN-US

    Needed to define this function in my ActiveX Control

    BOOL CMyOleControl::IsInvokeAllowed (DISPID)
    {
       // You can check to see if COleControl::m_bInitialized is FALSE
      // in your automation functions to limit access.
      return TRUE;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several (old) Drupal-sites that need to be replaced with one single new
We need to replace the menu system in our main ASP.NET application. So naturally
I need to replace one of the pre-defined window classes all across Windows. For
I have to use 13 Preferences in my application. I have 13 buttons for
I have a string. In this string i need replace all special characters (0-31
I need to replace a simple string in a minified .js file after a
Good day. I could really use your help on this one. I have a
We have an existing certificate issuing application (C#, ASP.NET, JavaScript) that issues certificates to
I have a html file need to refresh every 10 seconds, so I have
I need replace slide effect to fade-out/fade-in effect on the prev and next slide

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.