none
Sluggish COM Interop with Delphi 7 app RRS feed

  • Question

  • I am writing an app in C# VS 2005 using COM Interop to control an application written in Delphi 7.

    The setting of properties through the COM Interface is extremely sluggish.  Just to set an int property in the interface can take up to 5 seconds or more for the line of code to execute.

    Does anyone have any suggestions for speeding this up?

    I am getting the COM RCW by adding a reference to a COM object though the "Add Reference" menu.

    Then here is an example of my code.
     
    Tabular.TabularReporterClass tc = new TabularReporterClass(); 
     
    //Waiting for Tabular Reporter to create itself 
    while (tc.TabularState != TabularState.Idle) 
       Application.DoEvents(); 
     
    //this statement can take a really long time like 5 seconds 
    tc.ReportTemplate = @"C:\Report Templates\Test_Report.rta"
     
    tc.GenerateReport(@"c:\temp\tabReporter_test.xml"); 
     
    //wait while the report is generating 
    while (tc.TabularState == TabularState.Generating_Report) 
                            Application.DoEvents(); 
     
    //this line takes a really long time like 5-7 sec 
    int reportID = tc.ReportID; 
     
    //force Tabular Reporter to call its destructor, also takes a really long time 
    tc.KeepAlive = 0; 
     
    Marshal.ReleaseComObject(tc); 
     

    Does anybody have any suggestions or can think of any reasons why getting and setting some int & string properties is taking so long?

    I think that I may have to end up refectoring my delphi7 app to accept parameters so I can do what I am doing with Processes.

    thanks
    Friday, May 30, 2008 1:23 PM

Answers

  • That's a Really Long Time for COM Interop, something is drastically wrong.  This Delphi app, is it an .exe or a .dll?  Try using SysInternals' ProcMon utility to see what is happening.
    Hans Passant.
    • Marked as answer by Bruno Yu Wednesday, June 4, 2008 5:55 AM
    Saturday, May 31, 2008 5:32 AM
    Moderator