473,385 Members | 1,372 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.

thumbnail extraction win32com -how?

Hello,

I revist this every now and then and are still no closer to getting it to work.
I want to extract the thumbnail from a file on windows using either win32com or
ctypes. As described in this link:

http://www.vbaccelerator.com/home/NE...on/article.asp

Has anyone implemented this? Or can explain how to do this. Basically it
involves calling IExtractImage from shell32. But I'm not sure how to get the
file object or access IExtractImage.

This is what I have so far (which doesn't work):

import win32com.client
Dispatch = win32com.client.Dispatch

objShell = Dispatch("Shell.Application");
objFolder = objShell.Namespace(0);
localPidl = objFolder.ParseName('path\filename');
uio = objShell.GetUIObjectOf(NULL, 1, localPidl,IID_IExtractImage,NULL,IExtract)
....

Based on the following C code:

"""
HBITMAP ExtractThumb(LPSHELLFOLDER psfFolder, LPCITEMIDLIST localPidl,
const SIZE* prgSize, DWORD dwRecClrDepth)
{
LPEXTRACTIMAGE pIExtract = NULL;
HRESULT hr;
hr = psfFolder->GetUIObjectOf(NULL, 1, &localPidl, IID_IExtractImage,
NULL, (void**)&pIExtract);
if(NULL == pIExtract) // early shell version, thumbs not supported
return NULL;

OLECHAR wszPathBuffer[MAX_PATH];
DWORD dwPriority = 0; // IEI_PRIORITY_NORMAL is defined nowhere!
DWORD dwFlags = IEIFLAG_SCREEN;
HBITMAP hBmpImage = NULL;
hr = pIExtract->GetLocation(wszPathBuffer, MAX_PATH, &dwPriority,
prgSize, dwRecClrDepth, &dwFlags);
// even if we've got shell v4.70+, not all files support thumbnails
if(NOERROR == hr) hr = pIExtract->Extract(&hBmpImage);
pIExtract->Release();

return hBmpImage; // callers should DeleteObject this handle after use
}
"""

regards,

Guy
Jul 18 '05 #1
0 1515

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

Similar topics

1
by: Justin Stockton | last post by:
I recently upgraded from ActivePython 2.2.2 to ActivePython 2.3.2 and I'm running into an issue importing the win32com.client module. Before installing the new version, I made sure to properly...
3
by: RJ | last post by:
Hi, I've been going over the Quick Start to Client side COM and Python and many other sources, but cannot find an example that will get my com/ActiveX .ocx USB device driver imported. The Excel...
2
by: Sibylle Koczian | last post by:
Hello, I've installed Python 2.4 and the win32 extensions, using administrator rights, under Windows XP in "C:\Programme". As this is a directory without spaces I didn't expect any problems. But...
4
by: thomas kern | last post by:
Hello, i dont know how to extract the thumbnail of an image? is there a good way to do that cos there arent many articles on the internet :/ thank you thomas
1
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for my “Banners, Damsels, and Mores” project...
12
by: vithi | last post by:
Hi Any one tell me where I can get (or download) python modules win32com or win32com.client because I have to use "Dispatch" thanks
1
by: Mark | last post by:
I am trying to show many Images in a Listview controls with size(100,100). But some of the images sizes are big, like width=238 and height 50. These images does not appear proper in the listview...
11
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which...
4
by: sterling | last post by:
I'm curious as to why the difference between IDLE and pythonWin when using win32com. opening an excel file, i've attempted to grab the chart information out of the file. commands like co =...
2
by: RyanN | last post by:
Greetings, I'm trying to get DispatchWithEvents() to work with HyperAccess (terminal program) without much success. I've done a bunch of searching and found some examples using IE: This works...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.