Quote Originally Posted by fafalone View Post
Did you change the picturebox's AutoRedraw property to True? Probably want to change ScaleMode to vbPixel as well. These are on the design-time Properties box like where the Name is.


And also see the SetPreviewPictureWithHBITMAP function that's setting it in my code?
Code:
picturebox.Cls
hBitmapToPictureBox picturebox, hBmp
picturebox.Refresh
(Don't forget the DeleteObject call when you're done with the hbitmap as well.)

And cx and cy are width/height. You definitely don't want a 0x0 image. Gotta change that picturebox scalemode to vbPixels if you're using picturebox.width/height as the size too, or you'll get a giant image.
Thanks.
I did all the above.
I changed Picturebox's AutoRedraw to True.
I changed its scalemode to Pixels.
And changed the code as follows:
Code:
   VIDEO_FILE = "C:\MyFiles\MyVids\Music\Classical-Music\J.S. Bach - St. Matthew Passion, BWV 244 _ Aria- -Erbarme dich, mein Gott.mp4"

   Picture1.Cls
   hBitmap = GetFileThumbnail(VIDEO_FILE, 0, Picture1.Width, Picture1.Height)
   Call hBitmapToPictureBox(Picture1, hBitmap)
   Picture1.Refresh
   DeleteObject hBitmap
This produces a very large thumbnail (far larger than the Picturebox). Therefore the Picturebox shows only a small part of the thumbnail's top-left corner.

Now, if I go to design mode and hugely enlarge the Picturebox in design mode, and run again, it again produces a very large thumbnail. This time the thumbnail shows completely inside the Picturebox, but the thumbnail's size is smaller than the Picturebox (because now the Picturebox is huge)

I don't know how to get it to show the thumbnail properly resized to fit the Picturebox.
Please note that the Picturebox's dimensions are to remain fixed. The thumbnail should be produced in the right size to fit the Picturebox.

Please advise.
Thanks.