[Win2K, Delphi6.163]
I try to hide a caption bar _but_ still keep a very thick border around
the window. This newsgroup provided the following example, but I still
don't achieve what I want.
If I use design properties to set borderstyle, disable borderIcons and
run the application:
* bsSingle -> app has focus, has thin border, has captionbar
* bsDialog -> _does not_ have focus, has thin border, no captionbar
* bsNone -> has focus, no any border, no captionbar
* bsSizeable -> has focus, has thin border, has captiobar
bsDialog as a default setting is closest to what I want. But big BUT:
application does not have a focus after clicking it. Pressed application
in a bottom taskbar is Windows Explorer. Weird...
Now I need to find a solution to remove a captionar, window has a thin
border and it should get a focus after running it.
I have tried using SetWindowLong function but I cannot find a suitable
combination.
>>>>>>>>>>>>>>
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
protected
procedure CreateParams(var params: TCreateParams); override;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
inherited;
// hide captionbar
//self.Caption := 'Test';
//self.Visible := true;
// self.BorderIcons := [];
// self.BorderStyle := bsSingle;
// SetWindowLong(self.Handle, GWL_STYLE,
// (GetWindowLong(self.Handle,GWL_STYLE) or WS_POPUP)
// and WS_DLGFRAME and not WS_CAPTION);
end;
procedure TForm1.CreateParams(var params: TCreateParams);
begin
inherited;
with params do begin
style := style and not WS_CAPTION;
end;
end;
end.