Hi there,
Do you know how can I send a message to a specific window and change it font.
Thanks
Printable View
Hi there,
Do you know how can I send a message to a specific window and change it font.
Thanks
If you can get its window handle, There are loads of different ways to do this depending on your situation.
insert the following code into a standard module
then put a new picturebox on your form, make it invisible and pass it, along with the handle of the window whose font you wish to change to the setwindow font functionCode:
Option Explicit
Private Const SYSTEM_FONT = 13
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Sub SetWindowFont(TargethWnd As Long, FontModel As PictureBox)
Dim hfont As Long
Dim hDC As Long
'get target DC
hDC = GetDC(TargethWnd)
'Get Font out of picturebox
hfont = SelectObject(FontModel.hDC, GetStockObject(SYSTEM_FONT))
'Put font back where you found it
SelectObject FontModel.hDC, hfont
'put font into target dc and delete old one
DeleteObject , SelectObject(hDC, hfont)
End Sub
Hope this helps
That kewl thanks for your reply sam.
Best wishes,
vbkids