View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Michel Pierron[_2_] Michel Pierron[_2_] is offline
external usenet poster
 
Posts: 63
Default Newbie: How to define the font size in the status bar window?

Hi Frank;

Private Declare Function FindWindow& Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2& _
, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function GetDC& Lib "user32" (ByVal hWnd&)
Private Declare Function CreateFont& Lib "gdi32" Alias _
"CreateFontA" (ByVal nHeight&, ByVal nWidth& _
, ByVal nEscapement&, ByVal nOrientation&, ByVal fnWeight& _
, ByVal fdwItalic As Boolean, ByVal fdwUnderline As Boolean _
, ByVal fdwStrikeOut As Boolean, ByVal fdwCharSet& _
, ByVal fdwOutputPrecision&, ByVal fdwClipPrecision& _
, ByVal fdwQuality&, ByVal fdwPitchAndFamily&, ByVal lpszFace$)
Private Declare Function SelectObject& Lib "gdi32" (ByVal hDC&, ByVal hObject&)
Private Declare Function DeleteObject& Lib "gdi32" (ByVal hObject&)
Private Declare Function ReleaseDC& Lib "user32" (ByVal hWnd&, ByVal hDC&)

Sub StatusBarTest()
Dim BarState As Boolean, hWnd&, hDC&, hFont&, hObj&
BarState = Application.DisplayStatusBar
Application.DisplayStatusBar = True
hWnd = FindWindow(vbNullString, Application.Caption)
hWnd = FindWindowEx(hWnd, ByVal 0&, "EXCEL4", vbNullString)
hDC = GetDC(hWnd)
hFont = CreateFont(-12, 0, 0, 0, 700, 1, 1, 0, 0, 0, 0, 0, 0, "Times New Roman")
hObj = SelectObject(hDC, hFont)
Application.StatusBar = "This is my new police for StatusBar !"
MsgBox "How's that ?", 64
Application.StatusBar = False
SelectObject hDC, hObj
DeleteObject hFont
ReleaseDC hWnd, hDC
Application.DisplayStatusBar = BarState
End Sub

MP

"Frank Krogh" a écrit dans le message de
...
How do I define the font size in the status bar window before I apply the
Application.StatusBar = "text" ?

Thanks for any suggestion.


Frank