0

Hi there everyone...

Allright my setting is this:

I have written an C++ application that receives input from a user app, converts it to XML, and then posts it to our ERP (Syspro) through e.net COM objects using ActiveQt and in specific QAxObject...

The problem is this:

QAxObject inherits from QAxbase, which has the following signal according to its documentation:

void QAxBase::exception ( int code, const QString & source, const QString & desc, const QString & help ) [signal]

This signal is emitted when the COM object throws an exception while called using the OLE automation interface IDispatch. code, source, desc and help provide information about the exception as provided by the COM server and can be used to provide useful feedback to the end user. help includes the help file, and the help context ID in brackets, e.g. "filename [id]".

Very nice and all... now I have a few structs, each accessing a different COM Object and having different commands, but when I generate an exception (deliberately at present) in attempt to cause that signal to be emitted I immediately get the app crash and message "Access Violation Reading Location"

Here follow the specified coding blocks that should be accessed:

Header file:

Structs:

typedef struct Transaction_Struct{

    Transaction_Struct(XmlParserCLS* XmlCreatorMaster, LogWriter * LogsWriterMaster);                   //Constructor
    ~Transaction_Struct();

    XmlParserCLS* XmlCreator;                                           //Pointer to the XMLParserCLS

    LogWriter * LogsWriter;

    QAxObject* Transaction;                                             //QAxObject Pointer to the COM Object

    QDomDocument post           (QMap<QString, QString>& VariableMap);   //Transaction Post call and handling
    QDomDocument build          (QMap<QString, QString>& VariableMap);   //Transaction Build call and handling

} SysproTransaction;

typedef struct Utillity_Struct{

    Utillity_Struct(XmlParserCLS* XmlCreatorMaster, LogWriter * LogsWriterMaster);                  //Constructor
    ~Utillity_Struct();

    XmlParserCLS* XmlCreator;                                           //Pointer to the XMLParserCLS

    LogWriter * LogsWriter;                                             //Pointer to the LogWriter

    QAxObject* Utillities;                                              //QAxObject Pointer to the COM Object

    bool logon                  (QMap<QString, QString>& VariableMap);   //Utillities Logon call and handling
    void getLogonProfile        (QMap<QString, QString>& VariableMap);   //Utillities GetLogonProfile call and handling
    void loggoff                (QMap<QString, QString>& VariableMap);   //Utillities Loggoff call and handling

    bool mEOCreated;
    QString mQueueType;
    QString mApplicationName;

    EasyObjectCLS* Easy;

    void setValues(EasyObjectCLS* EasyObj, const QString& Queue, const QString& AppName, bool& mEOCreated);

} SysproUtillities;

Slot:

private slots:
    void                callHelp                    ();
    void                outputLogError              (int num, const QString& one, const QString& two, const QString& three);

SourceFile:

Connections:

...
    connect(Transaction->Transaction,   SIGNAL(exception(int, const QString&, const QString&, const QString&)), this, SLOT(outputLogError(int, const QString&, const QString&, const QString&)));
    connect(Utillities->Utillities,     SIGNAL(exception(int, const QString&, const QString&, const QString&)), this, SLOT(outputLogError(int, const QString&, const QString&, const QString&)));
}

Functionality accessed:

        //Loggs onto Syspro
        Utillities->logon(VariableMap);

        qDebug() << "Logged on" << endl;


        //LogsWriter->writeAppLog("Posting through Transaction");
        //qDebug() << "Posting through Transaction" << endl;

        //Posts the change
        Transaction->post(VariableMap);

Post Function:

...::SysproTransaction::post(QMap<QString,QString> &VariableMap){

    qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << "Transaction Post Called: " << VariableMap["UserId"] << VariableMap["businessObject"] << endl;

    //Calls the e.net function of the QAxObject and retrieves an output
    QString OutputString = Transaction->dynamicCall("Post(QString&, QString&, QString&, QString&)", VariableMap["UserId"], VariableMap["businessObject"], VariableMap["XMLParam"], "BEH"/*VariableMap["XMLIn"]*/).toString();

    qDebug() << "Called: " << OutputString << endl;

    system("pause");
...

Slot:

...::outputLogError(int num, const QString& one, const QString& two, const QString& three){

    qDebug() << "Starting outputLogError" << endl;

    system("pause");
...
...

I apologize but due to confidentiallity I am not really at liberty to reveal any more...

My output shows up to the line just before "QString OutputString = Transaction->dynamicCall..."

At this point the "connect(Transaction->Transaction, SIGNAL(exception(int, const QString&, const QString&, const QString&)), this, SLOT(outputLogError(int, const QString&, const QString&, const QString&)));" should call the slot which should give me output and pause, but instead I get the app crash mentioned above... is there any help that can be given?

Thankyou all in advance

1
Contributor
1
Reply
3
Views
5 Years
Discussion Span
Last Post by Eagletalon
0

Hi everyone... I have found the cause...

In my constructer of the structs I called a function "disableMetaObject" which did not allow any of the Qt signals to be sent... and then my QAxObject wanted to load a void QVariant into a QString

so in short... dont call "disableMetaObject" when working with signals and catching QAxBase::exception signals...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.