using GDI+

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bonj

    using GDI+

    How can GDI+ be used from C++?? I tried the following
    methods, but all failed with about 100 different errors
    relating to stuff that was not in any file I created.
    The file <gdiplus.h> only exists on my (XP pro) system in
    a directory that was underneath the .NET install directory.
    So I added this as an include directory to VC6.

    1st attempt: Create standard Win32 app with VC6, #include
    <gdiplus.h> (which it can now see), and try to create a
    Graphics object. Fails with over 100 errors, none of which
    I understand. Still fails if I add gdiplus.lib to the list
    of libraries.

    2nd attempt: Create standard Win32 app with VC.NET 2002
    (unmanaged), #include <gdiplus.h>, and try to create a
    Graphics object. Fails with over 100 errors.

    3rd attempt: As 2nd attempt but starting off as a managed
    empty project.

    4th attempt: copy example code listing of a complete
    program into each of the programs listed above. Fails
    again.

    From this, it would seem like C# is the only language
    capable of using GDI+ (other than VB.NET which I don't
    like purely because C# exists). Am I right, or can it be
    done?
  • Thore Karlsen

    #2
    Re: using GDI+

    On Tue, 6 Jan 2004 09:15:28 -0800, "Bonj"
    <anonymous@disc ussions.microso ft.com> wrote:
    [color=blue]
    >How can GDI+ be used from C++?? I tried the following
    >methods, but all failed with about 100 different errors
    >relating to stuff that was not in any file I created.
    >The file <gdiplus.h> only exists on my (XP pro) system in
    >a directory that was underneath the .NET install directory.
    >So I added this as an include directory to VC6.
    >
    >1st attempt: Create standard Win32 app with VC6, #include
    ><gdiplus.h> (which it can now see), and try to create a
    >Graphics object. Fails with over 100 errors, none of which
    >I understand. Still fails if I add gdiplus.lib to the list
    >of libraries.
    >
    >2nd attempt: Create standard Win32 app with VC.NET 2002
    >(unmanaged), #include <gdiplus.h>, and try to create a
    >Graphics object. Fails with over 100 errors.
    >
    >3rd attempt: As 2nd attempt but starting off as a managed
    >empty project.
    >
    >4th attempt: copy example code listing of a complete
    >program into each of the programs listed above. Fails
    >again.
    >
    >From this, it would seem like C# is the only language
    >capable of using GDI+ (other than VB.NET which I don't
    >like purely because C# exists). Am I right, or can it be
    >done?[/color]

    It can definitely be done in C++. What errors are you getting?

    --
    Be seeing you.

    Comment

    • Ron Natalie

      #3
      Re: using GDI+


      "Bonj" <anonymous@disc ussions.microso ft.com> wrote in message news:01a301c3d4 78$ae627d00$a10 1280a@phx.gbl.. .[color=blue]
      > How can GDI+ be used from C++?? I tried the following
      > methods, but all failed with about 100 different errors
      > relating to stuff that was not in any file I created.
      > The file <gdiplus.h> only exists on my (XP pro) system in
      > a directory that was underneath the .NET install directory.
      > So I added this as an include directory to VC6.
      >[/color]
      You need to install the Platform SDK (one that's recent since
      the inception of GDI+). The SDK will add the appropriate
      search paths for both the include files and the libraries to your
      VC++ 6.

      Comment

      • Doug Forster

        #4
        Re: using GDI+

        Hi,

        GDI+ is defined in a namespace called Gdiplus.

        Try

        #include <gdiplus.h>
        using namespace Gdiplus;

        Sometimes the GDI+ objects confilict with regular C++ objects so if the
        above still causes problems omit the using and try using a Gdiplus:: prefix
        before all GDI+ declarations.


        Cheers

        Doug Forster

        "Bonj" <anonymous@disc ussions.microso ft.com> wrote in message
        news:01a301c3d4 78$ae627d00$a10 1280a@phx.gbl.. .[color=blue]
        > How can GDI+ be used from C++?? I tried the following
        > methods, but all failed with about 100 different errors
        > relating to stuff that was not in any file I created.
        > The file <gdiplus.h> only exists on my (XP pro) system in
        > a directory that was underneath the .NET install directory.
        > So I added this as an include directory to VC6.,
        >
        > 1st attempt: Create standard Win32 app with VC6, #include
        > <gdiplus.h> (which it can now see), and try to create a
        > Graphics object. Fails with over 100 errors, none of which
        > I understand. Still fails if I add gdiplus.lib to the list
        > of libraries.
        >
        > 2nd attempt: Create standard Win32 app with VC.NET 2002
        > (unmanaged), #include <gdiplus.h>, and try to create a
        > Graphics object. Fails with over 100 errors.
        >
        > 3rd attempt: As 2nd attempt but starting off as a managed
        > empty project.
        >
        > 4th attempt: copy example code listing of a complete
        > program into each of the programs listed above. Fails
        > again.
        >
        > From this, it would seem like C# is the only language
        > capable of using GDI+ (other than VB.NET which I don't
        > like purely because C# exists). Am I right, or can it be
        > done?[/color]


        Comment

        • Ron Natalie

          #5
          Re: using GDI+


          "Doug Forster" <doug_ZAPTHIS_A T_TONIQ_ZAPTHIS _co.nz> wrote in message news:OBgrSvI1DH A.3496@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Hi,
          >
          > GDI+ is defined in a namespace called Gdiplus.
          >
          > Try
          >
          > #include <gdiplus.h>
          > using namespace Gdiplus;
          >
          > Sometimes the GDI+ objects confilict with regular C++ objects so if the
          > above still causes problems omit the using and try using a Gdiplus:: prefix
          > before all GDI+ declarations.
          >[/color]
          Also VC6 doesn't implement using properly, I've given up and just fully-qualified
          the names most places.

          Comment

          • yuchuan_wang

            #6
            Re: using GDI+

            It definitely can be used in C++.
            Include the header file, and link gdiplus.lib.
            Gdiplus is one namespace, use Gdiplus::image, for example.
            and Call GdiplusStartup before making any other GDI+ calls, and call
            GdiplusShutdown when you have finished using GDI+.


            "Bonj" <anonymous@disc ussions.microso ft.com> wrote in message
            news:01a301c3d4 78$ae627d00$a10 1280a@phx.gbl.. .[color=blue]
            > How can GDI+ be used from C++?? I tried the following
            > methods, but all failed with about 100 different errors
            > relating to stuff that was not in any file I created.
            > The file <gdiplus.h> only exists on my (XP pro) system in
            > a directory that was underneath the .NET install directory.
            > So I added this as an include directory to VC6.
            >
            > 1st attempt: Create standard Win32 app with VC6, #include
            > <gdiplus.h> (which it can now see), and try to create a
            > Graphics object. Fails with over 100 errors, none of which
            > I understand. Still fails if I add gdiplus.lib to the list
            > of libraries.
            >
            > 2nd attempt: Create standard Win32 app with VC.NET 2002
            > (unmanaged), #include <gdiplus.h>, and try to create a
            > Graphics object. Fails with over 100 errors.
            >
            > 3rd attempt: As 2nd attempt but starting off as a managed
            > empty project.
            >
            > 4th attempt: copy example code listing of a complete
            > program into each of the programs listed above. Fails
            > again.
            >
            > From this, it would seem like C# is the only language
            > capable of using GDI+ (other than VB.NET which I don't
            > like purely because C# exists). Am I right, or can it be
            > done?[/color]


            Comment

            Working...