473,738 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Namesp ace(0);
localPidl = objFolder.Parse Name('path\file name');
uio = objShell.GetUIO bjectOf(NULL, 1, localPidl,IID_I ExtractImage,NU LL,IExtract)
....

Based on the following C code:

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

OLECHAR wszPathBuffer[MAX_PATH];
DWORD dwPriority = 0; // IEI_PRIORITY_NO RMAL is defined nowhere!
DWORD dwFlags = IEIFLAG_SCREEN;
HBITMAP hBmpImage = NULL;
hr = pIExtract->GetLocation(ws zPathBuffer, 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(&hBmpI mage);
pIExtract->Release();

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

regards,

Guy
Jul 18 '05 #1
0 1538

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

Similar topics

1
5190
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 remove old version (as well as the mx libraries I had installed). I then installed the new version as a user with the Administrator role. I know I'm technically not supposed to install to a directory with a space in the name, but it worked fine for...
3
7015
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 and Word examples run fine. win32com.client.Dispatch("Excel.Application") etc., but how does one know the ("<foo>.<bar>") to type in? Excel looks only vaguely like "Excel.Application" in the com browser.
2
7091
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 now I can't _use_ win32com as a normal user, because normal users can't write there: PythonWin 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32. Portions Copyright 1994-2004 Mark Hammond (mhammond@skippinet.com.au) -
4
14209
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
3232
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 gallery. ( http://xahlee.org/Periodic_dosage_dir/lanci/lanci.html ) Comments and versions in other lang welcome. Xah
12
129977
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
1790
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 control. What do I need to do to see the Images same as I am looking using windows explorer thumbnail. Please help me as I am stuck on this for almost two days now. Thanks for any help you can provide.
11
7726
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 enabled me to the contacts at least list. I had to root around to discover CdoDefaultFolderContacts (though it was guessable; how could I enumerate win32com.client.constants?). I now want to work through the Contacts in Outlook patching in...
4
3613
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 = ChartObjects(1) works in pythonWin but doesn't work in IDLE. however, on both co = chartobjects(1) works just fine.
2
10515
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 but doesn't handle the "Event Driven Functions": haObj = win32com.client.Dispatch(r"HAWin32") And so does this Internet Explorer Example:
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9259
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.