(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: funktion aus andere unit laden
8. Mär 2005, 17:24
Hallo,
Hier mal ein Beispiel:
Unit1:
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
Unit2;
procedure TForm1.FormCreate(Sender: TObject);
begin
ShowMessage(GetWinDir);
end;
end.
Unit2:
Delphi-Quellcode:
unit Unit2;
interface
function GetWinDir: string;
implementation
function GetWinDir: string;
var
Len: Integer;
begin
Result := ' ';
Len := Windows.GetWindowsDirectory( nil, 0);
if Len > 0 then
begin
SetLength(Result, Len);
Len := Windows.GetWindowsDirectory(PChar(Result), Len);
SetLength(Result, Len);
end;
end;
end.
Thomas
|
|
Zitat
|