Thank your your excellent help, Mark. I have gotten everything to compile properly, and can call IExtractImage::GetLocation and IExtractImage::Extract from python on the necessary files. Even the exceptions on unknown file types seem to be handled properly.
<br><br>The final problem is getting the image data into python (and using it in wxpython). The final return type is an HBITMAP, which I can see as an int in Python using PyLong_FromVoidPtr, or as a PyHANDLE in python using PyWinObject_FromHANDLE.
<br><br>I realize that a discussion on wxpython would be outside this group's topic, but if anyone could tell me where to start looking for a way to do this, I would greatly appreciate it. From what I can tell, wxpython/wxwindows uses the HBITMAP type internally to store images, and it appears to be a pointer to a DIB in memory. If so, it may be possible to use
wx.BitmapFromBuffer, wx.BitmapFromBits, or some similar function, if I can somehow convert the HBITMAP data (instead of the handle) to a string.<br><br>Thanks,<br>Steven James<br><br><div><span class="gmail_quote">On 4/19/07,
<b class="gmail_sendername">Mark Hammond</b> <<a href="mailto:mhammond@skippinet.com.au">mhammond@skippinet.com.au</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> I have been delving in to the process of adding support for IExtractImage<br>to<br>> pythonwin. I have run makegw on the necessary files, added the resulting<br>.cpp<br>> and .h files to com/win32comext/shell/src, added references in
shell.cpp<br>and<br>> setup.py, and now it seems all that is left to do is implement the proper<br>> data types which makegw did not know how to handle. (Also, if it would<br>> help anyone, I patched my makegw to run under Python
2.5 with no regex<br>> or regsub modules.)<br><br>Excellent - please feel free to send me the patches. makegw is *very* dumb<br>though.<br><br>> I have a few questions about the next steps, for those who may have done
<br>this before:<br><br>> I am left with a few lines of code in the PyIExtractImage.cpp file that<br>look like this:<br><br>> if (bPythonIsHappy && !PyObject_AsDWORD *( obpdwPriority, &pdwPriority ))<br>
bPythonIsHappy = FALSE;<br><br>See above - makepy is dumb :) For now, PyInt_AsLong should work fine for a<br>DWORD. HBITMAP should just use PyLong_FromVoidPtr (or however that is<br>spelt), and a SIZE already has PyWinObject_FromSIZE. You will just need to
<br>correct the invalid indirections created by makegw - eg, your line above<br>would read as:<br><br>> DWORD dwPriority;<br>> if (bPythonIsHappy && !PyInt_AsLong( obpdwPriority, (long *)&dwPriority ))<br>
bPythonIsHappy = FALSE;<br><br>Also, please see the existing support for IExtractIcon - this new interface<br>should be almost identical - just one or 2 data types appear to be different<br>between the interfaces (HICON -> HBITMAP being the most obvious one)
<br><br>Cheers,<br><br>Mark<br><br></blockquote></div><br>