读书人

请问:GetPixel()的使用

发布时间: 2012-01-30 21:15:58 作者: rapoo

请教:GetPixel()的使用?
我在程序中用了GDI+的GetPixel(),在运行中报错:
Run-Time Check Failure #3 - The variable 'color' is being used without being defined
以下是我的程序请各位大侠指点,谢谢!

Color *color;

sFile="CheckCode.jpg";
tFile="CheckCode.bmp";
ULONG_PTR m_gdiplusToken;
GdiplusStartupInput gdiplusStartupInput;
GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
static WCHAR buffer[1024];
wcsset(buffer,0);
MultiByteToWideChar(CP_ACP,0,sFile.GetBuffer(sFile.GetLength()),strlen(sFile),buffer,1024);
Bitmap bitmap(buffer,false);

for(int x=0;x<bitmap.GetWidth();x++)
{
for(int y=0;y<bitmap.GetHeight();y++)
{
这里报错--->bitmap.GetPixel(x,y,color);
}
}

[解决办法]
Color color;
[解决办法]
bitmap.GetPixel(x,y,&color);

读书人网 >VC/MFC

热点推荐