Solved

Form Icons

Posted on 2002-04-19
10
158 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 24

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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 24

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now