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
Solved

Form Icons

Posted on 2002-04-19
10
162 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
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
How to fill array with TArray.Create? 14 96
Internet Explorer View Settings Question 15 116
enhance the following code 3 37
delphi popmenu non latine charcters 3 13
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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