//API方式的! ... var Form1: TForm1; h:hwnd;//注意这里 implementation{$R *.dfm} procedure pro(var HWND:hwnd;LPARAM:lParam); var temp:array[0..255] of char; begin getwindowtext(hwnd,temp,255); if string(temp)='Panel1' then //你要放置的地方 windows.SetParent(h,hwnd); end;procedure TForm1.Button1Click(Sender: TObject); begin h:=findwindow(nil,'计算器');//假设是计算器' enumchildwindows(handle,@pro,0); end;
procedure Tform1.pro(var HWND:hwnd;LPARAM:lParam); var temp:array[0..255] of char; begin getwindowtext(hwnd,temp,255); if string(temp)='Panel1' then //你要放置的地方 windows.SetParent(h,hwnd); end;procedure TForm1.Button1Click(Sender: TObject); begin h:=findwindow(nil,'计算器');//假设是计算器' enumchildwindows(handle,@pro,0);///////提示这句有错:variable required end; 怎么回事?????
完整的程序 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; h:hwnd; implementation {$R *.dfm} procedure pro(var HWND:hwnd;LPARAM:lParam); var temp:array[0..255] of char; begin getwindowtext(hwnd,temp,255); if string(temp)='Panel1' then windows.SetParent(h,hwnd); end; procedure TForm1.Button1Click(Sender: TObject); begin h:=findwindow(nil,'计算器'); enumchildwindows(handle,@pro,0); end; end.
...
var
Form1: TForm1;
h:hwnd;//注意这里
implementation{$R *.dfm}
procedure pro(var HWND:hwnd;LPARAM:lParam);
var temp:array[0..255] of char;
begin
getwindowtext(hwnd,temp,255);
if string(temp)='Panel1' then //你要放置的地方
windows.SetParent(h,hwnd);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
h:=findwindow(nil,'计算器');//假设是计算器'
enumchildwindows(handle,@pro,0);
end;
var temp:array[0..255] of char;
begin
getwindowtext(hwnd,temp,255);
if string(temp)='Panel1' then //你要放置的地方
windows.SetParent(h,hwnd);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
h:=findwindow(nil,'计算器');//假设是计算器'
enumchildwindows(handle,@pro,0);///////提示这句有错:variable required
end;
怎么回事?????
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
h:hwnd;
implementation
{$R *.dfm}
procedure pro(var HWND:hwnd;LPARAM:lParam);
var temp:array[0..255] of char;
begin
getwindowtext(hwnd,temp,255);
if string(temp)='Panel1' then
windows.SetParent(h,hwnd);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
h:=findwindow(nil,'计算器');
enumchildwindows(handle,@pro,0);
end;
end.