[python-win32] How to use IExtractImage in python

Steven James steven.james at gmail.com
Fri Apr 20 01:57:37 CEST 2007


I could generate the thumbnails myself, or write a script to generate the
thumbnails, yes. Unfortunately in this case the files I'm previewing may
change at any time so pre-generation of the previews would not be possible.
I also need to be able to generate them on the fly.

I could write a server app to monitor the folders and auto-generate the
thumbnails through AutoCAD, but would require me to have a server running
AutoCAD (as I would not want to take over the client's computer for
generation of the thumbnails). I did actually consider doing this, but I
think I may put some effort in to getting IExtractImage to work, because
that would allow thumbnails of all types with the COM interface implemented,
as well as solving my immediate problem.

I have been delving in to the process of adding support for IExtractImage to
pythonwin. I have run makegw on the necessary files, added the resulting
.cpp and .h files to com/win32comext/shell/src, added references in
shell.cpp and setup.py, and now it seems all that is left to do is implement
the proper data types which makegw did not know how to handle. (Also, if it
would help anyone, I patched my makegw to run under Python 2.5 with no regex
or regsub modules.)

I have a few questions about the next steps, for those who may have done
this before:

I am left with a few lines of code in the PyIExtractImage.cpp file that look
like this:

if (bPythonIsHappy && !PyObject_AsDWORD *( obpdwPriority, &pdwPriority ))
bPythonIsHappy = FALSE;

I am assuming I either need to find or write an implementation of
PyObject_AsDWORD*. What would be the proper file to put this function in? It
looks like I need DWORD*, const SIZE*, and HBITMAP*.

Does all of this look right to you? It seems like at least DWORD should
already be written somewhere, but I can't seem to find it.

Any help/advice would be appreciated. Thanks for the responses so far.

Steven James


On 4/19/07, Tony Cappellini < cappy2112 at gmail.com> wrote:
>
> Steven
>
> Would it be possible to launch AutoCad, then use Python/PIL to do
> screenshots of the images?
>
> Message: 1
> Date: Wed, 18 Apr 2007 09:15:29 -0400
> From: "Steven James" <steven.james at gmail.com>
> Subject: [python-win32] How to use IExtractImage in python
> To: python-win32 at python.org
> Message-ID:
>        <e3c91420704180615y35b96a58taf1ab0efc537082e at mail.gmail.com >
> Content-Type: text/plain; charset="iso-8859-1"
>
> I am attempting to add a simple thumbnail preview in a wxpython app I'm
> putting together. IExtractImage seems to be the way to access the
> thumbnails
> that Windows Explorer uses.
>
> (I can't use PIL or similar because I'm previewing AutoCAD .dwg files).
>
> I am adapting some Delphi COM code (from
> here< http://www.delphi3000.com/articles/article_3806.asp?SK=>)
> as follows--i've removed the Malloc and other unnecessary statements:
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070419/08092d48/attachment.html 


More information about the Python-win32 mailing list