Use GDI+ ( aka GDIPlus ) with VB6! 
Author Message
 Use GDI+ ( aka GDIPlus ) with VB6!

    As some may know, I have been working on using GDI+ via APIs and such,
and at long last, I have converted all the APIs and their enums, constants
and structures, with the exception of one enum and a few constants (See the
microsoft.public.vb.winapi thread entitled: "VB6 translation of malloc and
free, with a bit of casting (it would seem), How?" to see what I'm missing).
So now that I have done that, and ported over 20 of the SDK samples with it,
I now formally ask that some of the VB "gurus" with those VB websites to
pick this up and run with it! Please download the source, and help others to
understand and use it even better.

    I posted the zip file with all the source at www.planetsourcecode.com/vb
If you do a search for GDI+ or GDIPlus, you'll only find one result! Here is
the link anyway:
http://www.*-*-*.com/
Id=1

    Again, please, let others know of the joys (and a few pains) of GDI+!

Thanks,
      Avery



Tue, 18 Jan 2005 21:57:03 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
Hi AP.

Looks great, but I downloaded it and couldn't get it to work.

When running the project, I get the following error:

53: "File not found: gdiplus" on the line:

If GdiplusStartup(token, GpInput) <> Ok Then

in the Form_Load().

Any ideas what I should do to get it running? I'd love to see what it can
do..

I'm on Win2k Server SP2.

Cheers,
Greg Linwood


Quote:
>     As some may know, I have been working on using GDI+ via APIs and such,
> and at long last, I have converted all the APIs and their enums, constants
> and structures, with the exception of one enum and a few constants (See
the
> microsoft.public.vb.winapi thread entitled: "VB6 translation of malloc and
> free, with a bit of casting (it would seem), How?" to see what I'm
missing).
> So now that I have done that, and ported over 20 of the SDK samples with
it,
> I now formally ask that some of the VB "gurus" with those VB websites to
> pick this up and run with it! Please download the source, and help others
to
> understand and use it even better.

>     I posted the zip file with all the source at

www.planetsourcecode.com/vb
Quote:
> If you do a search for GDI+ or GDIPlus, you'll only find one result! Here
is
> the link anyway:

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=375...
Quote:
> Id=1

>     Again, please, let others know of the joys (and a few pains) of GDI+!

> Thanks,
>       Avery



Wed, 19 Jan 2005 13:47:45 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
    Yeah, you'll need the GDI+ retail download for systems that aren't
WinXP. Here is the download link:

    http://www.microsoft.com/downloads/release.asp?releaseid=32738

Avery


Quote:
> Hi AP.

> Looks great, but I downloaded it and couldn't get it to work.

> When running the project, I get the following error:

> 53: "File not found: gdiplus" on the line:

> If GdiplusStartup(token, GpInput) <> Ok Then

> in the Form_Load().

> Any ideas what I should do to get it running? I'd love to see what it can
> do..

> I'm on Win2k Server SP2.

> Cheers,
> Greg Linwood



> >     As some may know, I have been working on using GDI+ via APIs and
such,
> > and at long last, I have converted all the APIs and their enums,
constants
> > and structures, with the exception of one enum and a few constants (See
> the
> > microsoft.public.vb.winapi thread entitled: "VB6 translation of malloc
and
> > free, with a bit of casting (it would seem), How?" to see what I'm
> missing).
> > So now that I have done that, and ported over 20 of the SDK samples with
> it,
> > I now formally ask that some of the VB "gurus" with those VB websites to
> > pick this up and run with it! Please download the source, and help
others
> to
> > understand and use it even better.

> >     I posted the zip file with all the source at
> www.planetsourcecode.com/vb
> > If you do a search for GDI+ or GDIPlus, you'll only find one result!
Here
> is
> > the link anyway:

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=375...

- Show quoted text -

Quote:
> > Id=1

> >     Again, please, let others know of the joys (and a few pains) of
GDI+!

> > Thanks,
> >       Avery



Wed, 19 Jan 2005 18:09:48 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
Ahh.. that's working now..

Thanks AP, gonna have a good geez now!

Cheers,
Greg Linwood


Quote:
>     Yeah, you'll need the GDI+ retail download for systems that aren't
> WinXP. Here is the download link:

>     http://www.microsoft.com/downloads/release.asp?releaseid=32738

> Avery



> > Hi AP.

> > Looks great, but I downloaded it and couldn't get it to work.

> > When running the project, I get the following error:

> > 53: "File not found: gdiplus" on the line:

> > If GdiplusStartup(token, GpInput) <> Ok Then

> > in the Form_Load().

> > Any ideas what I should do to get it running? I'd love to see what it
can
> > do..

> > I'm on Win2k Server SP2.

> > Cheers,
> > Greg Linwood



> > >     As some may know, I have been working on using GDI+ via APIs and
> such,
> > > and at long last, I have converted all the APIs and their enums,
> constants
> > > and structures, with the exception of one enum and a few constants
(See
> > the
> > > microsoft.public.vb.winapi thread entitled: "VB6 translation of malloc
> and
> > > free, with a bit of casting (it would seem), How?" to see what I'm
> > missing).
> > > So now that I have done that, and ported over 20 of the SDK samples
with
> > it,
> > > I now formally ask that some of the VB "gurus" with those VB websites
to
> > > pick this up and run with it! Please download the source, and help
> others
> > to
> > > understand and use it even better.

> > >     I posted the zip file with all the source at
> > www.planetsourcecode.com/vb
> > > If you do a search for GDI+ or GDIPlus, you'll only find one result!
> Here
> > is
> > > the link anyway:

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=375...

- Show quoted text -

Quote:
> > > Id=1

> > >     Again, please, let others know of the joys (and a few pains) of
> GDI+!

> > > Thanks,
> > >       Avery



Wed, 19 Jan 2005 22:02:01 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
Thanks for reallly good examples,
What i don't get to work is:
read all EXIF propertyitems out of JPG(EXIF File).
and rotate it.
How kan that be done ??

Bastel



Fri, 04 Feb 2005 15:28:05 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
    Someone asked something along the same lines the other day (basically
how to retrieve and examine all of an image's properties...maybe it was
you?) so I recently added an example that does just that. Does the new
example help any?
    There are many ways to rotate an image: call GdipImageRotateFlip, use
the JPEG rotation EncoderParameter (which is supposed to produce a lossless
JPEG result if the image width and height is a multiple of 16 and the
original image was a JPEG - I used this method in the ugly BMPtoJPEG_Params
sample), or you could also create a graphics object from the image and
perform a rotation using one of the transform APIs. I'd make a sample, but I
don't know which method you'd rather use or what your requirements are,
exactly, and honestly I feel a bit lazy at the moment!

I hope this helps,
     Avery


Quote:
> Thanks for reallly good examples,
> What i don't get to work is:
> read all EXIF propertyitems out of JPG(EXIF File).
> and rotate it.
> How kan that be done ??

> Bastel



Tue, 08 Feb 2005 05:55:44 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
Hi Avery,
looks very good,
what i don't get to work is

function PtrToStr
with allItems(I).value gives the correct string back,
but how do I receive numeric values ?

Bastel



Sat, 19 Feb 2005 13:52:22 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
    That is a good question. Since the value member is a pointer, you'll
need to use CopyMemory to save it into a variable. Now, remember that the
value is a pointer to an array, so this can complicate things a bit. I
quickly made this function to hopefully help you out a bit:

' This should hopefully simplify property item value retrieval
' NOTE: We are raising errors in this function; ensure the caller has error
handing code.
'       The resulting arrays are using a base of one.
Public Function GetPropValue(item As PropertyItem) As Variant
   ' We need a valid pointer and length
   If item.value = 0 Or item.length = 0 Then Err.Raise 5, "GetPropValue"

   Select Case item.type
      ' We'll make Undefined types a Btye array as it seems the safest
choice...
      Case PropertyTagTypeByte, PropertyTagTypeUndefined:
         Dim bte() As Byte: ReDim bte(1 To item.length)
         CopyMemory bte(1), ByVal item.value, item.length
         GetPropValue = bte
         Erase bte

      Case PropertyTagTypeASCII:
         GetPropValue = PtrToStrA(item.value)

      Case PropertyTagTypeShort:
         Dim short() As Integer: ReDim short(1 To item.length)
         CopyMemory short(1), ByVal item.value, item.length * 2
         GetPropValue = short
         Erase short

      Case PropertyTagTypeLong, PropertyTagTypeSLONG:
         Dim lng() As Long: ReDim lng(1 To item.length)
         CopyMemory lng(1), ByVal item.value, item.length * 4
         GetPropValue = lng
         Erase lng

      Case PropertyTagTypeRational, PropertyTagTypeSRational:
         Dim lngpair() As Long: ReDim lngpair(1 To item.length, 1 To 2)
         CopyMemory lngpair(1, 1), ByVal item.value, item.length * 8
         GetPropValue = lngpair
         Erase lngpair

      Case Else: Err.Raise 461, "GetPropValue"
   End Select
End Function

That function should show you basically what you'll need to do...I hope...

Avery


Quote:
> Hi Avery,
> looks very good,
> what i don't get to work is

> function PtrToStr
> with allItems(I).value gives the correct string back,
> but how do I receive numeric values ?

> Bastel



Sun, 20 Feb 2005 06:18:57 GMT  
 Use GDI+ ( aka GDIPlus ) with VB6!
   Er, that is a bit off I've found. 'item.length * 4' should have been like
'item.length' as the length is the total size in bytes of the array whose
pointer is stored in value so no extra things need to be done. While rather
the ReDim's should have divided by 4 to get a correct result when allocating
the arrays. Sorry!

Avery


Quote:
>     That is a good question. Since the value member is a pointer, you'll
> need to use CopyMemory to save it into a variable. Now, remember that the
> value is a pointer to an array, so this can complicate things a bit. I
> quickly made this function to hopefully help you out a bit:

> ' This should hopefully simplify property item value retrieval
> ' NOTE: We are raising errors in this function; ensure the caller has
error
> handing code.
> '       The resulting arrays are using a base of one.
> Public Function GetPropValue(item As PropertyItem) As Variant
>    ' We need a valid pointer and length
>    If item.value = 0 Or item.length = 0 Then Err.Raise 5, "GetPropValue"

>    Select Case item.type
>       ' We'll make Undefined types a Btye array as it seems the safest
> choice...
>       Case PropertyTagTypeByte, PropertyTagTypeUndefined:
>          Dim bte() As Byte: ReDim bte(1 To item.length)
>          CopyMemory bte(1), ByVal item.value, item.length
>          GetPropValue = bte
>          Erase bte

>       Case PropertyTagTypeASCII:
>          GetPropValue = PtrToStrA(item.value)

>       Case PropertyTagTypeShort:
>          Dim short() As Integer: ReDim short(1 To item.length)
>          CopyMemory short(1), ByVal item.value, item.length * 2
>          GetPropValue = short
>          Erase short

>       Case PropertyTagTypeLong, PropertyTagTypeSLONG:
>          Dim lng() As Long: ReDim lng(1 To item.length)
>          CopyMemory lng(1), ByVal item.value, item.length * 4
>          GetPropValue = lng
>          Erase lng

>       Case PropertyTagTypeRational, PropertyTagTypeSRational:
>          Dim lngpair() As Long: ReDim lngpair(1 To item.length, 1 To 2)
>          CopyMemory lngpair(1, 1), ByVal item.value, item.length * 8
>          GetPropValue = lngpair
>          Erase lngpair

>       Case Else: Err.Raise 461, "GetPropValue"
>    End Select
> End Function

> That function should show you basically what you'll need to do...I hope...

> Avery



> > Hi Avery,
> > looks very good,
> > what i don't get to work is

> > function PtrToStr
> > with allItems(I).value gives the correct string back,
> > but how do I receive numeric values ?

> > Bastel



Thu, 24 Feb 2005 17:10:38 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Using VB6 and GDI+ ( aka GDIPlus )?

2. HOWTO: call GDIPLUS directly from VB6

3. bitblt gdi+/gdi

4. Automation Help (aka Access Modules in VB6)

5. vb6 help files AKA msdn collection

6. Using HP Printer Escape Sequences (aka Printer Passthrough Codes) in VB.Net

7. Using Word97 (aka Word 8) Spell Checker

8. Using Wake on lan aka magic packet

9. autoredraw and gdi+

10. GDI+ and VB6

11. Naive question from an outdated Techy - GDI heap status in VB6

12. GDI+ in VB6: MULTILINE and WORDBREAK

 

 
Powered by phpBB® Forum Software