[API]这个函数有什么问题么
c++吧
全部回复
仅看楼主
level 11
gameloftyou 楼主
为什么有的窗体内使用时能正确返回选择的颜色,而有的无论如何只返回RGB(80,80,80);  = =|||
COLORREF SelectColor()
{
    static CHOOSECOLOR cc;
    static COLORREF crCustColors[6];
    
    cc.lStructSize = sizeof(CHOOSECOLOR);
    cc.hwndOwner = NULL;
    cc.hInstance = NULL;
    cc.rgbResult = RGB(0x80,0x80,0x80);
    cc.lpCustColors = crCustColors;
    cc.Flags = CC_RGBINIT|CC_FULLOPEN;
    cc.lCustData = 0;
    cc.lpfnHook = NULL;
    cc.lpTemplateName = NULL;
    
    ChooseColor(&cc);
    return cc.rgbResult;
}
2012年08月27日 07点08分 1
level 13
[打酱油]
2012年08月27日 08点08分 2
level 11
gameloftyou 楼主
[揉脸]
2012年08月27日 13点08分 3
level 12
rgbResult
If the CC_RGBINIT flag is set, rgbResult specifies the color initially selected when the dialog box is created. If the specified color value is not among the available colors, the system selects the nearest solid color available. If rgbResult is zero or CC_RGBINIT is not set, the initially selected color is black. If the user clicks the OK button, rgbResult specifies the user's color selection. To create a COLORREF color value, use the RGB macro.
2012年08月27日 13点08分 4
去掉CC_RGBINIT也不行,感觉不是这个的问题 爱踢下糖果君@candy7604182 [揉脸]
2012年08月27日 13点08分
level 10
static COLORREF crCustColors[6];
给少了,需要16个,ChooseColor预期你的空间有16个之多,读写后续的内容,可能导致不可预知的问题
lpCustColors
Type: COLORREF*
A pointer to an array of 16 values that contain red, green, blue (RGB) values for the custom color boxes in the dialog box.
2012年08月28日 05点08分 5
太感谢了[感动]
2012年08月28日 05点08分
1