Lompat ke konten Lompat ke sidebar Lompat ke footer

Disabled Restore,Move,Minimize,Maximize,Separator,Close Windows MDIForm VB6

Berikut ini adalah cara men-disabled tombol close di MDIForm di visual basic 6, untuk mempraktekannya siapkan :


          Option Explicit

          Private Declare Function DeleteMenu _
                          Lib "user32" (ByVal hMenu As Long, _
                          ByVal nPosition As Long, _

                          ByVal wFlags As Long) As Long

          Private Declare Function GetSystemMenu _
                          Lib "user32" (ByVal hwnd As Long, _
                          ByVal bRevert As Long) As Long

          Private Const MF_BYPOSITION = &H400&
          
          Dim blnKeluar As Boolean

          Dim hMenu As Long
          
          Private Sub RemoveMenus(frm As Form, _
                       remove_restore As Boolean, _

                       remove_move As Boolean, _
                       remove_size As Boolean, _
                       remove_minimize As Boolean, _
                       remove_maximize As Boolean, _
                       remove_seperator As Boolean, _

                       remove_close As Boolean)

            'Get the form's system menu handle.
            hMenu = GetSystemMenu(hwnd, False)

            If remove_close Then DeleteMenu hMenu, 6, MF_BYPOSITION
            If remove_seperator Then DeleteMenu hMenu, 5, MF_BYPOSITION
            If remove_maximize Then DeleteMenu hMenu, 4, MF_BYPOSITION
            If remove_minimize Then DeleteMenu hMenu, 3, MF_BYPOSITION

            If remove_size Then DeleteMenu hMenu, 2, MF_BYPOSITION
            If remove_move Then DeleteMenu hMenu, 1, MF_BYPOSITION
            If remove_restore Then DeleteMenu hMenu, 0, MF_BYPOSITION
          End Sub

          Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
            If blnKeluar = False Then
              Cancel = -1
            Else

              UnloadMode = 1
            End If
          End Sub

          Private Sub MDIForm_Load()
            RemoveMenus Me, False, False, _
            False, False, False, True, True
            blnKeluar = False
          End Sub

          Private Sub mnuExit_Click()
            blnKeluar = True
            Unload Me

          End Sub

Tags:
contoh program vb6, contoh fungsi di vb6, cara penggunaan fungsi vb, tutorial vb6, download tutorial vb6, vb6 tutorial download, dasar dasar vb6, belajar vb6, cara mudah belajar vb6, vb6 artikel download, vb6 blog, contoh program vb6, artikel vb6, semua tentang vb6, vb6 api, cara menggunakan module, cara menggunakan class module

Posting Komentar untuk "Disabled Restore,Move,Minimize,Maximize,Separator,Close Windows MDIForm VB6"