AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Calling an COM object from Delphi
Thema durchsuchen
Ansicht
Themen-Optionen

Calling an COM object from Delphi

Ein Thema von Razor · begonnen am 6. Okt 2009 · letzter Beitrag vom 6. Okt 2009
Thema geschlossen
Razor
(Gast)

n/a Beiträge
 
#1

Calling an COM object from Delphi

  Alt 6. Okt 2009, 08:33
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.
 
Benutzerbild von Sherlock
Sherlock
Online

Registriert seit: 10. Jan 2006
Ort: Offenbach
3.764 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: Calling an COM object from Delphi

  Alt 6. Okt 2009, 08:43
Here you are:

http://delphi.about.com/od/comoleact...ledge_base.htm

Sherlock
Oliver
 
Razor
(Gast)

n/a Beiträge
 
#3

Re: Calling an COM object from Delphi

  Alt 6. Okt 2009, 17:00
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

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;
 
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#4

Re: Calling an COM object from Delphi

  Alt 6. Okt 2009, 17:04
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 * * *
Markus Kinzler
 
Thema geschlossen


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:40 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz