VB :: Code & APIs

[VB.NET] 닫기 (X) 버튼 비활성화 하기

Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal bRevert As Integer) As Integer
Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
Public Const SC_CLOSE = &HF060&
Public Const MF_BYCOMMAND = &H0&

Function RemoveCloseButton(ByVal iHWND As Integer) As Integer
	Dim iSysMenu As Integer
	iSysMenu = GetSystemMenu(iHWND, False)
	Return RemoveMenu(iSysMenu, SC_CLOSE, MF_BYCOMMAND)
End Function

 

상단의 코드를 Form1 클래스 내에 삽입하시고 사용하실 때
RemoveCloseButton(Me.Handle) 해 주시면 아래와 같이 닫기 버튼이 비활성화 됩니다. ^^

 

Close-Button-Disabled

 

고맙습니다.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s