AW: Button fixieren bzw. verankern
24.03.2005 09:06:18
Dirk
Guten Morgen Herbert,
es ging deshalb nicht, da der Button genau so groß wie dei UserForm war und ich deshalb nichts zum Anklicken hatte ;-/
Tut mir wirklich leid, wenn ich langsam nerve, aber leider bekomm ich immer noch folgende Fehlermeldung:
'Nach End Sub
, End Function
oder End Property können nur Kommentare stehen.'
Die Meldung bezieht sich auf den Abschnitt
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Mein Code in der UserForm sieht jetzt folgendermaßen aus:
Private Sub UserForm_Click()
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
-----ab hier Fehlermeldung-----
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong _
Lib "User32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function DrawMenuBar Lib "User32" ( _
ByVal hwnd As Long) As Long
Private Function fncHasUserformCaption(bState As Boolean)
Dim Userform_hWnd As Long
Dim Userform_Style As Long
Dim Userform_Rect As RECT
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Userform_hWnd = FindWindow( _
lpClassName:=IIf(Val(Application.Version) > 8, _
"ThunderDFrame", "ThunderXFrame"), _
lpWindowName:=Me.Caption)
Userform_Style = GetWindowLong(hwnd:=Userform_hWnd, _
nIndex:=GWL_STYLE)
If bState = True Then
Userform_Style = Userform_Style Or WS_CAPTION
Else
Userform_Style = Userform_Style And Not WS_CAPTION
End If
Call SetWindowLong(hwnd:=Userform_hWnd, nIndex:=GWL_STYLE, _
dwNewLong:=Userform_Style)
Call DrawMenuBar(hwnd:=Userform_hWnd)
End Function
Private Sub UserForm_Initialize()
Dim m_hWndXl
Call fncHasUserformCaption(False)
Application.Caption = "My Unique Caption"
m_hWndXl = FindWindow("XLMAIN", Application.Caption)
Application.Caption = Empty
End Sub
?