Userform with logo and without closebtn
Hi Michel,
it works very fine in deed. Thank you very much !
I've learned lots from this.
Best regards Klaus
Michel Pierron schrieb:
Hi Klaus,
To make simple, in a standard module:
Private Declare Function FindWindow& Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName$ _
, ByVal lpWindowName$)
Private Declare Function SendMessage& Lib "user32" _
Alias "SendMessageA" (ByVal hWnd&, ByVal wMsg& _
, ByVal wParam&, lParam As Any)
Private Declare Function RemoveMenu& Lib "user32" _
(ByVal hMenu&, ByVal nPosition&, ByVal wFlags&)
Private Declare Function GetSystemMenu& Lib "user32" _
(ByVal hWnd&, ByVal bRevert&)
Private Sub ChangeMenuBar(frm As Object)
Dim hWnd&, hIcon&
With frm
.Image3.Visible = False
hWnd = FindWindow(vbNullString, .Caption)
hIcon = .Image3.Picture.Handle
SendMessage hWnd, &H80, 0, ByVal hIcon
RemoveMenu GetSystemMenu(hWnd, 0), &HF060, 0
.Show
End With
End Sub
Sub UserForm1Show()
On Error Resume Next
Call ChangeMenuBar(UserForm1)
End Sub
Sub UserForm2Show()
On Error Resume Next
Call ChangeMenuBar(UserForm2)
End Sub
Regards,
MP
|