CoolDisable Exit Button?

Posts 1–8 of 8 · Page 1 of 1
Disable Exit Button?
I´ve seen this in many installers that the exit button is disabled(grey)

I need to do this in my special installer

I have google the question but only found it for vb6 and i want 08

So, how do i disable the exit button, i dont want you to say
Code:
e.cancel = true
Thanks

Hejsan1
btnCancel.Enabled = False
go to the propertise and untick Close button on the form or ad e.cancel = tre in the formClosing event
Quote Originally Posted by HazXoD3D View Post
go to the propertise and untick Close button on the form or ad e.cancel = tre in the formClosing event
Can you guys read my fucking post!

IT SAYS: i dont want you to say

Code:
e.cancel = true

And

Code:
btnCancel.Enabled = False
found it for vb6 and i want 08
Quote Originally Posted by Zoom View Post
Can you guys read my fucking post!

IT SAYS: i dont want you to say

Code:
e.cancel = true

And

Code:
btnCancel.Enabled = False
found it for vb6 and i want 08
that probably didn't help either

If you want to disable the X, you can do it numerous ways

try

Code:
' Declaraions and Functions
 Private Const MF_BYPOSITION = &H400
    Private Const MF_REMOVE = &H1000
    Private Const MF_ DISABLED = &H2

  Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As IntPtr, ByVal nPosition As Integer, ByVal wFlags As Long) As IntPtr
    Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr
    Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As IntPtr) As Integer
    Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As IntPtr) As Boolean

Public Sub DisableCloseButton(ByVal hwnd As IntPtr)
        Dim hMenu As IntPtr
        Dim menuItemCount As Integer

        hMenu = GetSystemMenu(hwnd, False)
        menuItemCount = GetMenuItemCount(hMenu)
        Call RemoveMenu(hMenu, menuItemCount - 1, MF_DISABLED Or MF_BYPOSITION)
        Call RemoveMenu(hMenu, menuItemCount - 2, MF_DISABLED Or MF_BYPOSITION)
        Call DrawMenuBar(hwnd)
    End Sub
on form load call this

Code:
DisableCloseButton(Me.Handle)
Have fun
Quote Originally Posted by NextGen1 View Post
that probably didn't help either

If you want to disable the X, you can do it numerous ways

try

Code:
' Declaraions and Functions
 Private Const MF_BYPOSITION = &H400
    Private Const MF_REMOVE = &H1000
    Private Const MF_ DISABLED = &H2

  Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As IntPtr, ByVal nPosition As Integer, ByVal wFlags As Long) As IntPtr
    Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr
    Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As IntPtr) As Integer
    Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As IntPtr) As Boolean

Public Sub DisableCloseButton(ByVal hwnd As IntPtr)
        Dim hMenu As IntPtr
        Dim menuItemCount As Integer

        hMenu = GetSystemMenu(hwnd, False)
        menuItemCount = GetMenuItemCount(hMenu)
        Call RemoveMenu(hMenu, menuItemCount - 1, MF_DISABLED Or MF_BYPOSITION)
        Call RemoveMenu(hMenu, menuItemCount - 2, MF_DISABLED Or MF_BYPOSITION)
        Call DrawMenuBar(hwnd)
    End Sub
on form load call this

Code:
DisableCloseButton(Me.Handle)
Have fun
You are so fucking awesome! THANK YOU SO MUCH! YOU`re the BEST!
Not a problem, any time, and thank you
Problem solved

/Closed
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us