Frage zu API Funktionen
Peter
Code im Codebereich der UserForm
Hallo Leute,
eine API Funktion wie dieses Beispiel wird im Codebereich der UserForm gespeichert.
Ist es möglich den Code so zu verändern, dass er in allen Userformen in der Datei funktioniert?
Peter
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
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 Const MF_BYCOMMAND = &H0
Private Const SC_MOVE = &HF010
Private Sub UserForm_Activate()
Dim hwndForm As Long
Dim hwndMenu As Long
hwndForm = FindWindow(vbNullString, Me.Caption)
If hwndForm 0 Then
hwndMenu = GetSystemMenu(hwndForm, 0)
If hwndMenu 0 Then
DeleteMenu hwndMenu, SC_MOVE, MF_BYCOMMAND
End If
End If
End Sub