关于在BC2007中导入ImageOle.dll的问题
首先regsvr32 imageole.dll这个没问题
然后在BC2007 Component->import component中导入
出错现象如下:
文件:ImageOleLib_TLB.h中
#if !defined(__UTILCLS_H_VERSION) || (__UTILCLS_H_VERSION < 0x0700)
//
// The code generated by the TLIBIMP utility or the Import|TypeLibrary
// and Import|ActiveX feature of C++Builder rely on specific versions of
// the header file UTILCLS.H found in the INCLUDE\VCL directory. If an
// older version of the file is detected, you probably need an update/patch.
//
#error "This file requires a newer version of the header UTILCLS.H" \
"You need to apply an update/patch to your copy of C++Builder"
#endif
在文件:ImageOleLib_TLB.cpp中
// $Rev: 5081 $
// File generated on 2008-1-8 22:54:09 from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Component\imageole.dll (1)
// LIBID: {710993A2-4F87-41D7-B6FE-F5A20368465F}
// LCID: 0
// Helpfile:
// HelpString: ImageOle 1.0 Type Library
// DepndLst:
// (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// Errors:
// Error creating palette bitmap of (TGifAnimator) : Error reading control bitmap
// ************************************************************************ //
这样直接导致的结果是没 TGifAnimator这个类
[解决办法]
http://www.ccrun.com/article.asp?i=1027&d=a5e8r3
看看你安装的是否正确
[解决办法]
我在BCB2007里也是这么做的(版本是11.0.2902.10471),结果导出来了:
说发贴内容太长,我把自带的注释去掉了
ImageOleLib_TLB.h
#ifndef ImageOleLib_TLBH#define ImageOleLib_TLBH#pragma option push -b -w-inl#if !defined(__UTILCLS_H)#include <utilcls.h>#endif#if !defined(__UTILCLS_H_VERSION) || (__UTILCLS_H_VERSION < 0x0700)#error "This file requires a newer version of the header UTILCLS.H" \ "You need to apply an update/patch to your copy of C++Builder"#endif#include <olectl.h>#include <ocidl.h>#if defined(USING_ATLVCL) || defined(USING_ATL)#if !defined(__TLB_NO_EVENT_WRAPPERS)#include <atl/atlmod.h>#endif#endifnamespace Stdvcl {class IStrings; class IStringsDisp;}using namespace Stdvcl;typedef TComInterface<IStrings> IStringsPtr;typedef TComInterface<IStringsDisp> IStringsDispPtr;namespace Imageolelib_tlb{extern __declspec (package) const GUID LIBID_ImageOleLib;extern __declspec (package) const GUID IID_IGifAnimator;extern __declspec (package) const GUID CLSID_GifAnimator;interface DECLSPEC_UUID("{0C1CF2DF-05A3-4FEF-8CD4-F5CFC4355A16}") IGifAnimator;typedef TComInterface<IGifAnimator, &IID_IGifAnimator> IGifAnimatorPtr;typedef IGifAnimator GifAnimator;typedef IGifAnimatorPtr GifAnimatorPtr;#define LIBID_OF_GifAnimator (&LIBID_ImageOleLib)interface IGifAnimator : public IDispatch{public: // [1] method LoadFromFile virtual HRESULT STDMETHODCALLTYPE LoadFromFile(BSTR FileName/*[in]*/) = 0; // [2] method TriggerFrameChange virtual HRESULT STDMETHODCALLTYPE TriggerFrameChange(VARIANT_BOOL* pbChanged/*[out,retval]*/) = 0; // [3] method GetFilePath virtual HRESULT STDMETHODCALLTYPE GetFilePath(BSTR* pFilePath/*[out,retval]*/) = 0; // [4] method ShowText virtual HRESULT STDMETHODCALLTYPE ShowText(BSTR Text/*[in]*/) = 0;#if !defined(__TLB_NO_INTERFACE_WRAPPERS) VARIANT_BOOL __fastcall TriggerFrameChange(void) { VARIANT_BOOL pbChanged; OLECHECK(this->TriggerFrameChange((VARIANT_BOOL*)&pbChanged)); return pbChanged; } BSTR __fastcall GetFilePath(void) { BSTR pFilePath = 0; OLECHECK(this->GetFilePath((BSTR*)&pFilePath)); return pFilePath; }#endif // __TLB_NO_INTERFACE_WRAPPERS};#if !defined(__TLB_NO_INTERFACE_WRAPPERS)template <class T /* IGifAnimator */ >class TCOMIGifAnimatorT : public TComInterface<IGifAnimator>, public TComInterfaceBase<IUnknown>{public: TCOMIGifAnimatorT() {} TCOMIGifAnimatorT(IGifAnimator *intf, bool addRef = false) : TComInterface<IGifAnimator>(intf, addRef) {} TCOMIGifAnimatorT(const TCOMIGifAnimatorT& src) : TComInterface<IGifAnimator>(src) {} TCOMIGifAnimatorT& operator=(const TCOMIGifAnimatorT& src) { Bind(src, true); return *this;} HRESULT __fastcall LoadFromFile(BSTR FileName/*[in]*/); HRESULT __fastcall TriggerFrameChange(VARIANT_BOOL* pbChanged/*[out,retval]*/); VARIANT_BOOL __fastcall TriggerFrameChange(void); HRESULT __fastcall GetFilePath(BSTR* pFilePath/*[out,retval]*/); BSTR __fastcall GetFilePath(void); HRESULT __fastcall ShowText(BSTR Text/*[in]*/);};typedef TCOMIGifAnimatorT<IGifAnimator> TCOMIGifAnimator;template<class T>class IGifAnimatorDispT : public TAutoDriver<IGifAnimator>{public: IGifAnimatorDispT(){} IGifAnimatorDispT(IGifAnimator *pintf) { TAutoDriver<IGifAnimator>::Bind(pintf, false); } IGifAnimatorDispT(IGifAnimatorPtr pintf) { TAutoDriver<IGifAnimator>::Bind(pintf, true); } IGifAnimatorDispT& operator=(IGifAnimator *pintf) { TAutoDriver<IGifAnimator>::Bind(pintf, false); return *this; } IGifAnimatorDispT& operator=(IGifAnimatorPtr pintf) { TAutoDriver<IGifAnimator>::Bind(pintf, true); return *this; } HRESULT BindDefault() { return OLECHECK(Bind(CLSID_GifAnimator)); } HRESULT BindRunning() { return BindToActive(CLSID_GifAnimator); } HRESULT __fastcall LoadFromFile(BSTR FileName/*[in]*/); HRESULT __fastcall TriggerFrameChange(VARIANT_BOOL* pbChanged/*[out,retval]*/); VARIANT_BOOL __fastcall TriggerFrameChange(void); HRESULT __fastcall GetFilePath(BSTR* pFilePath/*[out,retval]*/); BSTR __fastcall GetFilePath(void); HRESULT __fastcall ShowText(BSTR Text/*[in]*/);};typedef IGifAnimatorDispT<IGifAnimator> IGifAnimatorDisp;template <class T> HRESULT __fastcallTCOMIGifAnimatorT<T>::LoadFromFile(BSTR FileName/*[in]*/){ return (*this)->LoadFromFile(FileName);}template <class T> HRESULT __fastcallTCOMIGifAnimatorT<T>::TriggerFrameChange(VARIANT_BOOL* pbChanged/*[out,retval]*/){ return (*this)->TriggerFrameChange(pbChanged);}template <class T> VARIANT_BOOL __fastcallTCOMIGifAnimatorT<T>::TriggerFrameChange(void){ VARIANT_BOOL pbChanged; OLECHECK(this->TriggerFrameChange((VARIANT_BOOL*)&pbChanged)); return pbChanged;}template <class T> HRESULT __fastcallTCOMIGifAnimatorT<T>::GetFilePath(BSTR* pFilePath/*[out,retval]*/){ return (*this)->GetFilePath(pFilePath);}template <class T> BSTR __fastcallTCOMIGifAnimatorT<T>::GetFilePath(void){ BSTR pFilePath = 0; OLECHECK(this->GetFilePath((BSTR*)&pFilePath)); return pFilePath;}template <class T> HRESULT __fastcallTCOMIGifAnimatorT<T>::ShowText(BSTR Text/*[in]*/){ return (*this)->ShowText(Text);}template <class T> HRESULT __fastcallIGifAnimatorDispT<T>::LoadFromFile(BSTR FileName/*[in]*/){ _TDispID _dispid(*this, OLETEXT("LoadFromFile"), DISPID(1)); TAutoArgs<1> _args; _args[1] = FileName /*[VT_BSTR:0]*/; return OleFunction(_dispid, _args);}template <class T> HRESULT __fastcallIGifAnimatorDispT<T>::TriggerFrameChange(VARIANT_BOOL* pbChanged/*[out,retval]*/){ _TDispID _dispid(*this, OLETEXT("TriggerFrameChange"), DISPID(2)); TAutoArgs<0> _args; return OutRetValSetterPtr(pbChanged /*[VT_BOOL:1]*/, _args, OleFunction(_dispid, _args));}template <class T> VARIANT_BOOL __fastcallIGifAnimatorDispT<T>::TriggerFrameChange(void){ VARIANT_BOOL pbChanged; this->TriggerFrameChange((VARIANT_BOOL*)&pbChanged); return pbChanged;}template <class T> HRESULT __fastcallIGifAnimatorDispT<T>::GetFilePath(BSTR* pFilePath/*[out,retval]*/){ _TDispID _dispid(*this, OLETEXT("GetFilePath"), DISPID(3)); TAutoArgs<0> _args; return OutRetValSetterPtr(pFilePath /*[VT_BSTR:1]*/, _args, OleFunction(_dispid, _args));}template <class T> BSTR __fastcallIGifAnimatorDispT<T>::GetFilePath(void){ BSTR pFilePath; this->GetFilePath((BSTR*)&pFilePath); return pFilePath;}template <class T> HRESULT __fastcallIGifAnimatorDispT<T>::ShowText(BSTR Text/*[in]*/){ _TDispID _dispid(*this, OLETEXT("ShowText"), DISPID(4)); TAutoArgs<1> _args; _args[1] = Text /*[VT_BSTR:0]*/; return OleFunction(_dispid, _args);}typedef TCoClassCreatorT<TCOMIGifAnimator, IGifAnimator, &CLSID_GifAnimator, &IID_IGifAnimator> CoGifAnimator;#endif }; #if !defined(NO_IMPLICIT_NAMESPACE_USE)using namespace Imageolelib_tlb;#endif#pragma option pop#endif // ImageOleLib_TLBH