Jump to content

UniGUI + COMConnection


byjk

Recommended Posts

Можно ли как ни будь связать сервер uniGUI с com-объектом?

я попробовал создавать  com объект в TUniMainModule:

  TUniMainModule = class(TUniGUIMainModule)
    COMConnection: TDCOMConnection;
  private
     ComServer: OleVariant;
.....
 
procedure TUniMainModule.SomeInit;
begin
    CoInitialize(nil);
    COMConnection.Connected := true;
    ComServer := COMConnection.GetServer;
    ComServer.Somefunction()....
....
end;
    
При таком раскладе я ожидал что переменная ComServer будет содержать ссылку на com-объект и я смогу его вызывать при следующих вызовах, но это не так -  сам ком-объект сразу освобождается после обработки веб-запроса - почему? 
можно ли как либо хранить ссылки на ком-объекты в сессии?
 
 
Link to comment
Share on other sites

Не, так с сом-ом не выйдет.

Для каждого эвента в unigui создается отдельный поток.

Причем одних и тех-же эвентов может одновременно в одной сессии выполняться несколько.

Link to comment
Share on other sites

Сделай отдельный закольцованый thread а в нем уже com объект и общайся через этот thread.

Так com объект не сдохнет.

Только сделай все thread-safe через блокировку или очередь.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...