这个问题不用sendmessageprocedure TForm1.Button1Click(Sender: TObject); var a:hwnd; begin a:=FindWindow(nil,'~'); if a>0 then SetWindowLong(a,GWL_STYLE,GetWindowLong(Self.Handle,GWL_STYLE) and (not WS_CAPTION)) else ShowMessage('not find'); end;
上面写错了一个小地方:procedure TForm1.Button1Click(Sender: TObject); var a:hwnd; begin a:=FindWindow(nil,'~');//此处写你要修改的窗体标题 if a>0 then SetWindowLong(a,GWL_STYLE,GetWindowLong(a,GWL_STYLE) and (not WS_CAPTION)) else ShowMessage('not find'); end;
不过好像把后面的那个GetWindowLong(a,GWL_STYLE) and (not WS_CAPTION) 换成 (not WS_BORDER) and GetWindowLong(a,GWL_STYLE) 实现的要好一些
var a:hwnd;
begin
a:=FindWindow(nil,'~');
if a>0 then
SetWindowLong(a,GWL_STYLE,GetWindowLong(Self.Handle,GWL_STYLE) and (not WS_CAPTION))
else ShowMessage('not find');
end;
var a:hwnd;
begin
a:=FindWindow(nil,'~');//此处写你要修改的窗体标题
if a>0 then
SetWindowLong(a,GWL_STYLE,GetWindowLong(a,GWL_STYLE) and (not WS_CAPTION))
else ShowMessage('not find');
end;