Solved

Form Icons

Posted on 2002-04-19
10
166 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

624 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