Solved

Disable the BorderIcons?

Posted on 1998-10-31
10
336 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 50 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

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
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…

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