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. ATL / WTL / STL
  4. How to use GDI+ in an ActiveX Control? [modified]

How to use GDI+ in an ActiveX Control? [modified]

Scheduled Pinned Locked Moved ATL / WTL / STL
c++comgraphicshelptutorial
3 Posts 2 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.
  • S Offline
    S Offline
    samfromcn
    wrote on last edited by
    #1

    I wrote an ActiveX control. At first there was no GDI+ code in it and it worked well. Then I added follow code: class ATL_NO_VTABLE MyControl: public ......... { ... BOOL OpenImageFile(BSTR FilePath) // added a method { USES_CONVERSION; m_pBitmap = Bitmap::FromFile(FilePath); return m_pBitmap!=NULL; } Bitmap *m_pBitmap; // added a point } After I added a point and a method, MyControl was no long created successfully. I searched in www.codeproject.com and finded Ryan Johnston's article----http://www.codeproject.com/KB/GDI-plus/gdipluscontrol.aspx, I read the article and thought it would resolve my problem, en..., it didn't. It's very strange that after I remove my method, MyControl can be created, but if I add "static InitGDIPlus GDI_Plus_Controler;" in MyControl.cpp, MyControl can not be created again. I have not call the object's method yet, only declare a static global. Why this declaration make MyControl create failed? I hope someone can help me resolving this problem. Suggestion, article, code example, anything may be helpful is appreciated, thank you. :confused: My System: Windows 2000 Server, VC6(ATL3.0), Windows Server 2003 SP1 SDK

    modified on Tuesday, March 18, 2008 11:06 AM

    S M 2 Replies Last reply
    0
    • S samfromcn

      I wrote an ActiveX control. At first there was no GDI+ code in it and it worked well. Then I added follow code: class ATL_NO_VTABLE MyControl: public ......... { ... BOOL OpenImageFile(BSTR FilePath) // added a method { USES_CONVERSION; m_pBitmap = Bitmap::FromFile(FilePath); return m_pBitmap!=NULL; } Bitmap *m_pBitmap; // added a point } After I added a point and a method, MyControl was no long created successfully. I searched in www.codeproject.com and finded Ryan Johnston's article----http://www.codeproject.com/KB/GDI-plus/gdipluscontrol.aspx, I read the article and thought it would resolve my problem, en..., it didn't. It's very strange that after I remove my method, MyControl can be created, but if I add "static InitGDIPlus GDI_Plus_Controler;" in MyControl.cpp, MyControl can not be created again. I have not call the object's method yet, only declare a static global. Why this declaration make MyControl create failed? I hope someone can help me resolving this problem. Suggestion, article, code example, anything may be helpful is appreciated, thank you. :confused: My System: Windows 2000 Server, VC6(ATL3.0), Windows Server 2003 SP1 SDK

      modified on Tuesday, March 18, 2008 11:06 AM

      S Offline
      S Offline
      samfromcn
      wrote on last edited by
      #2

      I change the system to windows 2003, the problem was resolved.

      1 Reply Last reply
      0
      • S samfromcn

        I wrote an ActiveX control. At first there was no GDI+ code in it and it worked well. Then I added follow code: class ATL_NO_VTABLE MyControl: public ......... { ... BOOL OpenImageFile(BSTR FilePath) // added a method { USES_CONVERSION; m_pBitmap = Bitmap::FromFile(FilePath); return m_pBitmap!=NULL; } Bitmap *m_pBitmap; // added a point } After I added a point and a method, MyControl was no long created successfully. I searched in www.codeproject.com and finded Ryan Johnston's article----http://www.codeproject.com/KB/GDI-plus/gdipluscontrol.aspx, I read the article and thought it would resolve my problem, en..., it didn't. It's very strange that after I remove my method, MyControl can be created, but if I add "static InitGDIPlus GDI_Plus_Controler;" in MyControl.cpp, MyControl can not be created again. I have not call the object's method yet, only declare a static global. Why this declaration make MyControl create failed? I hope someone can help me resolving this problem. Suggestion, article, code example, anything may be helpful is appreciated, thank you. :confused: My System: Windows 2000 Server, VC6(ATL3.0), Windows Server 2003 SP1 SDK

        modified on Tuesday, March 18, 2008 11:06 AM

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        Sounds like you're missing gdiplus.dll. That didn't come with Win 2K.

        --Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

        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