如何将hbrBackground设置为我选择的纯色?

时间:2012-10-13 01:54:32

标签: c winapi

  

可能重复:
  c++ win32: how to set back color of a window?

我不想在WNDCLASS中使用股票HBRUSH

这是我的WNDCLASS:

 WNDCLASS     wndclass ;

 wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
 wndclass.lpfnWndProc   = WndProc ;
 wndclass.cbClsExtra    = 0 ;
 wndclass.cbWndExtra    = 0 ;
 wndclass.hInstance     = hInstance ;
 wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
 wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
 wndclass.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH) ;
 wndclass.lpszMenuName  = NULL ;
 wndclass.lpszClassName = szAppName ;

我希望hbrBackground成员为十六进制值#cfdf9b

wndclass.hbrBackground = (HBRUSH) GetStockObject (#cfdf9b);

有了这个错误来了

错误C2014:预处理程序命令必须从第一个非白色空间开始 警告C4047:'function':'int'与'LPCSTR'的间接级别不同 helloworldwinapi.c(21):警告C4024:'GetStockObject':正式和实际参数1的不同类型 错误C2143:语法错误:在';'

之前缺少')'

0 个答案:

没有答案
相关问题