Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / September 2003

Tip: Looking for answers? Try searching our database.

3 Parameters ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RS - 09 Sep 2003 18:27 GMT
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::operator 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.
George Ter-Saakov - 09 Sep 2003 18:31 GMT
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::operator 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.