Results 1 to 2 of 2

Thread: IntraWeb Application dropping COM objects-Slightly of topic

  1. #1

    IntraWeb Application dropping COM objects-Slightly of topic

    Hello there,

    i'm currently writing an intraweb application and plan on having external COM objects for most of the processing. The problem is that the COM object is dropped as soon as the calling procedure is exited even though the COM object is declared in the user sessions data module ( not locally in the calling procedure ), I have tested the COM object in a normal windows application and the connection is retained until programmatically dropped.

    Does anyone know of a way to make a session wide connection to a COM object.

    The code im using is below

    type
    TdtmMain = class(TDataModule)
    procedure DataModuleDestroy(Sender: TObject);
    procedure DataModuleCreate(Sender: TObject);
    private
    FCOMObject: ICOMObject;
    protected
    public
    property COMObject: ICOMObject read FCOMObject;
    end;

    function dtmMain: TdtmMain;

    implementation

    uses ServerController, IWInit, ComObj, Variants;

    {$R *.dfm}

    function dtmMain: TdtmMain;
    begin
    Result := TUserSession(RWebApplication.Data).Data;
    end;

    procedure TdtmMain.DataModuleCreate(Sender: TObject);
    begin
    //all data access is to be done through this interface
    if not Assigned(COMObject) then
    begin
    FCOMObject:= CoCOMObject.Create;
    Assert(Assigned(COMObject),'Unable to create instance of ICOMObject');
    end;
    end;

    procedure TdtmMain.DataModuleDestroy(Sender: TObject);
    begin
    COMObject := nil;
    end;

    Many thanks

    Mark
    Cheers
    <br />
    <br />Mark

  2. #2

    IntraWeb Application dropping COM objects-Slightly of topic

    Hi there,

    I compiled it as an ISAPI dll and ran it through IIS and it works. So the problem appears to be in the standalone version only.

    Cheers

    Mark
    Cheers
    <br />
    <br />Mark

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •