Thread: ChooseColor()

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    38

    ChooseColor()

    This keeps freezing, what am I doing wrong?
    Code:
    			COLORREF cr;
    			CHOOSECOLOR cc;
    			cr = RGB(0,0,0);
    			memset(&cc, 0, sizeof(cc));
    			cc.hwndOwner = hwnd;
    			cc.lStructSize = sizeof(cc);
    			cc.Flags = CC_ANYCOLOR|CC_FULLOPEN;
    			cc.rgbResult = cr;
    			ChooseColor(&cc);

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You need to provide a valid pointer for the lpCustColors of the CHOOSECOLOR struct:
    Code:
    COLORREF cr;
    COLORREF custom[16];
    CHOOSECOLOR cc;
    
    memset(&cc, 0, sizeof(cc));
    cc.lpCustColors=custom;
    cr = RGB(0,0,0);
    cc.hwndOwner = hwnd;
    cc.lStructSize = sizeof(cc);
    cc.Flags = CC_ANYCOLOR|CC_FULLOPEN;
    cc.rgbResult = cr;
    ChooseColor(&cc);
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ChooseColor
    By SirCrono6 in forum Windows Programming
    Replies: 2
    Last Post: 11-21-2005, 01:02 PM