I have no clue where this belongs, but I'm posting here anyways (maybe
vcl.components.using would be better?)
If I create an empty project, run it and have the form floating in the middle
of my screen (ie not maximized/minimized),
If I right-click the caption, I get
- restore (disabled)
- move
- change size
- minimize
- maximize
and - close
So far so good. Doing the same with any other application (non-Delphi I
suspect, I am using Winword for it right now) it gets me the same thing.
Now if I click the other applications task-bar button, I get the same menu as
on its caption. But if I click the Delphi app task-bar button, I only get
- restore (disabled)
- minimize
and - close
Does this have to do with the extra (invisible) application window, and if so,
how would I be able to change it?
johannes
--
Please reply in this newsgroup only
- SIP solutions -
http://www.sipsolutions.de/
Add the following in the OnCreate-event.
AppendMenu(GetSystemmenu(Application.Handle, False), MF_SEPARATOR, 0, '');
AppendMenu(GetSystemmenu(Application.Handle, False), MF_STring, idSysAbout,
'Tekst');
It works the same as if you add items to the systemmenu of a form.
Alfred.
Johannes Berg <johannes....@gmx.net> schreef in berichtnieuws
39072304...@gmx.net...
So you think I should add all those missing items windows usually does by
myself? But they are localized and mine would not be, right?
> So you think I should add all those missing items windows usually does by
> myself? But they are localized and mine would not be, right?
>
Right. I wish I had a better solution.
Alfred.
Yes, the taskbar button belongs to this window and so does the system menu you
see.
> and if so, how would I be able to change it?
Why would you want to? The three actions you see in the taskbar button menu are
the only ones that can be applied to the *application* as a whole. If you want
the button to really represent the main form (e.g. since there are no other
forms anyway) then you may want to change the apps default architecture a bit to
really make the taskbar button belong to the main form instead of the
Application window.
In the main forms FormCreate do this
ShowWindow( Application.handle, SW_HIDE );
SetWindowLong( Application.handle,
GWL_EXSTYLE,
GetWindowLong( application.handle, GWL_EXSTYLE ) and
not WS_EX_APPWINDOW or WS_EX_TOOLWINDOW);
ShowWindow( Application.handle, SW_SHOW );
That removes the application button from the taskbar.
The main form gets a handler for the WM_SYSCOMMAND message:
private // form declaration
Procedure WMSyscommand(Var msg: TWmSysCommand);
message WM_SYSCOMMAND;
Procedure TForm1.WMSyscommand(Var msg: TWmSysCommand);
Begin
Case (msg.cmdtype and $FFF0) of
SC_MINIMIZE: Begin
ShowWindow( handle, SW_MINIMIZE );
msg.result := 0;
End;
SC_RESTORE: Begin
ShowWindow( handle, SW_RESTORE )
msg.result := 0;
End;
Else
inherited;
End;
End;
This disables the default minimization behaviour.
To get a task bar button for the form and have it minimize to the taskbar
instead of to the desktop, override the CreateParams method of the main form and
also of all the secondary forms:
// in form declaration
Procedure CreateParams( Var params: TCreateParams ); override;
Procedure TForm1.CreateParams( Var params: TCreateParams );
begin
inherited CreateParams( params );
params.ExStyle := params.ExStyle or WS_EX_APPWINDOW;
end;
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Is there still an invisible application window in Delphi *5*?
Regards
Peter
Thats a nice one Peter,
Thanks for the tip,
Alfred.
Peter Below (TeamB) <10011...@compuXXserve.com> schreef in berichtnieuws
VA.00004f0...@antispam.compuserve.com...
[snip]
Ok, I figured that. Why is the application window actually necessary? Probably
too much though, maybe there's an article on it?
> > and if so, how would I be able to change it?
>
> Why would you want to? The three actions you see in the taskbar button menu are
> the only ones that can be applied to the *application* as a whole.
Well, I don't have two forms, and it might bother some users. Probably
bothered me more than any users though...
> If you want
> the button to really represent the main form (e.g. since there are no other
> forms anyway) then you may want to change the apps default architecture a bit to
> really make the taskbar button belong to the main form instead of the
> Application window.
> [snipped code]
thanks a lot! :)
apparently. I am using D5P
Otherwise the main form would need very different treatment than all
the other forms and that would have complicated the code for
TCustomForm/TForm a lot, i assume. Borland decided on this architecture
in D1 and changing it would break any amount of existing code, so is no
option. It also works well for nearly all purposes, so there is really
no incentive to change it. I'm sure any alternative solution would have
its own problems as well.