Sign in to follow this  

C++ - win32: can i change the window controls font?

This topic is 415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

for change the wiindow controls font:

void setFont(HFONT font)
        {
            SendMessage(hwnd, WM_SETFONT, WPARAM (font),  MAKELPARAM(TRUE, 0));
        }

i don't understand how can i test the SendMessage() failling, but the window font isn't changed. why? did i miss something?

Share this post


Link to post
Share on other sites

It is impossible to answer your question with so little details, we need more context. I suggest you read the remark section in the MSDN page about WM_SETFONT message :

 

https://msdn.microsoft.com/en-us/library/windows/desktop/ms632642(v=vs.85).aspx

 

Have you tried to call GetLastError to determine why it is failing if it is really failing ? To get details about the error code returned by GetLastError, you can use Error Lookup in Visual Studio Tool menu.

Share this post


Link to post
Share on other sites

the GetLastError() it's zero(no error).

after more search's and information, i found that the font can, only, be changed on control creation or on owner drawed control(WM_DRAWITEM and WM_PAINT messages(on menus, the WM_MEASUREITEM is for change menu item size))

but please try to answer to anotherthing: when i use  the SendMessage(), how i can test it if it's failling?(i'm confused)

https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx

"The return value specifies the result of the message processing; it depends on the message sent."

can you, please explain more? i'm confused :(

Edited by cambalinho

Share this post


Link to post
Share on other sites

As explained in https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx, how to interpret the return value for SendMessage depends on the message sent. With many window messages, it will return 0 if the target didn't process the message. It doesn't necessarily mean an error occured but simply that the target didn't process the message (often because that target doesn't process that kind of message).

 

In general, you have to consult the documentation for the specific message to know how to interpret the return value of SendMessage.

Edited by Laval B

Share this post


Link to post
Share on other sites

This topic is 415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this