Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Wie erstelle ich eine OCX? (https://www.delphipraxis.net/51626-wie-erstelle-ich-eine-ocx.html)

torud 16. Aug 2005 07:45


Wie erstelle ich eine OCX?
 
Hallo Leute!

Ich stehe vor dem Problem, dass ich eine DLL habe, die wiederum externe Daten liest und geparst durchreicht. Ich möchte/muss nun eine OCX creieren, die ein Handle auf diese DLL hat, weiss aber noch nicht, genau, wie das geht. Auf die DLL habe ich nun schon mal mit folgendem Code Zugriff bekommen:

Delphi-Quellcode:
procedure LoadDLL;
var
  P: TDVParams;
  O: TDVOutPtsErr;
  lib : THandle;
begin
      Lib := LoadLibrary(PChar('dvstat.dll'));
      if Lib <> 0 then
      begin
        @GetPointsErr := GetProcAddress(Lib, 'GetPointsErr');
        if (Assigned(GetPointsErr)) then
        begin
          P.PathSource := 'c:\';               //Path Shared by Data Volley
          P.IDTeam := 0;         //Home Team
          P.IdPlayer := 49;          //Player 2
          P.SetN := 0;            //Match
          P.Skill := 0;            //Total statistics
          //if fnc(P, O) <> 0 then Exit;
          //GetPointsErr(P, O);
          ShowMessage(inttostr(GetPointsErr(P,O))); //zeigt testhalber schon mal ein paar daten an
          //Output
          //'Tot ' + IntToStr(O.Tot));
          ShowMessage('Points ' + IntToStr(O.Pts));
          //'Errors ' + IntToStr(O.Err));
        end;
        FreeLibrary(lib)
      end;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
    LoadDLL;
end;
Das funktioniert nun schon. Aber das Ganze habe ich einfach als normales Projekt gebaut, was meinem Kollegen nix nützt, da er es als OCX einbinden will/muss. Was muss ich tun, um diese Funktionalität in einer OCX zu Verfügung zu haben?

marabu 16. Aug 2005 08:44

Re: Wie erstelle ich eine OCX?
 
Hallo Tom,

du wirst ein Automatisierungsobjekt erstellen müssen, welches du dann nicht als DLL sondern als OCX speichern musst. Schau dir mal die Delphi-Projekt-Vorlagen an (Datei-Neu-Weitere: ActiveX). Bei den Demos sind auch verschiedene Beispiele.

Grüße vom marabu


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:16 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