怎么在一个PAS里调用另外一个PAS里的函数?立马结账 (30分)

  • 主题发起人 主题发起人 bill_won
  • 开始时间 开始时间
B

bill_won

Unregistered / Unconfirmed
GUEST, unregistred user!
比如:1.PAS里调用2.PAS里的函数F1,2.PAS怎么定义F1?
 
简单的问题我就不会,帮我啊
 
1.pas中
use 2
2.pas中的F1在public中
 
unit jxy_public;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,StdCtrls,Registry;

implementation

Function GetSystemInfo(SystemName :string;Key:string):string;
var
MyReg : TRegistry;
Return:string;
begin
MyReg := TRegistry.Create;
MyReg.RootKey := HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/',FALSE) then
if not MyReg.KeyExists(SystemName) then
MyReg.CreateKey(SystemName);
MyReg.OpenKey('/SOFTWARE/'+SystemName,FALSE) ;
Return:=MyReg.ReadString(Key);
MyReg.CloseKey;
result:=return;
end;

procedure SetSystemInfo(SystemName :string;Key:string;Value:string);
var
MyReg : TRegistry;
Return:string;
begin
MyReg := TRegistry.Create;
MyReg.RootKey := HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/',FALSE) then
if not MyReg.KeyExists(SystemName) then
MyReg.CreateKey(SystemName);
MyReg.OpenKey('/SOFTWARE/'+SystemName,FALSE) ;
MyReg.WriteString(Key,Value);
MyReg.CloseKey;
end;

end.

关于两个函数的定义写哪里?
写哪里?
 
unit jxy_public;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,StdCtrls,Registry;
implementation
Function GetSystemInfo(SystemName :string;Key:string):string;
var
MyReg : TRegistry;
Return:string;
begin
MyReg := TRegistry.Create;
MyReg.RootKey := HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/',FALSE) then
if not MyReg.KeyExists(SystemName) then
MyReg.CreateKey(SystemName);
MyReg.OpenKey('/SOFTWARE/'+SystemName,FALSE) ;
Return:=MyReg.ReadString(Key);
MyReg.CloseKey;
result:=return;
end;

procedure SetSystemInfo(SystemName :string;Key:string;Value:string);
var
MyReg : TRegistry;
Return:string;
begin
MyReg := TRegistry.Create;
MyReg.RootKey := HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/SOFTWARE/',FALSE) then
if not MyReg.KeyExists(SystemName) then
MyReg.CreateKey(SystemName);
MyReg.OpenKey('/SOFTWARE/'+SystemName,FALSE) ;
MyReg.WriteString(Key,Value);
MyReg.CloseKey;
end;

end.

现在是这样的,刚才的错了,帮我看看,这两个函数定义在哪里,其他 PAS里可以调用?
我怎么写都错。
 
帮我看看啊
 
没有人帮帮我啊
 
unit publicunit;
interface
uses
Grids, Registry, Windows, Dialogs, printers, Classes, Forms;
procedure clear_grid(sender: tobject);
procedure delete_grid(grid: tstringgrid;
_rols: integer);
//procedure print;
// procedure PrintLine(Items: TStringList);
// procedure PrintHeader;
// procedure PrintColumnNames;
function GetShellFolders(strDir: string): string;
function setshowtoolbar(formcount: Integer): Boolean;
var
send_integer: integer;
showtoolsbar: Boolean;
PixelsInInchx: integer;
LineHeight: Integer;
AmountPrinted: integer;
TenthsOfInchPixelsY: integer;
implementation
{procedure print;
var
Items: TStringList;
begin
Items := TStringList.Create;
try
PixelsInInchx := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
TenthsOfInchPixelsY := GetDeviceCaps(Printer.Handle,
LOGPIXELSY) div 10;
AmountPrinted := 0;

Printer.begin
Doc;
Application.ProcessMessages;
LineHeight := Printer.Canvas.TextHeight('X') + TenthsOfInchPixelsY;
// PrintColumnNames;
// PrintLine(Items);
if AmountPrinted + LineHeight > Printer.PageHeight then
begin
AmountPrinted := 0;
if not Printer.Aborted then
Printer.NewPage;
// PrintHeader;
// PrintColumnNames;
end;
Items.Clear;
// tblClients.Next;
if not Printer.Aborted then
Printer.EndDoc;
finally
Items.Free;
end;
end;
}
function setshowtoolbar(formcount: integer): Boolean;
begin
Result := formcount = 1;
end;

procedure delete_grid(grid: tstringgrid;
_rols: integer);
var
temp_x, temp_y, temp_i: integer;
begin
if _rols = 2 then
begin
if grid.Cells[0, 1] <> '' then
begin
for temp_i := 0 to grid.ColCount - 1do
grid.Cells[temp_i, 1] := '';
send_integer := 0;
end
else
showmessage('&amp;Atilde;&amp;raquo;&amp;Oacute;&amp;ETH;&amp;Ecirc;&amp;yacute;&amp;frac34;&amp;Yacute;&amp;iquest;&amp;Eacute;&amp;Ograve;&amp;Ocirc;&amp;Eacute;&amp;frac34;&amp;sup3;&amp;yacute;.');
end
else
begin
for temp_y := grid.row to grid.RowCount - 1do
for temp_x := 0 to grid.ColCount - 1do
grid.Cells[temp_x, temp_y] := grid.Cells[temp_x, temp_y + 1];
grid.RowCount := pred(grid.RowCount);
send_integer := pred(grid.RowCount);
end;
end;

function GetShellFolders(strDir: string): string;
const
regPath = '/Software/Microsoft/Windows/CurrentVersion/Explorer/Shell Folders';
var
Reg: TRegistry;
strFolders: string;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey(regPath, false) then
begin
strFolders := Reg.ReadString(strDir);
end;
finally
Reg.Free;
end;
result := strFolders;
end;

procedure clear_grid(sender: tobject);
var temp_x, temp_y: integer;
begin
for temp_y := 1 to TStringGrid(sender).RowCount - 1do
for temp_x := 0 to TStringGrid(sender).ColCount - 1do
TStringGrid(sender).Cells[temp_x, temp_y] := '';
TStringGrid(sender).RowCount := 2;
end;
end.
 
接受答案了.
 
后退
顶部