![]() |
funktion aus andere unit laden
hi, ich habe 2 units, die eine wo fät viele funktion drin sind, und die andere erste unit die diese ausführt. Ich habe die unit2 bei unit 1 in die uses geschrieben , scheint aber nicht zu reichen. benutzt delphi 7 vielen dank
|
Re: funktion aus andere unit laden
Du kannst unter implementation noch ne weitere Uses Klauses einfügen, die auf die erste Unit verweist :>
|
Re: funktion aus andere unit laden
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. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:11 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 by Thomas Breitkreuz