Here is the code:
#include <windows.h>
#include <wingdi.h>
#include <tchar.h>
#include <string>
#include <iostream>
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) //handling the message; all cases should be in logical order
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
GRADIENT_RECT rc;
TRIVERTEX vertex[2] ;
//vertex settings...
hdc = BeginPaint(hwnd, &ps);
GradientFill(hdc, vertex, 2, &rc, 1, GRADIENT_FILL_RECT_V);
EndPaint(hwnd, &ps);
break;
}
}
}
I get the message from title, and when I switch wingdi.h and windows.h I get load of errors from wingdi.h file. I use codeblocks.
The documentation for GradientFill tells you, which header declares a symbol and which header to include:
Header: WinGdi.h (include Windows.h)
While GradientFill
is declared in WinGdi.h you should #include <Windows.h>
only.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.