![]() |
|
Tipp 0231
|
Schließen-Schaltfläche deaktivieren
|
 |
|
Autor/Einsender: Datum: |
|
Angie 05.05.2002 |
|
| Entwicklungsumgebung: |
|
VB 5 |
|
|
|
Über die ControlBox-Eigenschaft kann man zwar das gesamte Systemmenü einer Form ausblenden, dies ist jedoch nicht immer erwünscht.
Sollen z.B. nur die Funktionen zum Schließen des Fensters (Schaltfläche und Menü-Eintrag) deaktiviert bzw. entfernt werden,
kann dies mit Hilfe von API-Funktionen realisiert werden.
|
|
| |
Option Explicit
Private Declare Function GetSystemMenu Lib "user32" (ByVal _
hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal _
hMenu As Long, ByVal nPosition As Long, ByVal _
wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal _
hWnd As Long) As Long
Private Const SC_CLOSE = &HF060
Private Const MF_BYCOMMAND = &H0
Private Sub Form_Load()
optButton(1).Value = True
End Sub
Private Sub optButton_Click(Index As Integer)
Select Case Index
Case 0
GetSystemMenu Me.hWnd, True
Case 1
DeleteMenu GetSystemMenu(Me.hWnd, False), _
SC_CLOSE, MF_BYCOMMAND
End Select
DrawMenuBar Me.hWnd
End Sub
|
|
|
|
|
|
|
| Windows-Version |
| 95 |
 |
|
| 98/SE |
 |
|
| ME |
 |
|
| NT |
 |
|
| 2000 |
 |
|
| XP |
 |
|
| Vista |
 |
|
| Win
7 |
 |
|
|
| VB-Version |
| VBA 5 |
 |
|
| VBA 6 |
 |
|
| VB 4/16 |
 |
|
| VB 4/32 |
 |
|
| VB 5 |
 |
|
| VB 6 |
 |
|
|
|
Download (2,4 kB)
|
Downloads bisher: [ 1596 ]
|
|
|