为什么老是出错,

zf4000 2002-12-20 08:56:47
unit UntConst;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,Forms,Dialogs;
procedure MoveNext(var Key: Char);
implementation
procedure MoveNext(var Key: Char);
begin
if key=#13 then
begin
key:=#0;
perform(WM_NEXTDLGCTL,0,0);//出错
end;
end;
end.

编译的时候,老是在perform(WM_NEXTDLGCTL,0,0);行出错:undeclared identifier "perform".
为什么????在线等待,谢谢
...全文
35 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zf4000 2002-12-20
  • 打赏
  • 举报
回复
还是同样的错误提示,我uses controls,shellapi;了,还是认不出WM_NEXTDLGCTL来
Drate 2002-12-20
  • 打赏
  • 举报
回复
不知道是不是要加上

uses shellapi;

我的理由是:WM_NEXTDLGCTL这个消息在WIN32 的API中定义的!

所以,你可能没有调用相应的单元!
zf4000 2002-12-20
  • 打赏
  • 举报
回复
unit UntConst;
interface
procedure MoveNext(sender:Tobject;var Key: Char);
implementation
uses controls;
procedure MoveNext(sender:Tobject;var Key: Char);
begin
if key=#13 then
begin
key:=#0;
Tcontrol(sender).perform(WM_NEXTDLGCTL,0,0);
end;
end;
end.
上面的方法我都试过了,可是还是有点问题,说"undeclared identifier WM_NEXTDLGCTL",
我本来是想把键盘响应事件提去出来作为一个函数,写在我的const unit里,然后在别的form里use这个const unit就可以直接调用函数movenext了,可是好象不行啊。
first_lover 2002-12-20
  • 打赏
  • 举报
回复
必须是TWINCONTRL才有PERFORM,同时,你必须uses Controls
outer2000 2002-12-20
  • 打赏
  • 举报
回复
Responds as if the control received a specified Windows message.

Delphi syntax:

function Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;

C++ syntax:

int __fastcall Perform(unsigned Msg, int WParam, int LParam);

Description

Call Perform to bypass the Windows message queue and send a message directly to the control抯 window procedure.

Perform fills a message record (of type TMessage) with the message ID passed in the Msg parameter, the message parameters passed in WParam and LParam, and a result field of zero. Perform then passes the message record to the WindowProc method for processing.
outer2000 2002-12-20
  • 打赏
  • 举报
回复
必须是TWINCONTRL才有PERFORM
fyje 2002-12-20
  • 打赏
  • 举报
回复
在uses列表中,加入Controls,就可以了
laihecongxi 2002-12-20
  • 打赏
  • 举报
回复
你是在一个unit里定义的。而perform必须指定一个sender可以改为:
procedure MoveNext(var Key: Char;sender:Tobject);
implementation

procedure MoveNext(var Key: Char;sender:Tobject);
begin
Tcontrol(sender).perform(WM_NEXTDLGCTL,0,0);//
end;

5,378

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧