下面的代码经过验证
1)隐藏应用程序图标
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Visible:=false;
Application.ShowMainForm:=Visible;
end;
2)隐藏和显示程序的标题栏
procedure TForm1.HideCaptionBar;
var
save:LongInt;
begin
if BorderStyle = bsNone then Exit;
Save := GetWindowLong(Handle,GWL_STYLE);
if (Save and WS_CAPTION) = WS_CAPTION then
begin
Case BorderStyle of
bsSingle,bsSizeable:
SetWindowLong(Handle,GWL_STYLE,Save and (not(WS_CAPTION)) or WS_BORDER);
bsDialog:
SetWindowLong(Handle,GWL_STYLE,Save and (not(WS_CAPTION)) or DS_MODALFRAME or WS_DLGFRAME);
end;
Height :=Height-GetSystemMetrics(SM_CYCAPTION);
Refresh;
end;
end;
procedure TForm1.ShowCaptionBar;
var
save:LongInt;
begin
if BorderStyle = bsNone then Exit;
Save := GetWindowLong(Handle,GWL_STYLE);
if (Save and WS_CAPTION) <> WS_CAPTION then
begin
Case BorderStyle of
bsSingle,bsSizeable:
SetWindowLong(Handle,GWL_STYLE,Save or WS_CAPTION or WS_BORDER);
bsDialog:
SetWindowLong(Handle,GWL_STYLE,Save or WS_CAPTION or DS_MODALFRAME or WS_DLGFRAME);
end;
Height :=Height+GetSystemMetrics(SM_CYCAPTION);
Refresh;
end;
end;