3 Parameters ?

R

RS

I have started a new MFC DLL project with the " using namespace Gdiplus; "
library and I have one routine that will compile everything except one line. The
compiled code is:


VOID OCRScreen(HWND ghwndApp)
{
BitmapData data;
HDC hdcSrc;
HDC hdcDst;
RECT rc;
HBITMAP hbm;
int x, y;

GetClientRect(ghwndApp, &rc);
x = BOUND(gptZoom.x, gcxZoomed / 2, gcxScreenMax - (gcxZoomed / 2));
y = BOUND(gptZoom.y, gcyZoomed / 2, gcyScreenMax - (gcyZoomed / 2));

rc.left = x - gcxZoomed / 2;
rc.top = y - gcyZoomed / 2;
rc.right = rc.left + gcxZoomed;
rc.bottom = rc.top + gcyZoomed;

InflateRect(&rc, 1, 1);

if (hdcSrc = GetDC(NULL))
{
if (hbm = CreateCompatibleBitmap(hdcSrc,
rc.right - rc.left, rc.bottom - rc.top))
{
if (hdcDst = CreateCompatibleDC(hdcSrc))
{
SelectObject(hdcDst, hbm);

BitBlt(hdcDst, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
hdcSrc, rc.left, rc.top, SRCCOPY);

/////******** bmImage1 = new Bitmap(hbm, ghpalPhysical); ********/////

Rect rc(0, 0, bmImage1->GetWidth(), bmImage1->GetHeight());

bmImage1->LockBits(&rc, ImageLockModeWrite | ImageLockModeRead,
PixelFormat24bppRGB, &data);

// blah blah

bmImage1->UnlockBits(&data);

delete bmImage1;

DeleteDC(hdcDst);
}
DeleteObject(hbm);
}
ReleaseDC(ghwndApp, hdcSrc);
}
}// OCRScreen

The erroneous line of code that will not compile has been commented out and gives
the error C2660: 'Gdiplus::GdiplusBase::blush:perator new' : function does not take
3 parameters. Why does Vc7 see 3 parameters as opposed to the obvious 2
parameters ?

Please help and TIA --- RS.
 
G

George Ter-Saakov

Becasue in the first lines of the CPP file "new" is redefined.
I recall there is a KB article on it. Look for "MFC and GDI+"
Or just remove the definition.

George.
I have started a new MFC DLL project with the " using namespace Gdiplus; "
library and I have one routine that will compile everything except one line. The
compiled code is:


VOID OCRScreen(HWND ghwndApp)
{
BitmapData data;
HDC hdcSrc;
HDC hdcDst;
RECT rc;
HBITMAP hbm;
int x, y;

GetClientRect(ghwndApp, &rc);
x = BOUND(gptZoom.x, gcxZoomed / 2, gcxScreenMax - (gcxZoomed / 2));
y = BOUND(gptZoom.y, gcyZoomed / 2, gcyScreenMax - (gcyZoomed / 2));

rc.left = x - gcxZoomed / 2;
rc.top = y - gcyZoomed / 2;
rc.right = rc.left + gcxZoomed;
rc.bottom = rc.top + gcyZoomed;

InflateRect(&rc, 1, 1);

if (hdcSrc = GetDC(NULL))
{
if (hbm = CreateCompatibleBitmap(hdcSrc,
rc.right - rc.left, rc.bottom - rc.top))
{
if (hdcDst = CreateCompatibleDC(hdcSrc))
{
SelectObject(hdcDst, hbm);

BitBlt(hdcDst, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
hdcSrc, rc.left, rc.top, SRCCOPY);

/////******** bmImage1 = new Bitmap(hbm, ghpalPhysical); ********/////

Rect rc(0, 0, bmImage1->GetWidth(), bmImage1->GetHeight());

bmImage1->LockBits(&rc, ImageLockModeWrite | ImageLockModeRead,
PixelFormat24bppRGB, &data);

// blah blah

bmImage1->UnlockBits(&data);

delete bmImage1;

DeleteDC(hdcDst);
}
DeleteObject(hbm);
}
ReleaseDC(ghwndApp, hdcSrc);
}
}// OCRScreen

The erroneous line of code that will not compile has been commented out and gives
the error C2660: 'Gdiplus::GdiplusBase::blush:perator new' : function does not take
3 parameters. Why does Vc7 see 3 parameters as opposed to the obvious 2
parameters ?

Please help and TIA --- RS.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top