Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

'module

Option Explicit

Private Const FOCO_ICONE = &H80


Private Const ICONE = 0&
#If VBA7 Then
Private Declare PtrSafe Function SendMessageA Lib "user32" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
As Long
Private Declare PtrSafe Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "user32" _
(ByVal hWnd As Long) As Long

#Else

Private Declare Function SendMessageA Lib "user32" _


(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function DrawMenuBar Lib "user32" _
(ByVal hWnd As Long) As Long

#End If

Public Sub SystemBarMessageASettings(frm As Object, imj As Object)


Dim windowHandle As Long
Dim hIcone As Long
windowHandle = FindWindowA(vbNullString, frm.Caption)

hIcone = imj.Picture.Handle
Call SendMessageA(windowHandle, FOCO_ICONE, ICONE, ByVal hIcone)

DrawMenuBar windowHandle
End Sub

priv sub userform activate


SystemBarMessageASettings Me, Me.image1
end sub

You might also like