View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Klaus Heinrich Klaus Heinrich is offline
external usenet poster
 
Posts: 7
Default Userform with logo and without closebtn

Hi Michel,

optimizing my code I declared APIs in general module now and reduced
form initalization to the following lines:

Private Sub UserForm_Initialize()
Dim hWnd&: hWnd = FindWindow(vbNullString, Me.Caption)
Image3.Visible = False ' hide image3 on form
SendMessage hWnd, &H80, 0, ByVal Image3.Picture.Handle
RemoveMenu GetSystemMenu(hWnd, 0), &HF060, 0
End Sub

If I want to use a sub like this and call it during initialization of
several forms
I can not use "Me" but I have to transmitt it to the sub. How can
I do this ?

Sub ChangeMenuBar()
Dim hWnd&: hWnd = FindWindow(vbNullString, Me.Caption) <----
Image3.Visible = False ' hide image3 on form
SendMessage hWnd, &H80, 0, ByVal Image3.Picture.Handle
RemoveMenu GetSystemMenu(hWnd, 0), &HF060, 0
End Sub



Thanks

Klaus
Michel Pierron schrieb:

Re Klaus Heinrich,
It is normal; if you want to have an icon, you cannot remove the totality
of the system menu.
MP