AW: Das X muß weg! Und Userform unverschiebbar?
03.02.2006 14:43:08
Heiko
Hallo Marc,
diesen Code ins Codefenster des Userforms, WICHTIG einen Button drin haben um es wieder zu schließen.
Der Code ist von K.Rola !
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
Sub Kreuz_weg(objUF As Object)
Dim hWnd As Long, lStyle As Long
Select Case Int(Val(Application.Version))
Case 8
hWnd = FindWindow("ThunderXFrame", objUF.Caption)
Case 9 To 11
hWnd = FindWindow("ThunderDFrame", objUF.Caption)
End Select
lStyle = GetWindowLong(hWnd, 0)
SetWindowLong hWnd, GWL_STYLE, lStyle Or WS_MAXIMIZEBOX
End Sub
Private Sub CommandButton1_Click()
' Button im Userform damit man es wieder schliessen kann, NICHT Vergessen
Unload Me
End Sub
Private Sub UserForm_Initialize()
Call Kreuz_weg(Me)
End Sub
Gruß Heiko
PS: Rückmeldung wäre nett !