473,385 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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?
Nov 17 '05 #1
5 3693
On Tue, 6 Jan 2004 09:15:28 -0800, "Bonj"
<an*******@discussions.microsoft.com> wrote:
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?


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

--
Be seeing you.
Nov 17 '05 #2

"Bonj" <an*******@discussions.microsoft.com> wrote in message news:01****************************@phx.gbl...
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.

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.

Nov 17 '05 #3
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" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
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?

Nov 17 '05 #4

"Doug Forster" <doug_ZAPTHIS_AT_TONIQ_ZAPTHIS_co.nz> wrote in message news:OB**************@TK2MSFTNGP11.phx.gbl...
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.

Also VC6 doesn't implement using properly, I've given up and just fully-qualified
the names most places.

Nov 17 '05 #5
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" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
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?

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Prasad More | last post by:
Hello, I am trying to write a text on Multi-page TIFF image using C# and .NET GDI+. I have written following code to do this. When I execute this code I get "Invalid Parameter User. at...
6
by: James dean | last post by:
I have heard that the video drivers in GDI+ are a big performance issue. But is this only an issue with something like Games Programming i think...is this wrong?. What about a drawing application...
6
by: James dean | last post by:
I want a good site that will show clearly how much more functionality GDI+ has. I cannot seem to find anything other than sites that list "some" of the new functionality that GDI+ offers. A...
7
by: Just Me | last post by:
I've been trying to debug this but when it executes GetSystemPaletteEntries it bombs. I mean it just dies. I set a breakpoint an try to get QuickWatch to evaluate GetSystemPaletteEntries(...)...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
7
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be...
7
by: Marcin Rzeznicki | last post by:
Hello, Do you think it is legitimate practice to mix GDI+ and GDI calls (via Get/ReleaseHDC()) in paint event of a control? I've heard there is possibility of performance loss while "locking"...
2
by: rejidasan | last post by:
Hello All, I have a MFC Dialog based application. I am not using GDI or GDI+ libraries. I need to load PNG and JPEG images in this Dialog Based application. Can you suggest me how to to do...
5
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.