Creating your own control... Custom font issues...
I am creating a URL static control, which I guess would be simular to the windows SysLink control... The reason I am creating this is because the SysLink control is not available unless users have the CommCtrl32.dll version 6.+.
Handled messages:
WM_SETFONT:
If the controls style has the underline style set, I get the LOGFONT structure for the font being passed in and set the lfUnderline member to true, and create a new font. This new font is stored in a struct, which is unique for each control of this class.
WM_PAINT:
I select the font stored in the controls struct into the current DC, and draw the text... after I do this I select the original font back into the DC.
WM_LBUTTONDOWN:
Changes the controls mode ( changes the color ) and forces the control to be repainted.
The problem is when I click on the control... the text color is changed fine and the font that should be used... is.... But... the font for other controls on the Dialog are changed... to Shell Dlg or something, which I didn't expect to happen...
I was wondering if anyone had any ideas why this may be happening or any tips when using custom fonts.
One thing: you should make your control UNICODE-compatible NOW. It is always harder to do it later, and it is harder to make a dll compatible than an exe (dlls should have both in one, unlike exes)
All the buzzt CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Do I export two functions on UNICODE and the other not?
and then in the header file define macros to point to the correct one... kinda like how MS does it?
Have one function SomethingA() and another SomethingW(), and then define a macro Something() that changes depending on whether or not UNICODE is defined??
Shoud the internals of the DLL use UNICODE, and the ANSI functions converts its string input into UNICODE?
Yep, exactly.
Just be careful when using UNICODE on the internal functions because Win9x does not support much UNICODE (just a few like MessageBoxW). If somewhere you are using a W function that is not implemented in 9x you have to completly rewrite the A version of your function. (And therefore all that call it).
It's mainly a copy, paste 'n' correct thing, but it blows up the dll.
All the buzzt CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.