![]() |
|
[.NET] [Snippet] Disable Close [X] Button - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [Snippet] Disable Close [X] Button (/showthread.php?tid=2267906) |
[Snippet] Disable Close [X] Button - SomeWhiteGuy - Mar 3, 2012 I was looking for something like this, and found it. So, i thought i would share it with anyone else needing it. Code Private Const CP_NOCLOSE_BUTTON As Integer = &H200All you do is paste that into your form. Works perfectly. Of course you could probably use this for some sort of malicious purpose but i was using it so they would have to Right Click > Exit instead of just being able to close the form. (There's a reason behind it.) Have fun! Spoiler (Click to View) * - Marketplace - Mar 3, 2012 Can't they go to task manager and end it from there? Or will it reopen again? * - +Bourbon - Mar 3, 2012 Pretty nice but I'd rather just PHP Code * - SomeWhiteGuy - Mar 3, 2012 (Mar 3, 2012 09:45 AM)AlphaSquad Wrote: Can't they go to task manager and end it from there? Or will it reopen again? This doesn't stop your application from closing, it's disables the close button. Yes, they can open up task manager and it will close it if they click end. * - Coleak - Mar 3, 2012 (Mar 3, 2012 09:55 AM)SomeWhiteGuy Wrote: This doesn't stop your application from closing, it's disables the close button. Yes, they can open up task manager and it will close it if they click end. Either way, pretty good stuff here, good job. * - idb. - Mar 3, 2012 You could also just disable the ControlBox property on the form, although that would cause the icon to disappear as well. * - SomeWhiteGuy - Mar 3, 2012 (Mar 3, 2012 12:07 PM)idb Wrote: You could also just disable the ControlBox property on the form, although that would cause the icon to disappear as well. That causes all icons to disappear. I wanted to keep the minimize and maximize buttons. But yes, you are correct. * - ( ͡° ͜ʖ ͡°) - Mar 3, 2012 Thanks for this man, I was always wondering how to do that 🙂 * - Raf Simons - Mar 3, 2012 Does it make the button grayed out or just disable it but still make it clickable? * - SomeWhiteGuy - Mar 3, 2012 (Mar 3, 2012 01:16 PM)Camilo543 Wrote: Does it make the button grayed out or just disable it but still make it clickable? It disables it, like if you disable the maximize button it would look like that. [img]http://imgs.ps3-forums.net/xboxmb/vWeDeDIgVGaLxcQLUwFW.png[/img] * - Suckage - Mar 3, 2012 It's more sleek-looking than some other solutions :p Nice find. * - Braco22 - Mar 4, 2012 Thanks very much for this snippet, OP. I've implemented it in my program, expect to see your name in there. |