0
votes

I get a compile error when I use the function GradientFill(); in my Native WinAPI C++ application

What am I doing wrong? How can I get my code to compile? I am using Microsoft Visual C++ 2010 Express.

In my project I have linked the correct library msimg32.lib file. See below for all my linked files(Project Properties->Linker->Input->Additional Dependencies):

comctl32.lib;kernel32.lib;gdi32.lib;winspool.lib;msimg32.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)

Compile Error:

1>c:\users\app.cpp(129): error C2064: term does not evaluate to a function taking 6 arguments

The code that causes the compile error:

void TransparentCheckbox::verticalGradient(HDC hDC, const RECT& GradientFill, COLORREF rgbTop, COLORREF rgbBottom)
{
    GRADIENT_RECT gradientRect = { 0, 1 };
    TRIVERTEX triVertext[ 2 ] = {
        GradientFill.left - 1,
        GradientFill.top - 1,
        GetRValue(rgbTop) << 8,
        GetGValue(rgbTop) << 8,
        GetBValue(rgbTop) << 8,
        0x0000,                 
        GradientFill.right,
        GradientFill.bottom,
        GetRValue(rgbBottom) << 8,
        GetGValue(rgbBottom) << 8,
        GetBValue(rgbBottom) << 8,
        0x0000
    };

    // Below is line 129
    GradientFill(hDC, triVertext, 2, &gradientRect, 1, GRADIENT_FILL_RECT_V);
}
1

1 Answers

5
votes

You have declared a parameter; GradientFill as const RECT&, and then call the Windows GradientFill procedure - this is leading to a conflict. I would change the the name of the parameter, or you could scope the procedure call as ::GradientFill.