VB .Net Tutorials: How to disable the exit button and Alt-F4

preview_player
Показать описание
VB .Net Tutorials: How to disable the exit button and Alt-F4. This is a very simple way to disable the exit button in Visual Basic. It will stop the exit button from being pressed and will disable Alt-F4. Though this will not disable a form button closing the window.

Copy and Paste Code:

Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property
Рекомендации по теме
Комментарии
Автор

OMG i have been looking for this code for like 10 mins, Thx a lot and keep it up! XD

"good pay in programming"

ElixirEcho
Автор

Awesome, but how to make it  stay opened even when right clicking it in the taskbar and then cliking Close?

ApplicationBot
Автор

Dude. Thank you! Been looking online forever for this and none of the answers I found work. But this totally did!

buddyroach
Автор

how to disable ctrl+alt+F4 PLZ help me thanks

Daniel-qouv
Автор

thank you
but task manager can close it

aaasssaaammm
Автор

You can deactive the task manager and Hide it from the taskbar its possible


athfj
Автор

What if I want to Close the Application in the Taskbar or in the process task manager ? is there a way to also restrict that ?

ejies
Автор

thank you, now how do i disable ctrl alt del and alt tab?

sc
Автор

Thanks for the tutorial it helped me Big Time :)

Red-impb
Автор

Good but I don't know in Microsoft Access VBA. If you know please help me. Thanks

HeapKhim
Автор

i'd like to know how to disable on Task manager

khavyAnything
Автор

hey dude,
Tell me That How can i do this if I am clicking the button and then the close button will be disable, but as the task get completed.
Close button will be enable
reply soon

DMTutorial
Автор

can you copy that source code in this, pliss, I didn't look that,

yozajakatianda
Автор

' You could Add this to After your code:

Private Sub FormClosing(ByVal sender As System.Object, ByVal e As Handles MyBase.Closing
If MessageBox.Show("Are you sure to exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
End Sub

' The user will be prompted when closing. XD

ElixirEcho
Автор

WARNING this code works only on your pc not on other pcs the pc will protect it from pening crap

weshuiz
Автор

with all these tutorials on how to disable the task manager and exit and alt+F4 I could make a kick ass virus... I wouldn't but its a thought...

dogbunns
Автор

it's "CS_NOCLOSE" you miss-spelled you have wrote "CS_NOSLOSE"

DMTutorial