| 
 | 
 | 
 
Home » U++ Library support » TopWindow&PopUp, TrayIcon » How to remove the button [X] that closes the window? 
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: How to remove the button [X] that close the window [message #2853 is a reply to message #2852] | 
			Fri, 28 April 2006 10:25    | 
		 
		
			
				
				
				
					
						  
						gprentice
						 Messages: 260 Registered: November 2005  Location: New Zealand
						
					 | 
					Experienced Member  | 
					 | 
		 
		 
	 | 
 
	
		See this post. 
 
(Edit by fudadmin: url removed, topics merged.) 
 
Disable the close button 
 
EnableMenuItem( GetSystemMenu( hWnd, 0 ), SC_CLOSE, MF_BYCOMMAND 
|MF_DISABLED ); 
 
 
 
Remove the close button (I think). 
 
HMENU hMenu = GetSystemMenu( hWnd, 0 ); 
int nNbItems = GetMenuItemCount(hMenu); 
RemoveMenu(hMenu, nNbItems - 1, MF_BYPOSITION); 
RemoveMenu(hMenu, nNbItems - 2, MF_BYPOSITION); 
 
 
And handle WM_SYSCOMMAND (SC_CLOSE) if you want also to disable [Alt]+[F4] 
		
		
		[Updated on: Fri, 28 April 2006 10:52] by Moderator Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 02:58:40 CET 2025 
 Total time taken to generate the page: 0.04329 seconds 
 |   
 |  
  |