Solved

Form Icons

Posted on 2002-04-19
10
160 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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 convert wav to mp3 in delphi 9 199
Best Firemonkey component pack 1 103
Virtuailstring tree add node to another virtuailstring tree list 4 115
oracle global variables 4 68
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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