Einzelnen Beitrag anzeigen

thomaskroger

Registriert seit: 22. Mär 2009
16 Beiträge
 
#1

c++DLL über einen c#-Wrapper in DELPHI XE6 nutzen. Problem mit regsvr32

  Alt 13. Nov 2014, 20:01
Delphi-Version: XE5
Moinsen,

VolumeGraphics liefert eine C++-DLL (vgs_project.dll) auf die ich über einen Wrapper (RemoteControl.dll) aus Delphi XE6 zugreife. Der Wrapper ist in C# geschrieben.

Delphi-Applikation -> RemoteControl.dll -> vgs_project.dll

Auf meinem Labor-PC unter Win7/64 läuft es bestens.

Nach dem Installieren auf dem Anwender-PC (Win7/64) hängt mein Programm bei
Delphi-Quellcode:
//Init RemoteControl_TLB:
  if VGrc=nil then
  begin
    VGrc:=CoProgram_.Create;
  end;
mit der Meldung:

Klasse nicht registriert, ClassID:
{382B50BC-99FC-37C6-8E71-0A610B1CB312}

Ein Registrieren mit
Code:
regsvr32 c:\bla\RemoteControl.dll
oder
Code:
regsvr32 c:\bla\vgs_project.dll
haut mit das um die Ohren:
Code:
Das Modul C:\bla\RemoteControl.dll wurde geladen, aber der DllInstall-Eingangspunkt wurde nicht gefunden
usw.

Hat jemand eine Idee wie ich das zum Laufen bekomme?

Many Thanks für die Hilfe!!
Thomas

Delphi-Quellcode:
unit RemoteControl_TLB;

// $Rev: 52393 $

// ************************************************************************ //
// Typbib.: C:\bla\RemoteControl.tlb (1)
// LIBID: {C428D563-AEE3-359A-B3D7-2A344DDD23EA}
// LCID: 0
// Liste der Abhäng.:
// (1) v2.0 stdole, (C:\Windows\SysWOW64\stdole2.tlb)
// (2) v2.4 mscorlib, (C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.tlb)
// SYS_KIND: SYS_WIN32
// Fehler:
// Hinweis: Program geändert zu Program_
// Hinweis: Parameter 'type' im iRemoteControl.Set_VoxelFile_ClampLow geändert zu 'type_'
// Hinweis: Parameter 'type' im iRemoteControl.Set_VoxelFile_ClampHigh geändert zu 'type_'
// Fehler beim Erzeugen von Palettenbitmap von (TProgram) : Server mscoree.dll enthält keine Symbole
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit muss ohne Typüberprüfung für Zeiger compiliert werden.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
{$ALIGN 4}

interface

uses Winapi.Windows, mscorlib_TLB, System.Classes, System.Variants, System.Win.StdVCL, Vcl.Graphics, Vcl.OleServer, Winapi.ActiveX;
  

// *********************************************************************//
// In der Typbibliothek deklarierte GUIDS. Die folgenden Präfixe werden verwendet:
// Typbibliotheken : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Nicht-DISP-Interfaces: IID_xxxx
// *********************************************************************//
const
  // Haupt- und Nebenversionen der Typbibliothek
  RemoteControlMajorVersion = 1;
  RemoteControlMinorVersion = 0;

  LIBID_RemoteControl: TGUID = '{C428D563-AEE3-359A-B3D7-2A344DDD23EA}';

  DIID_iRemoteControl: TGUID = '{F1E80D2D-72F7-434F-86AB-DFC7BF10C447}';
  CLASS_Program_: TGUID = '{382B50BC-99FC-37C6-8E71-0A610B1CB312}';
type

  iRemoteControl = dispinterface;
  Program_ = iRemoteControl;

// *********************************************************************//
// DispIntf: iRemoteControl
// Flags: (4096) Dispatchable
// GUID: {F1E80D2D-72F7-434F-86AB-DFC7BF10C447}
// *********************************************************************//
  iRemoteControl = dispinterface
    ['{F1E80D2D-72F7-434F-86AB-DFC7BF10C447}']
    procedure Set_iProcessReturnCallBack(CallBacPtr: Integer); dispid 1610743808;
    function Get_ProcessReturnString: WideString; dispid 1610743809;
    function Get_ProcessReturnInt: Integer; dispid 1610743810;
    function Get_ProcessReturnTyp: WideString; dispid 1610743811;
    function Get_ProcessReturnName: WideString; dispid 1610743812;
    function Get_Version: WideString; dispid 1610743813;
    procedure Set_InputFile_ProjectionFileNameList(const ProjectionFileNameList: WideString;
                                                   ProjectionFileNameListVon: Integer;
                                                   ProjectionFileNameListBis: Integer); dispid 1610743814;
    procedure Set_InputFile_FilesFormat(const Text: WideString); dispid 1610743815;
    procedure Set_InputFile_IgnoreBorderPixels(wert: Integer); dispid 1610743816;
    procedure Set_InputFile_ProjectionOrientation(wert: Integer); dispid 1610743817;
    procedure Set_InputFile_ProjectionSkip(x: Integer; y: Integer); dispid 1610743818;
    procedure Set_InputFile_ProjectionSkipAngle(wert: Integer); dispid 1610743819;
    procedure Set_InputFile_ProjectionSmoothing(wert: Integer); dispid 1610743820;
bla...
    function RunVG: WordBool; dispid 1610743857;
    function LoadVG: WordBool; dispid 1610743858;
    function StopVG: WordBool; dispid 1610743859;
    function UnlockVG: WordBool; dispid 1610743860;
    function RunREK: WordBool; dispid 1610743861;
  end;

// *********************************************************************//
// Die Klasse CoProgram_ stellt die Methoden Create und CreateRemote zur
// Verfügung, um Instanzen des Standard-Interface iRemoteControl, dargestellt
// von CoClass Program_, zu erzeugen. Diese Funktionen können
// von einem Client verwendet werden, der die CoClasses automatisieren
// will, die von dieser Typbibliothek dargestellt werden.
// *********************************************************************//
  CoProgram_ = class
    class function Create: iRemoteControl;
    class function CreateRemote(const MachineName: string): iRemoteControl;
  end;


// *********************************************************************//
// OLE-Server-Proxy-Klassendeklaration
// Server-Objekt : TProgram
// Hilfe-String :
// Standard-Interface: iRemoteControl
// Def. Intf. DISP? : Yes
// Ereignis-Interface:
// TypeFlags : (2) CanCreate
// *********************************************************************//
  TProgram = class(TOleServer)
  private
    FIntf: iRemoteControl;
    function GetDefaultInterface: iRemoteControl;
  protected
    procedure InitServerData; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Connect; override;
    procedure ConnectTo(svrIntf: iRemoteControl);
    procedure Disconnect; override;
    procedure Set_iProcessReturnCallBack(CallBacPtr: Integer);
    function Get_ProcessReturnString: WideString;
    function Get_ProcessReturnInt: Integer;
    function Get_ProcessReturnTyp: WideString;
    function Get_ProcessReturnName: WideString;
    function Get_Version: WideString;
    procedure Set_InputFile_ProjectionFileNameList(const ProjectionFileNameList: WideString;
                                                   ProjectionFileNameListVon: Integer;
                                                   ProjectionFileNameListBis: Integer);

bla...
    function RunVG: WordBool;
    function LoadVG: WordBool;
    function StopVG: WordBool;
    function UnlockVG: WordBool;
    function RunREK: WordBool;
    property DefaultInterface: iRemoteControl read GetDefaultInterface;
  published
  end;

procedure Register;

resourcestring
  dtlServerPage = 'ActiveX';

  dtlOcxPage = 'ActiveX';

implementation

uses System.Win.ComObj;

class function CoProgram_.Create: iRemoteControl;
begin
  Result := CreateComObject(CLASS_Program_) as iRemoteControl;
end;

class function CoProgram_.CreateRemote(const MachineName: string): iRemoteControl;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_Program_) as iRemoteControl;
end;

procedure TProgram.InitServerData;
const
  CServerData: TServerData = (
    ClassID: '{382B50BC-99FC-37C6-8E71-0A610B1CB312}';
    IntfIID: '{F1E80D2D-72F7-434F-86AB-DFC7BF10C447}';
    EventIID: '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TProgram.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as iRemoteControl;
  end;
end;

procedure TProgram.ConnectTo(svrIntf: iRemoteControl);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TProgram.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TProgram.GetDefaultInterface: iRemoteControl;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface ist NULL. Die Komponente ist nicht mit dem Server verbunden. Sie müssen vor dieser Operation "Connect" oder "ConnectTo" aufrufen');
  Result := FIntf;
end;

constructor TProgram.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
end;

destructor TProgram.Destroy;
begin
  inherited Destroy;
end;

procedure TProgram.Set_iProcessReturnCallBack(CallBacPtr: Integer);
begin
  DefaultInterface.Set_iProcessReturnCallBack(CallBacPtr);
end;

function TProgram.Get_ProcessReturnString: WideString;
begin
  Result := DefaultInterface.Get_ProcessReturnString;
end;

function TProgram.Get_ProcessReturnInt: Integer;
begin
  Result := DefaultInterface.Get_ProcessReturnInt;
end;

function TProgram.Get_ProcessReturnTyp: WideString;
begin
  Result := DefaultInterface.Get_ProcessReturnTyp;
end;

function TProgram.Get_ProcessReturnName: WideString;
begin
  Result := DefaultInterface.Get_ProcessReturnName;
end;

function TProgram.Get_Version: WideString;
begin
  Result := DefaultInterface.Get_Version;
end;

bla...


function TProgram.RunVG: WordBool;
begin
  Result := DefaultInterface.RunVG;
end;

function TProgram.LoadVG: WordBool;
begin
  Result := DefaultInterface.LoadVG;
end;

function TProgram.StopVG: WordBool;
begin
  Result := DefaultInterface.StopVG;
end;

function TProgram.UnlockVG: WordBool;
begin
  Result := DefaultInterface.UnlockVG;
end;

function TProgram.RunREK: WordBool;
begin
  Result := DefaultInterface.RunREK;
end;

procedure Register;
begin
  RegisterComponents(dtlServerPage, [TProgram]);
end;

end.

Hier ein Ausschnitt aus RemoteControl.cs

Code:
/*RemoteControlDLL
*/


using System;
using System.Diagnostics;
using System.Threading;
using System.Reflection;
using System.Runtime.InteropServices;


//VGS.Project.Interop.RemoteControl:
using VGS.Project.Interop;
using VGS.Project.Interop.RemoteControl;

//VGS.Project.Interop.Reconstruction:
using VGS.Project.Interop.Reconstruction;



//RemoteControl______________________________________________________________
namespace RemoteControl
{   [Guid("F1E80D2D-72F7-434F-86AB-DFC7BF10C447")]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    [ComVisible(true)]

    public interface iRemoteControl
    {
//System:
        string Get_ProcessReturnString();
        int Get_ProcessReturnInt();
        string Get_ProcessReturnTyp();
        string Get_ProcessReturnName();
        string Get_Version();  
//InputFile
        void Set_InputFile_ProjectionFileNameList(string ProjectionFileNameList, int ProjectionFileNameListVon, int ProjectionFileNameListBis);
        void Set_InputFile_FilesFormat(string Text);
        void Set_InputFile_IgnoreBorderPixels(int wert);
        void Set_InputFile_ProjectionOrientation(int wert);
        void Set_InputFile_ProjectionSkip(int x, int y);
        void Set_InputFile_ProjectionSkipAngle(int wert);
        void Set_InputFile_ProjectionSmoothing(int wert);


//Methoden:
        bool RunVG();    
        bool LoadVG();
        bool StopVG();
        bool UnlockVG();
        bool RunREK();  
    }

    [ClassInterface(ClassInterfaceType.None)]

    public class Program : iRemoteControl
    {

        Project p;
        ReconstructionDescriptor rd;
        ManufacturerInfo mi;
        ComponentInfo ci;
        ScanInfo si;

        int vCallBacPtr;
        public static string localhost = "127.0.0.1";
        public static int servicePort = 9002;
        public static RemoteHandle handle;  
        public static RemoteControlClient client;

        //_______________________________________________________________________________________
        public Program()
        {   
            p = new Project(Project.TypeEnum.Reconstruction);
            rd = p.ReconstructionDescriptor;
            mi = p.ManufacturerInfo;
            ci = p.ComponentInfo;
            si = p.ScanInfo;
        }
  Mit Zitat antworten Zitat