By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

VC8 GDI+ dll in VC6

P: n/a
Hi,

Can I write a VC8 dll which used GDI+ and then use this dll in VC6.
I will be using GDI+ to basically load a image in memory and annotate it
with some text and save the image.

Any pointers on how I can do this?

Thanks,
-Asfar
Mar 23 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Asfar wrote:
Hi,

Can I write a VC8 dll which used GDI+ and then use this dll in VC6.
I will be using GDI+ to basically load a image in memory and annotate
it with some text and save the image.

Any pointers on how I can do this?


You can, as long as you expose a pure C (or COM) interface to your VC8 DLL.
If you expose functions that have MFC, ATL or STL types in the interface,
you won't be able to call those functions from VC6. If you expose functions
that have GDI+ types in their interface, it _might_ work, depending on
whether VC6 and VC8 can both compile the exact same version of GDI+ and
whether you have all the options for the two compilers set in a compatible
way.

In your case, if all you want to do is load, annotate and save an image,
your exported function probably needs little more than a path, so it should
be doable.

-cd
Mar 23 '06 #2

P: n/a
> Can I write a VC8 dll which used GDI+ and then use this dll in VC6.
I will be using GDI+ to basically load a image in memory and annotate it
with some text and save the image.


The functionality itself should not be difficult to figure out.
www.codeproject.com has plenty of GDI+ articles and code samples.

build a class that does what you want to do. after that you can either build
a C style wrapper that exposes the desired functionality of that class, you
can build an activeX control that exports that functionality, or you can
build a managed class library and use it via COM interop.

Should you go for the C style wrapper dll, then you also have to be careful
to respect memory ownership. I.e. do not let the dll allocate memory that
will be deleted by your VC6 app, or vice versa.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"

Mar 23 '06 #3

P: n/a
> Can I write a VC8 dll which used GDI+ and then use this dll in VC6.

Why do you want to ? GDI+ is an unmanaged library that you could call much
more easily direct from VC6 unmanaged code.

Cheers
Doug Forster
Mar 23 '06 #4

P: n/a
"Doug Forster" <doug_ZAPTHIS_AT_ZAPTHIS_TONIQ_DOT_CO_DOT_NZ> wrote in
message news:uY**************@TK2MSFTNGP11.phx.gbl...
Can I write a VC8 dll which used GDI+ and then use this dll in VC6.


Why do you want to ? GDI+ is an unmanaged library that you could call much
more easily direct from VC6 unmanaged code.


What's that got to do with VC8, which is just as capable of generating
native code as VC6 was?

-cd
Mar 23 '06 #5

P: n/a
> What's that got to do with VC8, which is just as capable of generating
native code as VC6 was?


Nothing at all. I was presuming the OP had some undisclosed reason for
wanting to work within VC6.

Mar 24 '06 #6

P: n/a
Just to continue...

I also supposed the reason the OP wanted to use VC8 for the dll was because
he was under the common misapprehension that GDI+ was a managed library and
that he needed managed code to use it.
Mar 24 '06 #7

P: n/a
Thanks guys. I was of the opinion that GDI+ was managed code.

"Doug Forster" <doug_ZAPTHIS_AT_ZAPTHIS_TONIQ_DOT_CO_DOT_NZ> wrote in
message news:eS**************@TK2MSFTNGP11.phx.gbl...
Just to continue...

I also supposed the reason the OP wanted to use VC8 for the dll was
because he was under the common misapprehension that GDI+ was a managed
library and that he needed managed code to use it.

Mar 24 '06 #8

P: n/a
Doug Forster wrote:
Just to continue...

I also supposed the reason the OP wanted to use VC8 for the dll was
because he was under the common misapprehension that GDI+ was a
managed library and that he needed managed code to use it.


Good call :) I'd never heard the misperception that GDI+ was managed, but
apparently it is common!

-cd
Mar 24 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.