Solved

Disable the BorderIcons?

Posted on 1998-10-31
10
334 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 121
Press three keys together and trigger a function 3 55
Firemonkey android show image from resource ? 1 41
update joined tables 2 45
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 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

15 Experts available now in Live!

Get 1:1 Help Now