Autor Beitrag
Darnus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Mi 18.10.06 23:27 
Hallo ich habe ein programm was die ports von einer dll lesen soll jedoch weiss ich nicht wie ich die dll in das programm einfüge!

Hier mal der code:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
library server2;



uses
  SysUtils,
  Classes;

{$R *.res}
function ServerDaten(ts,hp,ftp,csgather,cspublic:integer):integer;Stdcall;
begin
ts:=8767;
hp:=80;
ftp:=21;
csgather:=27016;
cspublic:=27015;
end;
function ServerHost(host:Pchar):pchar;Stdcall;
begin
Host:='url.de'
end;
exports ServerDaten,ServerHost;
end.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
// soll dann so aussehen ..
procedure TForm1.FormCreate(Sender: TObject);
begin
idHttp1.Port:=hp;
end;


Die sache ist ich weiss nichtmal ob das richtig ist :D
Könnte mir dabei jemand helfen??? THX
Zeterijus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

Win XP
D2005 Prof
BeitragVerfasst: Sa 21.10.06 16:44 
Also so wie das momentan aussieht kann das gar nicht klappen. Versuch mal folgendes für die DLL

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
library server2;

uses
  SysUtils,
  Classes;

{$R *.res}
function hp:integer;Stdcall;
begin
 hp:=80;
end;
exports hp;
end.


Der Aufruf sieht dann so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
function hp:integer; external 'server2.dll';

procedure TForm1.FormCreate(Sender: TObject);
begin
 idHttp1.Port:=hp;
end;


In der DLL musst du dann für die anderen Werte entsprechende Funktionen definiern. Hoffe, dass dir das weiter hilft und dass ich dein Problem richtig verstanden habe.

Fabian.