views:

499

answers:

2

Is it possible to disallow minimizing of a form\application in delphi ?

I found the following code

procedure TForm1.WMShowWindow(var Msg: TWMShowWindow);
begin
  if not Msg.Show then
    Msg.Result := 0
  else
    inherited;
end;

but if I press windows key + M or Windowskey + D, then it still gets minimized is there a way to prevent this?

+10  A: 

Setting BorderIcons.bsMinimized to false (removing it from the set) will work for WindowsKey + M but will not stop WindowsKey + D. I think that makes sense. The difference between the two is the first is asking all windows to minimize while the second is an explicit request by the user to see their desktop. Overriding the latter would probably annoy the user (similiar to forcing yourself into focus).

Ryan VanIderstine
Thanks Ryan for your input
Anna
+2  A: 

or you can place a keyboard hook and catch winkey+d or winkey+m and keep your form maxmized.

avar
and annoy the bejeezus out of your users... Nevertheless, +1 for it being a correct solution.
Lieven
in my case the user wants it to stay maximised
Anna
Hello Avar , thank you for your comment , can you please give me the code to keep the form maximised
Anna
Anna, this may be what you are looking for (more like a kiosk). http://stackoverflow.com/questions/14451/what-is-the-best-way-to-make-a-delphi-application-completely-full-screen
Ryan VanIderstine
i found something interesting :"Show Desktop" sends the command "ToggleDesktop", which, among other things, posts a DTM_RAISE message (WM_USER + 83) to the Desktop (Progman) to set it on foreground."http://www.eggheadcafe.com/forumarchives/win32programmerui/Jun2005/post23443993.aspi'll try to write something with this, need time :)
avar
hi ann, today i'v tested something,in the form create method put something likevar progmanhandle : Thandle;progmanhandle:=findwindow('Progman','Program Manager'); if progmanhandle <> 0 thenbeginParentWindow:= progmanhandle;end;that will attach your form as child of desktop, and never hide with winkey+d or winkey+m;but when you start your app i didn't show itself as usual.
avar