?
Solved

Disable the BorderIcons?

Posted on 1998-10-31
10
Medium Priority
?
340 Views
Last Modified: 2008-03-17
How do I disable the close window BorderIcon(the X in upper right corner)?
0
Comment
Question by:Kmiller
[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
  • 5
  • 5
10 Comments
 
LVL 3

Expert Comment

by:vladika
ID: 1345222
type
  TForm1 = class(TForm)
  private
    procedure WMNCCreate(var Message: TWMNCCreate); message WM_NCCREATE;
  end;

implementation

procedure TForm1.WMNCCreate(var Message: TWMNCCreate);
var SysMenu: HMENU;
begin
  inherited;
  SysMenu := GetSystemMenu(Handle, False);
  DeleteMenu(SysMenu, SC_CLOSE, MF_BYCOMMAND);
end;

0
 
LVL 10

Accepted Solution

by:
viktornet earned 200 total points
ID: 1345223
Yes you could siable the needed part of the BorderIcons to False or you could use this one....

procedure SetCloseState( hForm: HWND; bEnabled: Boolean );
   var
     hSysMenu: HMENU;
   begin
     hSysMenu := GetSystemMenu( hForm, False );
     if ( hSysMenu <> 0 ) then begin
       if ( bEnabled )
       then EnableMenuItem( hSysMenu, SC_CLOSE, MF_ENABLED )
       else EnableMenuItem( hSysMenu, SC_CLOSE, MF_DISABLED or MF_GRAYED );
     end;
   end;

   Usage:
     SetCloseState( Form1.Handle, False ); // disables close button + menu item immediately
     SetCloseState( Form1.Handle, True ); //same here...

Note: The code isn't mine. I got it from John! 10x John =)

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:vladika
ID: 1345224
:(
0
Industry Leaders: 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 10

Expert Comment

by:viktornet
ID: 1345225
:-|

What;s up Vladika??? How are things in Russia??
0
 
LVL 3

Expert Comment

by:vladika
ID: 1345226
Very, very, very BAD :(
I still unemployed :(
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1345227
:( That's bad... Can't you find a job somewhere?? How come???

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:vladika
ID: 1345228
Do you mean emigration? It's interesting idea :)
But I am student now. Maybe after half a year.
BTW, Is there situation in USA
when bank block your bank account without reason? :(

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1345229
I'm still a high school student so I still don't know.. There is plenty of time I need until I get into college and so on.... Probably studying Computer Scinece and stuff like that.. Don't really know if there is anything cool around here.. Actually I'm absolutely sure that if you know MS VC++ and C++ as a whole and VB then you'll find a job for sure... There are vacancies for Delphi, but they need Database programming most of the time,... so I don;t really know...

P.S. Wish you luck whatever you decide =)

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:vladika
ID: 1345230
Thank you very much!
It (luck) will be very useful to me :)

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1345231
No prob :)

Vik
0

Featured Post

Industry Leaders: 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!

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

719 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