|
-
Jan 3rd, 2002, 12:51 PM
#1
Thread Starter
New Member
Working with complicated controls
Hi there!
There a simple form with a complicated control on it. Let's say, Outlook Bar control, for instance.
The task is to change font for a particular element of the control.
What is the general approach to resolve similar problems using API functions?
Thanks a lot in advance.
Vladimir
-
Jan 3rd, 2002, 12:56 PM
#2
Does the control have its own Font property?
-
Jan 3rd, 2002, 01:12 PM
#3
Thread Starter
New Member
Yes, it does but it does not work in runtime.
Besides Font property was implemented to change font for all elements of the control. I need to change font for selected element/s.
-
Jan 3rd, 2002, 01:22 PM
#4
You can get the hWnd of the element of the control - each one is a window.
Then you can use SendMessage hWnd, WM_SETFONT
Code:
' note the change in red
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As _
Long, ByRef wParam As Long, lParam As Any) As Long
Private Const WM_SETFONT = &H30
Call SendMessage hWnd,WM_SETFONT,hFont,True
hWnd - window handle
WM_SETFONT - tell the window to change fonts
hFont - Font handle - a LOGFONT structure passed ByRef
True - force a repaint with the new font.
-
Jan 3rd, 2002, 09:17 PM
#5
Thread Starter
New Member
I guess I need to clarify my example.
I can easily get Window handle via hWnd property of Outlook Bar. Then I can also get a set of Window handles of child windows via EnumChildWindows. The question is what then? No one of child windows is accepted SendMessage function. I cannot receive any information about these windows via GetClassInfo or GetClassInfoEx functions. They do not work in this case.
So the task could be stated this way: how to get the Window handle of the right window?
Best regards,
V.
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
|