Solved

Disable the BorderIcons?

Posted on 1998-10-31
10
339 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

631 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