|
-
Mar 15th, 2000, 07:24 PM
#1
Thread Starter
Junior Member
Hi there,
Do you know how can I send a message to a specific window and change it font.
Thanks
-
Mar 15th, 2000, 08:25 PM
#2
Frenzied Member
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
Code:
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
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 function
Hope this helps
-
Mar 16th, 2000, 05:22 PM
#3
Thread Starter
Junior Member
That kewl thanks for your reply sam.
Best wishes,
vbkids
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|