Search the web
Sign In
New User? Sign Up
AIL_Development · AIL Developer's Forum
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
IpicturetoImage   Message List  
Reply | Forward Message #99 of 125 |
Re: IpicturetoImage

--- "bluescreenweasel" <peteraddington@...> wrote:
>
> And another one!
>
> I am using a com object interop (DSOfile) in a VB.net project, and in
> order to extract the thumbnail property of a file, I am using another
> reference, visualbasiccompatibility.VB6 and the method
> IpicturetoImage. This seems to be the only way that it converts the
> ole ipciture to a standard VB.net image.
>
> I had thought that using Convert_PictureToBitmap would have replaced
> this but it seems i am getting an "unable to cast" exception when i
> attempt it try. I guess a stdole.stdpicture is not the same as an ole
> Ipicture???. It would be nice if i could do everything in AIL rather
> than have the extra reference if possible. any thoughts?



The "Convert_PictureToBitmap" function takes an StdPicture object in
VB5/VB6, and takes a System.Drawing.Image object in .NET... then
converts it to a Win32 BITMAP handle. I don't think this is what
you're looking for.

In VB5/VB6, the following applies:
- Image = FreeImage handle passed through the AIL interface
- Picture = StdPicture object (native VB5/VB6 image object)
- Bitmap = Win32 BITMAP handle (used natively by Windows API calls)
- DIB = Device Indepentant Bitmap (used natvely by Windows API calls)

In .NET, the following applies:
- Image = FreeImage handle passed through the AIL interface
- Picture = System.Drawing.Image object (native .NET image object)
- Bitmap = Win32 BITMAP handle (used natively by Windows API calls)
- DIB = Device Indepentant Bitmap (used natvely by Windows API calls)

So the "Convert_PictureToBitmap" function you're calling is expecting a
System.Drawing.Image object and returns a handle to a Win32 BITMAP. I
don't think that's what you want.

It sounds to me like the "IpicturetoImage" returns a
System.Drawing.Image object and so you would want to use
the "Convert_PictureToImage" function to convert that
System.Drawing.Image object to a FreeImage handle that can be used by
the other AIL functions.

======

By the way, in VB5/VB6 the "StdPicture" object (part of the "stdole"
library) is interchangeable with the "IPictureDisp" object (also part
of the "stdole" library). In fact, if you look at their interfaces,
they are identical. Have exactly the same properties and methods. You
can declare an StdPicture object and pass it to a function
like "SavePicture" which according to the declaration takes an
IPictureDisp object as a parameter.

Now, just because VB5/VB6 treats them as the same thing does not mean
that .NET will. VB5/VB6 is a lot more forgiving, where .NET is a lot
more strict with typing.

That being said, I've never had a problem passing StdPicture objects
to .NET and having them converted to System.Drawing.Image objects. A
good example of this is a class module I wrote a long time ago
when .NET first came out called "cStdOle":

http://net.thevbzone.com/cStdOle.vb

It was written for .NET 1.x and I've never tried porting it to .NET 2.x
or 3.x... but it might help.

- Kevin





Wed Oct 8, 2008 10:48 pm

kwilson1997
Offline Offline
Send Email Send Email

Forward
Message #99 of 125 |
Expand Messages Author Sort by Date

And another one! I am using a com object interop (DSOfile) in a VB.net project, and in order to extract the thumbnail property of a file, I am using another ...
bluescreenweasel
bluescreenwe...
Offline Send Email
Oct 8, 2008
10:31 pm

... The "Convert_PictureToBitmap" function takes an StdPicture object in VB5/VB6, and takes a System.Drawing.Image object in .NET... then converts it to a...
Kevin Wilson
kwilson1997
Offline Send Email
Oct 8, 2008
10:49 pm

what I needed was a "convert stdpicture to native dotnet image". The class you provided worked perfectly when i put it into my project. the thumbnail was...
bluescreenweasel
bluescreenwe...
Offline Send Email
Oct 9, 2008
5:36 pm

... If all you need to do is convert an StdPicture object to a System.Drawing.Image object, then don't bother with AIL. It's not designed to do that, nor does...
Kevin Wilson
kwilson1997
Offline Send Email
Oct 9, 2008
5:56 pm

hi kevin, i got that class from the previous post, and it works perfectly in a .net 2 project. I already had a reference to stdole.dll, however it's from...
bluescreenweasel
bluescreenwe...
Offline Send Email
Oct 10, 2008
8:51 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help