Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. can't use "new" with gdiplus objects

can't use "new" with gdiplus objects

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphics
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    happycpp
    wrote on last edited by
    #1

    hi everyone... i have this little problem and i hope u can help me with it.. the problem appears when using the following code: Graphics* pGraphics = new Graphics(hdc); the previous code doesn't compile: error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 parameters

    D 1 Reply Last reply
    0
    • H happycpp

      hi everyone... i have this little problem and i hope u can help me with it.. the problem appears when using the following code: Graphics* pGraphics = new Graphics(hdc); the previous code doesn't compile: error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 parameters

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Did you miss the #define new DEBUG_NEW statement at the top of your .cpp file? To squelch the compiler error, simply undefine the new operator prior to including gdiplus.h.


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      P 1 Reply Last reply
      0
      • D David Crow

        Did you miss the #define new DEBUG_NEW statement at the top of your .cpp file? To squelch the compiler error, simply undefine the new operator prior to including gdiplus.h.


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        P Offline
        P Offline
        PJ Arends
        wrote on last edited by
        #3

        Or you could use ::new for GDI+ objects. That way you do not loss the DEBUG_NEW functionality in the rest of your code.


        "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

        D 1 Reply Last reply
        0
        • P PJ Arends

          Or you could use ::new for GDI+ objects. That way you do not loss the DEBUG_NEW functionality in the rest of your code.


          "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Doh! Thanks for reminding me of the scope-resolution operator.


          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          H 1 Reply Last reply
          0
          • D David Crow

            Doh! Thanks for reminding me of the scope-resolution operator.


            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            H Offline
            H Offline
            happycpp
            wrote on last edited by
            #5

            i undefined new and everything went OK...but what's the functionality of DEBUG_NEW anyway..

            P 1 Reply Last reply
            0
            • H happycpp

              i undefined new and everything went OK...but what's the functionality of DEBUG_NEW anyway..

              P Offline
              P Offline
              PJ Arends
              wrote on last edited by
              #6

              saeedmalas wrote: what's the functionality of DEBUG_NEW anyway It implements the ability of the debugger to be able to track the line number and file name of where any memory leaks were allocated. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_debug_new.asp[^]


              "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

              H 1 Reply Last reply
              0
              • P PJ Arends

                saeedmalas wrote: what's the functionality of DEBUG_NEW anyway It implements the ability of the debugger to be able to track the line number and file name of where any memory leaks were allocated. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_debug_new.asp[^]


                "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

                H Offline
                H Offline
                happycpp
                wrote on last edited by
                #7

                thanx alot..

                B 1 Reply Last reply
                0
                • H happycpp

                  thanx alot..

                  B Offline
                  B Offline
                  Bo Hunter
                  wrote on last edited by
                  #8

                  I beleave that this will do everything you need. #pragma push_macro("new") #undef new #include #pragma pop_macro("new") Thank You Bo Hunter

                  L 1 Reply Last reply
                  0
                  • B Bo Hunter

                    I beleave that this will do everything you need. #pragma push_macro("new") #undef new #include #pragma pop_macro("new") Thank You Bo Hunter

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    i tried the push_macro but it didn't work!!!i think this is because the "new" in my code should be altered..

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups