none
ChooseColor not displaying the custom color dialog box in Windows 8.1 64 bit and Server 2012.

    Question

  • Hello All,

    The below piece of code is not working in Windows 8.1 64 bit and server 2012 (64 bit) when trying to call from a watermark tab of a printer driver UI (desktop mode). But this works fine in all 32 bit OS.
    ---------------------------------------------------
    CHOOSECOLOR cc;
    COLORREF color1 = 0;
    COLORREF colorCustom1[16];

    ZeroMemory(&cc, sizeof(CHOOSECOLORW));
    ZeroMemory(colorCustom1, sizeof(colorCustom1));

    cc.lStructSize  = sizeof(CHOOSECOLOR);
    cc.hwndOwner  = hWnd;
    cc.hInstance  = NULL;
    cc.rgbResult  = color1;
    cc.lpCustColors  = colorCustom1;
    cc.Flags   = CC_RGBINIT;

    BOOL bCustomColor = ChooseColor(&cc);

    DWORD dwError = CommDlgExtendedError();
    -----------------------------------------------------

    FYI: dwError is having a value of 1. This means CDERR_STRUCTSIZE. But I hardcoded the values and still no use.
    Another observation is sizeof(CHOOSECOLOR) is coming as 60, as in my sample application it is showing 36 (which is right).

    Also, I have tried initializing the structure, changing the struct byte alignment to default and none of these worked for me.

    Any suggestions to resolve this issue would be really appreciable.

    Warm Regards,
    Sankaran


    • Edited by psankarv Monday, January 13, 2014 11:01 AM
    Monday, January 13, 2014 8:39 AM