 |
|
 |
hi there,
i tried your fine class for thumbnails, but doesn't work on showing thumbs...
have inserted all the 3 directories on web server: CxImage, CxImageATL, thumbasp.
Loaded correctly testlistthumbs.asp and selected directory where are the images .JPG
Pressing submit button, list of images are displayed, BUT THUMBS ARE NOT CREATED!!
Have i forgot something ??
Please help me tnx
Regards
|
|
|
|
 |
|
 |
I'm trying to integrate ThumbExtract into Microsoft's ActiveX Mime Player example (mimetype) via COM calls using unmanaged Visual C++ 2008. My goal is an ActiveX that will display Thumbnails for any files that have shell thumbnails. This is intended for internal use in an engineering document management system that uses an embedded IE web control that supports Active X players / documents. The mimetype ActiveX works in this context, which is why I'm using it as the base for integrating ThumbExtract.
I currently have a buildable/runnable project that has calls to CThumbExtract SetPath, SetDir and SetFile, but they don't appear to be firing the ThumbExtact code (based on Messagebox "debug" messages) and the Get methods are returning nothing. I'm using these calls as tests before moving on to the actual extraction/display functions. For modularity (may want to add other non-shell thumbnail format support later) and "it already works" (the original VB6 TestThumbExtract and ones I have translated into VB.NET and C#.NET apps), I would prefer to use ThumbExtact as a DLL rather than migrating the code over.
FWIW, I am a C++ newbie - this is my baptism by fire effort - with a VB and VB.NET background but have been working on this several hours per day over the last 10 days.
Here's the current code. Can anyone a) point out what I am doing incorrectly, b) provide working code or c) recommend an alternate approach including integrating the code directly into the mimetype code?
Any help much appreciated.
void CMimetypeCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
CString cstrThumbPath;
cstrThumbPath = Test(m_cstrCacheFileName);
CString cstrOut;
cstrOut.Format("File Name : %s\r\nLocal Cache Name : %s\r\nThumb Cache Name : %s", m_cstrFileName, m_cstrCacheFileName, cstrThumbPath);
m_ceditFileName.SetWindowText(cstrOut);
}
#ifndef FRMTEST_H
#define FRMTEST_H
#include "stdafx.h"
#include "CFileThumbExtract.h"
LPCTSTR Test(LPCTSTR FilePath);
#endif
#include "frmTest.h"
LPCTSTR Test(LPCTSTR FilePath)
{
CFileThumbExtract *m_oThumb;
m_oThumb = new CFileThumbExtract;
m_oThumb->SetPath(FilePath);
return m_oThumb->GetPath() + " = " + m_oThumb->GetDir() + " + " + m_oThumb->GetFile();
}
#import "<path>ThumbExtract.dll" no_namespace
class CFileThumbExtract : public COleDispatchDriver
{
public:
CFileThumbExtract(){} CFileThumbExtract(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CFileThumbExtract(const CFileThumbExtract& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
public:
public:
public:
void SetPath(LPCTSTR Path)
{
MessageBox(0,Path,"Wrapper SetPath",0); static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, parms, Path);
}
void SetDir(LPCTSTR Dir)
{
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x2, DISPATCH_METHOD, VT_EMPTY, NULL, parms, Dir);
}
void SetFile(LPCTSTR File)
{
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0x3, DISPATCH_METHOD, VT_EMPTY, NULL, parms, File);
}
void SetThumbnailSize(long Width, long Height)
{
static BYTE parms[] = VTS_I4 VTS_I4 ;
InvokeHelper(0x4, DISPATCH_METHOD, VT_EMPTY, NULL, parms, Width, Height);
}
CString GetPath()
{
CString result;
InvokeHelper(0x5, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
MessageBox(0,result,"Wrapper GetPath",0);
return result;
}
CString GetDir()
{
CString result;
InvokeHelper(0x6, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
return result;
}
CString GetFile()
{
CString result;
InvokeHelper(0x7, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
return result;
}
long ExtractThumbnail()
{
long result;
InvokeHelper(0x8, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
return result;
}
void FreeThumbnail()
{
InvokeHelper(0x9, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
void SaveToFile(LPCTSTR FilePath)
{
static BYTE parms[] = VTS_BSTR ;
InvokeHelper(0xa, DISPATCH_METHOD, VT_EMPTY, NULL, parms, FilePath);
}
long get_Stride()
{
long result;
InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
CString get_Version()
{
CString result;
InvokeHelper(0xc, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
VARIANT get_ThumbJpgData(long JpegQuality)
{
VARIANT result;
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0xd, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, parms, JpegQuality);
return result;
}
public:
};
|
|
|
|
 |
|
 |
Hey Philipos,
hey all the others,
great work ! I've been looking for this for so long. But I've got the problem that I have VS 2008 and I somehow cannot convert the wizard to it because I am really a newbie to Shell extensions and project wizards. Is there somebody who already has made a conversion to newer versions of VS? I am trying to adapt the Scribble project, but this doesn't work at all... The best would be to have the wizard for VS 2003 or VS 2008! Thanks in advance.
|
|
|
|
 |
|
 |
I was looking for same type of functionality for my DICOM viewer. can you provide your icon extractor?
Thanks
cpgcon
|
|
|
|
 |
|
 |
I've used the project to create a thumbnail preview shell extension for a specific file type, which was quick and easy on XP thanks to the project - many thanks !
Then I tried to have the resulting code ported from VC6 on XP to VC8 on Vista. Compiling with VC8 produced an expected set of warnings with which I had no problems (such as using the secure CRT functions).
Problem is the registration stage (executed after the link) fails with error PRJ0019. Anyone knows how to resolve that ?
Many thanks in advance.
|
|
|
|
 |
|
 |
The MSDN GetLocation documentation indicates that the flag value IEIFLAG_CACHE can be set in pdwFlags to cause the caller (the Shell?) to cache the returned thumbnails:
"Windows XP and earlier: Set by the object to indicate that it will not cache the image. If this flag is returned, the Shell will cache a copy of the image."
That flag is not being set here in the GetLocation method. Anyone know if that would cause a problem with this implementation?
Thanks.
|
|
|
|
 |
|
 |
The GetLocation method has: if (*pdwFlags & IEIFLAG_ASYNC) return E_PENDING; return NOERROR; Which I think (???) is supposed to indicate that the extractor object supports multithreading. But ScribbleExtractor.h declares the COM object this way: ///////////////////////////////////////////////////////////////////////////// // CScribbleExtractor class ATL_NO_VTABLE CScribbleExtractor : public CComObjectRootEx<ccomsinglethreadmodel>, public CComCoClass<cscribbleextractor, &clsid_scribbleextractor="">, public IPersistFile, public IExtractImage2 ... and CFileThumbExtract is declared this way: ///////////////////////////////////////////////////////////////////////////// // CFileThumbExtract class ATL_NO_VTABLE CFileThumbExtract : public CComObjectRootEx<ccomsinglethreadmodel>, public CComCoClass<cfilethumbextract, &clsid_filethumbextract="">, public ISupportErrorInfo, public IDispatchImpl<ifilethumbextract, &iid_ifilethumbextract,="" &libid_thumbextractlib="">
...which appears to contradict the multithreading capability. Am I missing something here? </ifilethumbextract,></cfilethumbextract,></ccomsinglethreadmodel></cscribbleextractor,></ccomsinglethreadmodel> modified on Sunday, April 6, 2008 7:38 PM
|
|
|
|
 |
|
 |
It works great in XP. ¿Is it possible to use this to obtain thumbnails of custom files in Windows Vista?
|
|
|
|
 |
|
 |
Its a great code. Thank you very much!!!
|
|
|
|
 |
|
|
 |
|
 |
Hi Philipos,
I downloaded the project. But the project only provide scribble.exe. Can you send me the source code of scribble.exe. I need to know how to modify my MFC application to use the shell extension. Or could you explain the steps to do it? I'm a newbie. Thanks.
|
|
|
|
 |
|
 |
Hi,
How to get the thumbnail after the file has been saved to disk? I need thumbnails for the most recent image files without openning the most recent image files. Thanks.
|
|
|
|
 |
|
|
 |
|
 |
Hi! You might try a small adjustment of the return code test following the GetLocation() call in FileThumbExtract.cpp (near line ~ 84): --8<---------------------- // define thumbnail properties hr = peiURL->GetLocation(pszPath, MAX_PATH, &dwPriority, &size, 16, &dwFlags); if(hr != E_PENDING && FAILED(hr)) goto OnExit; --8<---------------------- Test for E_PENDING added. I had some problems with extracting icons for Illustrator and EPS files, but this fix made it work. /martin
|
|
|
|
 |
|
 |
Explorer uses another interface IRunnableTask, in order to not block too much the shell while creating the thumbnail any example on how to implement it?
|
|
|
|
 |
|
 |
Can I have a copy of the DICOM image extractor?
|
|
|
|
 |
|
 |
I would appreciate very to have a hand on DICOM image extractor.
Yves
|
|
|
|
 |
|
 |
Can u plz help me of how to view DICOM 3,images thk in advance.
awaiting for reply
|
|
|
|
 |
|
 |
To remove the annoying C2504 error
C2504: 'IExtractImage2' : base class undefined
Change the version of IE to 5.
#ifndef _WIN32_IE
#define _WIN32_IE 0x0501
#endif
|
|
|
|
 |
|
 |
I found a problem with both this sample and and the thumbplug sample ( http://greggman.com/pages/thumbplug_tga.htm ).
None of the 2 samples returned anything into the pszPathBuffer from GetLocation.
A simple :
USES_CONVERSION;
swprintf( pszPathBuffer, A2W("%d"), count++ );
fixed it.
Hope it helps some who had the same problem.
|
|
|
|
 |
|
 |
Hi,
I created 2 thumbnail projects with the wizard which seems to work ok, but memory seem to occur:
Detected memory leaks!
Dumping objects ->
strcore.cpp(118) : {111} normal block at 0x03276048, 75 bytes long.
Data: < > > Fil> 01 00 00 00 3E 00 00 00 3E 00 00 00 0A 46 69 6C
#File Error#(77) : {110} client block at 0x03275F70, subtype 0, 144 bytes long.
a CMultiDocTemplate object at $03275F70, 144 bytes long
strcore.cpp(118) : {108} normal block at 0x03275E30, 75 bytes long.
Data: < > > Fil> 01 00 00 00 3E 00 00 00 3E 00 00 00 0A 46 69 6C
#File Error#(75) : {106} client block at 0x03275CF0, subtype 0, 144 bytes long.
a CMultiDocTemplate object at $03275CF0, 144 bytes long
strcore.cpp(118) : {94} normal block at 0x032754D0, 90 bytes long.
Data: < M M Cus> 01 00 00 00 4D 00 00 00 4D 00 00 00 0A 43 75 73
plex.cpp(31) : {92} normal block at 0x032753B0, 124 bytes long.
Data: < S' R' > 00 00 00 00 C0 53 27 03 00 00 00 00 18 52 27 03
doctempl.cpp(64) : {91} client block at 0x03275348, subtype 0, 32 bytes long.
a CDocManager object at $03275348, 32 bytes long
doctempl.cpp(62) : {90} client block at 0x032752F0, subtype 0, 28 bytes long.
a CPtrList object at $032752F0, 28 bytes long
#File Error#(80) : {89} client block at 0x03275218, subtype 0, 144 bytes long.
a CMultiDocTemplate object at $03275218, 144 bytes long
Object dump complete.
Moe.
|
|
|
|
 |
|
 |
The way i see it, the entire document and CExtractImageApp stuff is unnecessary.
I removed the doc template stuff from InitInstance,
I have erased the CExtractImageApp class and files
and the Document files from the project, the m_pDoc member...
the project still works, its simpler and w/out mem leaks
Moe10
|
|
|
|
 |
|
 |
Can you make your dll available? I am not very comfortable with VC++, so that would be very useful!
Thanks!
Moe10 wrote:
removed the doc template stuff from InitInstance,
I have erased the CExtractImageApp class and files
and the Document files from the project, the m_pDoc member...
the project still works, its simpler and w/out mem leaks
Ashwin
|
|
|
|
 |
|
 |
The programming style renders the COM-object a little bit useless without much working on it. I tend to have the code in a seperate class, so that the functions can be directly integrated without using COM. MFC/ATL/STL is all mixed up (basic_string vs. CStringW), properties werent accessed as properties but as methods (GetPath vs. get_Path), plain C prototypes are mixed into C++-Headers and so on. I would like to give the new class, after I have recoded it, to somebody, so that others can use it, but I dont have the time to write a whole article on it.
|
|
|
|
 |
|
 |
Nice piece of code, thanks!
One question though, although the IExtractImage is used to make the thumbnail, how can I hook into the Shell Extensions such that I can emulate the default behaviour for previewing a BMP or JPG where it returns the dimensions in a string? e.g. at the top of this article page where you have a screenshot showing the .SCB thumbnails the explorer window to the left has default attributes for Modified, Size and Attributes, but BMP/JPG add a "Dimensions" column - any idea how to do this?
|
|
|
|
 |
|