Userform ohne schliessen Kreuz mit Logo
- From: Klaus Heinrich <test@xxxxxxx>
- Date: Sat, 05 Nov 2005 20:29:45 +0100
Hallo NG
ich habe viel gegoogelt und dabei folgende Funktion gefunden:
"Das schliessen Kreuz beim Userform ausblenden ":
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As LongPrivate Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function DrawMenuBar Lib "user32" (ByVal _
hwnd As Long) As LongPrivate Const GWL_STYLE As Long = -16 Private Const WS_SYSMENU As Long = &H80000
Private hWndForm As Long Private bCloseBtn As Boolean
Private Sub UserForm_Initialize()
If Val(Application.Version) >= 9 Then
hWndForm = FindWindow("ThunderDFrame", Me.Caption)
Else
hWndForm = FindWindow("ThunderXFrame", Me.Caption)
End IfbCloseBtn = False SetUserFormStyle
End Sub
Private Sub SetUserFormStyle() ' Unterdrückung des "schließen Kreuzes" in Userform Dim frmStyle As Long
If hWndForm = 0 Then Exit Sub
frmStyle = GetWindowLong(hWndForm, GWL_STYLE)
If bCloseBtn Then frmStyle = frmStyle Or WS_SYSMENU Else frmStyle = frmStyle And Not WS_SYSMENU End If
SetWindowLong hWndForm, GWL_STYLE, frmStyle
DrawMenuBar hWndForm End Sub
Funktioniert super auch wenn es von einer VB Seite ist !
Nun gibt es eine weitere Funktion: "Eigenes Logo in Userform"
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As LongPrivate Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex _
As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex _
As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Integer, ByVal lParam As Long) As LongPrivate Declare Function DrawMenuBar Lib "user32" (ByVal _
hWnd As Long) As LongPrivate wHandle As Long
Private Sub UserForm_Initialize()
On Error Resume Next
Me.Caption = "Userform mit Icon"
Image1.Visible = False
Image2.Visible = False
If Val(Application.Version) >= 9 Then
wHandle = FindWindow("ThunderDFrame", Me.Caption)
Else
wHandle = FindWindow("ThunderXFrame", Me.Caption)
End If
If wHandle = 0 Then Exit Sub
hIcon = Image1.Picture
SendMessage wHandle, &H80, True, hIcon
SendMessage wHandle, &H80, False, hIcon
frm = GetWindowLong(wHandle, -20)
frm = frm And Not &H1
SetWindowLong wHandle, -20, frm
DrawMenuBar wHandle
End Sub
Wie bekomme ich die beiden kombiniert ? Die API Deklarationen scheinen gleich zu sein, dennoch gelingt es mir nicht die Aufrufe zu kombinieren, oder schliessen sie sich aus ?
Danke im Voraus
Gruß Klaus .
- Prev by Date: Re: Formelfrage: Zellenwert übertragen aber wenn Leer nicht
- Next by Date: Re: Schreibschutz
- Previous by thread: zellwerte auf größer/kleiner vergleich und formatieren
- Next by thread: Re: Userform ohne schliessen Kreuz mit Logo
- Index(es):
Relevant Pages
|