AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Dll benutzen in einer Consolen Anwendungen
Thema durchsuchen
Ansicht
Themen-Optionen

Dll benutzen in einer Consolen Anwendungen

Ein Thema von Dr.No · begonnen am 1. Jan 2006 · letzter Beitrag vom 7. Feb 2006
 
Sascha_OW

Registriert seit: 4. Aug 2005
Ort: Owschlag
129 Beiträge
 
Delphi 2005 Professional
 
#4

Re: Dll benutzen in einer Consolen Anwendungen

  Alt 7. Feb 2006, 08:56
Hallo,

ich habe das gleiche Problem. Will ne FTP DLL Schreiben vileicht kann mir ja jemand helfen

IN der DLL:
Delphi-Quellcode:
library Project2;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }


uses
  SysUtils,
  Classes,
  IdFTP;

{$R *.res}

function FTPConnect (Server: String; User: String; PWDFTP: String): boolean; stdcall;
var con : TIDFTP;
begin
   con := TIDFTP.Create;
   con.Host := Server;
   con.Username := User;
   con.Password := PWDFTP;
   con.Connect;
   IF con.Connected then result := true else result := false;
end;


end.


und dann im Program selbst, die Unit wo die DLL eingebunden wird:

Delphi-Quellcode:
unit Unit2;

interface
   function FTPConnect (Server: String; User: String; PWDFTP: String): boolean; stdcall;
implementation
   function FTPConnect (Server: String; User: String; PWDFTP: String): boolean; stdcall;
external 'project2.dll';
end.
und dann die Unit wo ich die Function aufrufe:
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  IdExplicitTLSClientServerBase, IdFTP, StdCtrls, ExtCtrls, unit2;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Timer1: TTimer;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  connec: boolean;
implementation


{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  connec := FtpConnect ('**************', '************', '***********');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   connec := false;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  IF Connec then Label1.Color := clgreen else Label1.Color := CLRed;
end;

end.
Vielen Dnake vieleicht kann mir ein helfen
















Edit by Sascha:


hat sich erledigt, habe es selbst gefunden, es war das exports was fehlte und eimn begin
Sascha Schwarz
  Mit Zitat antworten Zitat
 


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 20:05 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