Solved

Form Icons

Posted on 2002-04-19
10
164 Views
Last Modified: 2012-05-04
Hello,

I would like to see on some Form the Minimize/Maximize Icons (Standart win icons) but not the close  icon ('x'),
How can i remove the 'x' icon

thank u
Asi
0
Comment
Question by:asi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 6953543
Hi!

Look at the Forms properties for BorderIcons
to disable the 'X' button set the biSystemMenu to false.

Regards,
Tomas Helgi
0
 
LVL 3

Expert Comment

by:raidos
ID: 6953550
As far as i know you can't remove it entirely, however you can disable it.

Assuming close is the last menuitem in the systemmenu this is how i do it.. =)

Procedure DisableClose(FormHandle: THandle);
Var
  Menu: hMenu;
Begin
  Menu := GetSystemMenu(FormHandle, False);
  If Menu <> 0 Then Begin
    EnableMenuItem(Menu, GetMenuItemCount(Menu)-1, MF_BYPOSITION OR MF_GRAYED)
    DrawMenuBar(Menu)
  End;
End;

Regards
//raidos
0
 
LVL 3

Expert Comment

by:raidos
ID: 6953554
Tomas:
That would disable the Minimize/Maximize icons as well...
and that's not what he asked for..

Regards
//raidos
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:DrDelphi
ID: 6953616
try this out:

var mnu:Hmenu;
begin
 mnu:=GetSystemMenu(self.handle,false);
 ModifyMenu(Mnu,SC_CLOSE,MF_BYCOMMAND,SC_CLOSE,nil);
 DrawMenuBar(self.handle);
end;


Good luck!!
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 6953622
Arrrgh...Raidos pretty much beat me to it!
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 6953788
Yes, you are right Raidos.
I didn't think to the end.
So, Asi! You should give the points to Raidos.
That solution is very good.
And yes Raidos pretty much beat us to it! ;)

Regards,
Tomas Helgi

0
 
LVL 3

Accepted Solution

by:
raidos earned 25 total points
ID: 6953866
Actually i think a combination of mine and drdelphis solution would be best..=)

Procedure DisableClose(FormHandle: THandle);
Var
  Menu : hMenu;
begin
  Menu := GetSystemMenu(FormHandle, false);
  If Menu <> 0 Then Begin
    EnableMenuItem(Menu, SC_CLOSE, MF_BYCommand Or MF_Grayed);
    DrawMenuBar(FormHandle);
  End;
end;

And I learned something new.. =)

Regards
//raidos
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 6953908
"Actually i think a combination of mine and drdelphis solution would be best.."


-surely you don't propose that asi split those 25 points, do you? It's okay for the 24, but that last 25th point could really get mangled! <g>


"And I learned something new"


-As did I... cool , huh?


0
 
LVL 3

Expert Comment

by:raidos
ID: 6953924
haha...no i don't propose anything.. =)

and i don't really care much about the points...he/she/it can award it to you DrDelphi, i won't have any sleepless nights over it.. =)

The only reason i hang around E-E is to learn new stuff, and no points in the world would teach me all that i've learned on E-E these past 2 years or something..

0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 6954128
I like to get the points, I admit that... but I am more interested in honing my skills. Just some good clean fun!!
<g>


Happy coding!!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question