开发者

How do I get the handle to a brush, Win32 C++

I'm creating a Dialog window with some button controls. I want the buttons to be coloured individually. I've searched and found something that I think I should use, the WM_CTLCOLORBTN Message.

As stated the return value should be a "handle to a brush".

I can create a brush, for example like this:

HBRUSH blueBrush=CreateSolidBrush(RGB(0,255,0));

but how do I retur开发者_运维技巧n the handle to this brush?

EDIT: My message handling function is defined as

LRESULT CALLBACK ClientDlgProc(...)

and if I try to return blueBrush I get this error:

error C2440: 'return' : cannot convert from 'HBRUSH' to 'LRESULT'


I'm pretty sure the value returned by CreateSolidBrush is the handle (the H in HBRUSH stands for 'handle').


An HBRUSH is the handle to the brush. Return blueBrush.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜