程序:
BOOL CreateSolidBrush(COLORREF crColor); //声明
void CMy0628_1Dlg::OnDonny()
{
// TODO: Add your control notification handler code here
//I write
CDC *pDC = new CClientDC(this); //得到窗体绘图环境
CBrush brush; //定义画刷
brush.CreateSolidBrush(RGB(0,255,0)); //创建实心绿色画刷
CBrush * pOldBrush = pDC-> SelectObject(&brush); //将画笔选入窗体绘图设备环境
pDC-> Rectangle(50, 50, 200, 200); //画实心绿色矩形
pDC-> SelectObject(pOldBrush); //恢复原来的画刷
delete pDC;
}
错误行:
BOOL CreateSolidBrush(COLORREF crColor); //声明
WINGDIAPI HBRUSH WINAPI CreateSolidBrush(COLORREF);
错误信息:
--------------------Configuration: 0628_1 - Win32 (WCE MIPSII_FP) Debug--------------------
Compiling...
0628_1Dlg.cpp
G:\陈述程序\0628_1\0628_1Dlg.cpp(61) : error C2556: 'int __cdecl CreateSolidBrush(unsigned long) ' : overloaded function differs only by return type from 'struct HBRUSH__ *__cdecl CreateSolidBrush(unsigned long) '
g:\program files\windows ce tools\wce420\standardsdk_420\include\mipsii_fp\wingdi.h(591) : see declaration of 'CreateSolidBrush '
G:\陈述程序\0628_1\0628_1Dlg.cpp(61) : error C2040: 'CreateSolidBrush ' : 'int (unsigned long) ' differs in levels of indirection from 'struct HBRUSH__ *(unsigned long) '
Error executing clmips.exe.
0628_1.exe - 2 error(s), 0 warning(s)
不好意思,真的是很初级的问题,因为我更初级的,所以不会要问大家,一定要帮我,谢谢
------解决方案--------------------
你自己声明的BOOL CreateSolidBrush(COLORREF crColor);明显和windows ce tools\wce420\standardsdk_420\include\mipsii_fp\wingdi.h系统头文件中的声明不一致,故而导致错误。不明白你为什么要自己再声明一次,如需要使用这个函数,可以包含其声明的头文件。