Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using .tlb file in my project
Forum Updated to NodeBB v4.3 + New Features

Using .tlb file in my project

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ivan1120
    wrote on last edited by
    #1

    Hello, everyone. I build a .tlb from my dll using "RegAsm" tool. Following is my part of code about dll.

    @
    public interface IMyTIBusAdapters
    {
    MyIAdapterResult MyI2C_Write(int adapter_num, byte addr, byte command, byte[] data);
    int MyDiscover();
    MyIReadblockResult MyI2C_Read(int adpater_num, byte addr, byte command, int len);
    MyIReadblockResult MyI2C_Read_Generic_No_Restart(int adpater_num, byte addr, int len);
    }
    @
    Then, I write Qt to call them like following
    .pro file
    @
    QT += core gui axcontainer

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = IBM300WDebugTool
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp
    tifortlbincsharpdll.cpp
    TYPELIBS += $$system(dumpcpp output TIforTLBinCSharpDLL.tlb)
    HEADERS += mainwindow.h
    tifortlbincsharpdll.h

    FORMS += mainwindow.ui
    @

    WORKER.cpp

    @
    MyTIBusAdapters *myTIbus; = new MyTIBusAdapters;
    MyIAdapterResult *myTIWriteResult = new MyIAdapterResult();
    int TIBusAddress = myTIbus->MyDiscover();
    if(TIBusAddress == 0)
    QMessageBox::about(this,"Warning...","Can't find TI device, please check and restart application. ");
    myTIWriteResult = myTIbus->MyI2C_Write(TIBusAddress,(unsigned char)DeviceAddr[0],(unsigned
    char)Command[0],requestData);
    if(myTIWriteResult->isSuccess())
    ui->textEdit->append("Write Successful.");
    else
    ui->textEdit->append("Write failed.");
    @

    The problem is when I run on my computer, everything is OK.When I run on other computers, application could be open, but when I start following function, i would got unknown error, then my program is crashed.I found if I comment following program, this application also could work on different computers, I don't know what happen to this.

    @
    //myTIWriteResult = myTIbus->MyI2C_Write(TIBusAddress,(unsigned char)DeviceAddr[0],(unsigned
    //char)Command[0],requestData);
    @

    If I write program like follows, it still could run on other computers. but unfortunate, I need the response from follows.

    @
    myTIbus->MyI2C_Write(TIBusAddress,(unsigned char)DeviceAddr[0],(unsigned char)Command[0],requestData);
    @

    Does anyone know what's wrong?? Thanks in advance.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Ivan1120
      wrote on last edited by
      #2

      Hi, does anybody know??

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved