clipcursor(@oldrect);编译这行时出错[Error] Unit1.pas(40): Undeclared identifier: 'oldre

  • 主题发起人 主题发起人 hugh8888
  • 开始时间 开始时间
H

hugh8888

Unregistered / Unconfirmed
GUEST, unregistred user!
clipcursor(@oldrect);编译这行时出错[Error] Unit1.pas(40): Undeclared identifier: 'oldrect'(30分)<br />unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; Button2: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Button2Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var oldrect,rect:Trect;<br>tm:THandle;<br>begin<br>getclipcursor(oldrect);<br>tm:=form1.Handle;<br>getwindowrect(tm,rect);<br>clipcursor(@rect);<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>clipcursor(@oldrect);<br>end;<br><br>end.
 
local variable?!!!
 
procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; &nbsp;clipcursor(@oldrect);///oldrect在哪里定义了啊???????<br>end;<br><br><br>这样吧:<br>private<br>&nbsp; oldrect:Trect;<br><br>////<br>procedure TForm1.Button1Click(Sender: TObject);<br>var rect:Trect;<br>tm:THandle;<br>begin<br>getclipcursor(oldrect);<br>tm:=form1.Handle;<br>getwindowrect(tm,rect);<br>clipcursor(@rect);<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>clipcursor(@oldrect);<br>end;<br><br><br>
 

Similar threads

后退
顶部