开发者

How to call a function stored in a Unit?

I created a new unit because there are functions that I need to call from all forms and I placed the unit name in the uses list.

I don't get any error at design time but 开发者_StackOverflowwhen I try to start the application I get [DCC Error] UnitForm1.pas(64): E2003 Undeclared identifier: 'TaskBarHeight'

Please help. Thanks.


Is TaskBarHeight declared in the interface section of the unit?

unit Unit4;

interface

uses Windows;

procedure HighBeep;

function Sum(const A, B: integer): integer;

const
  alpha = 10;

implementation

const
  beta = 20;

procedure HighBeep;
begin
  Beep(800, 500);
end;

procedure LowBeep;
begin
  Beep(400, 500);
end;

function Sum(const A, B: integer): integer;
begin
  result := A + B;
end;

end.

In the above example, only the function HighBeep is visible in other units. Also, only the constant alpha is. The function sum is also visible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜