AW: Hallo nepumuk
19.09.2010 09:28:27
Nepumuk
Hallo,
zu 2. Das kommt daher, dass die API-Funktionen die Titelleiste überschreiben. Damit wird die Fläche des Userform um diesen Teil höher. Den müssen wir wieder abziehen.
zu 1.
' **********************************************************************
' Modul: Splash Typ: Userform
' **********************************************************************
Option Explicit
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32.dll" ( _
ByVal hWnd As Long) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByRef lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Const GC_CLASSNAMEMSEXCELFORM = "ThunderDFrame"
Private Const GWL_STYLE = -16
Private Const WS_CAPTION = &HC00000
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private hWndForm As Long
Private Sub BTN_Continue_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
'suche das Handle des Userforms
hWndForm = FindWindow(GC_CLASSNAMEMSEXCELFORM, Me.Caption)
If hWndForm <> 0 Then
'SetWindowLong = Setze ein Attribut in den Windowspeicher des Userforms
'GetWindowLong = Lese das Attribut des Windowspeichers des Userforms
SetWindowLong hWndForm, GWL_STYLE, GetWindowLong(hWndForm, GWL_STYLE) And Not WS_CAPTION
'Erstelle die Menübar des Fensters neu
DrawMenuBar hWndForm
'Von der ursprünglichen Höhe des Userforms die Höhe der Titelleiste abziehen
Height = Height - 12
End If
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
'Stelle die normale Maus-Input Verarbeitung wieder her
ReleaseCapture
'Setze die Mausfunktion zum verschieben auf das gesamte Fenster des Userforms
SendMessage hWndForm, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
Die Verschiebbarkeit des Userforms funktioniert aber bei dir nicht mehr, das die gesamte Fläche durch das Image überdeckt wird und ich keine Möglichkeit habe ein Handle eines Image-Controls aus der FM20.dll zu ermitteln. Warum bettest du das Bild eigentlich nicht direkt in das Userform ein, wenn es sowieso die gesamte Fläche füllt?
Gruß
Nepumuk