换成EDIT怎么就不行 (10分)

  • 主题发起人 主题发起人 sy0116
  • 开始时间 开始时间
S

sy0116

Unregistered / Unconfirmed
GUEST, unregistred user!
type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; private<br><br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>function EnumAllWindow(hWnd:HWND; lParam:LPARAM): BOOL; stdcall;<br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br>function EnumAllWindow(hWnd: HWND; lParam: LPARAM): BOOL;<br>var<br>&nbsp; &nbsp;ClassName: Array[0..255] of char;<br>begin<br>&nbsp; &nbsp;GetClassName(hWnd,ClassName,255);<br>&nbsp; &nbsp;if ClassName = 'EDIT' then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; ShowMessage(IntToStr(hWnd));<br>&nbsp; &nbsp;end;<br>&nbsp; &nbsp;Result:=TRUE;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; &nbsp; &nbsp; &nbsp; hd, childhd: THandle;<br>begin<br>&nbsp; &nbsp; &nbsp; &nbsp; hd := FindWindow(nil, ABC');<br><br>&nbsp; &nbsp; &nbsp; &nbsp; if hd &lt;&gt; 0 then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EnumChildWindows(hd, @EnumAllWindow, 0)<br>end;<br>把ShowMessage(IntToStr(hWnd));换成edit2.text=IntToStr(hWnd);怎么不行?<br>[Error] nqq.pas(49): Undeclared identifier: 'edit2'<br>[Error] nqq.pas(49): Missing operator or semicolon
 
把ShowMessage(IntToStr(hWnd));换成edit2.text=IntToStr(hWnd);怎么不行?<br>你换成这样看看?<br>Form1.edit2.text=IntToStr(hWnd);
 
Edit2是啥东东,文本框么?你有没有在窗体上创建,怎么用它。你在Form1上添加一个文本框(Name为Edit2)看看行不行!<br>Form1.edit2.text:=IntToStr(hWnd);<br>'='是判断 ,':='才是赋值。 &nbsp;
 
edit2.text=:IntToStr(hWnd);第二个问题是要在等号前加冒号,兄弟<br>至于edit2,你要先放一个在窗本上才行那
 
应该前面加窗体变量名 formX.edit
 
后退
顶部