![]() |
Calling an COM object from Delphi
Hey!
Is there a article about this that shows how you create a com object from imported type library in delphi?An example would be great. |
Re: Calling an COM object from Delphi
|
Re: Calling an COM object from Delphi
Ok so is this proper COM i really couldn't find an existing delphi example so i decided to port some c++ code but i guess it didnt go well.I am really tired from all this 5 hours for 1 example i am trying to compile :wall: :wall:
Delphi-Quellcode:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleServer, WINSATLib_TLB, StdCtrls,comobj, ComCtrls,activex, ExtCtrls ; Type TMyCallback = class (TComObject,IWInSatInitiateEvents) function WinSATComplete(hresult: HResult; strDescription: PWideChar): HResult; stdcall; function WinSATUpdate(uCurrentTick: longword; uTickTotal: longword; strCurrentState: PWideChar): HResult; stdcall; constructor Create; end; var Form2: TForm2; i:IWinSATInitiateEvents; k:_RemotableHandle; progresposition:integer; icurrent,itotal:longword; t:tmycallback; sa:string; function TMyCallback.WinSATComplete(hresult: HResult; strDescription: PWideChar): HResult; stdcall; begin if Succeeded(hresult) then result:=strtoint(strDescription) else showmessage(strDescription); end; function TMyCallback.WinSATUpdate(uCurrentTick: longword; uTickTotal: longword; strCurrentState: PWideChar): HResult; stdcall; var Assesment:^IInitiateWinSATAssessment; hr:HRESULT; begin if uticktotal>0 then begin progresposition:=100*ucurrentTick div utickTotal; result:=s_ok; Assesment:=nil; CoInitializeEx(nil, COINIT_APARTMENTTHREADED); OleCheck(CoCreateInstance( Class_CInitiateWinSAT, nil, CLSCTX_INPROC_SERVER, IInitiateWinSATAssessment, Assesment)); if FAILED(hr) then showmessage('Failed to create an instance of IInitiateWinSATAssessment. Failed with '); end; end; |
Re: Calling an COM object from Delphi
We told you, to wait for the end of the 24Hour span! And we also announced to close threads you open regarding the same problem.
It seems that you're not willing to understand/recognize our warnings! * * * CLOSED * * * |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:51 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz