ChooseColor()

This is a discussion on ChooseColor() within the Windows Programming forums, part of the Platform Specific Boards category; 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 ...

  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, 12:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21