home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / import1a / form3.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-20  |  1.8 KB  |  60 lines

  1. VERSION 5.00
  2. Begin VB.Form Form3 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Disable the X with a click of a command button"
  5.    ClientHeight    =   1380
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4635
  9.    LinkTopic       =   "Form3"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   1380
  13.    ScaleWidth      =   4635
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.CommandButton Command2 
  17.       Caption         =   "E&xit"
  18.       Height          =   615
  19.       Left            =   0
  20.       TabIndex        =   1
  21.       Top             =   720
  22.       Width           =   4695
  23.    End
  24.    Begin VB.CommandButton Command1 
  25.       Caption         =   "Disable The X"
  26.       Height          =   735
  27.       Left            =   0
  28.       TabIndex        =   0
  29.       Top             =   0
  30.       Width           =   4695
  31.    End
  32. Attribute VB_Name = "Form3"
  33. Attribute VB_GlobalNameSpace = False
  34. Attribute VB_Creatable = False
  35. Attribute VB_PredeclaredId = True
  36. Attribute VB_Exposed = False
  37. Private Sub Command1_Click()
  38. Dim hSysMenu As Long
  39. Dim nCnt As Long
  40. ' First, show the form
  41. ' Get handle to our form's system menu
  42. ' (Restore, Maximize, Move, close etc.)
  43. hSysMenu = GetSystemMenu(Me.hwnd, False)
  44. If hSysMenu Then
  45. ' Get System menu's menu count
  46. nCnt = GetMenuItemCount(hSysMenu)
  47. If nCnt Then
  48. ' Menu count is based on 0 (0, 1, 2, 3...)
  49. RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
  50. RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE
  51. ' Remove the seperator
  52. DrawMenuBar Me.hwnd
  53. ' Force caption bar's refresh. Disabling X button
  54. Me.Caption = "Omg...The Caption Changed too"
  55. End If
  56. End If
  57. End Sub
  58. Private Sub Command2_Click()
  59. End Sub
  60.