6// compiler-generated file created 10/25/04 at 22:00:58 - DO NOT EDIT! 7#pragma once 8 9// 10// interface IGifAnimator wrapper method implementations 11// 12 13inline HRESULT IGifAnimator::LoadFromFile ( _bstr_t FileName ) { 14 HRESULT _hr = raw_LoadFromFile(FileName); 15 if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); 16 return _hr; 17} 18 19inline VARIANT_BOOL IGifAnimator::TriggerFrameChange ( ) { 20 VARIANT_BOOL _result; 21 HRESULT _hr = raw_TriggerFrameChange(&_result); 22 if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); 23 return _result; 24} 25 26inline _bstr_t IGifAnimator::GetFilePath ( ) { 27 BSTR _result; 28 HRESULT _hr = raw_GetFilePath(&_result); 29 if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); 30 return _bstr_t(_result, false); 31} 32 33inline HRESULT IGifAnimator::ShowText ( _bstr_t Text ) { 34 HRESULT _hr = raw_ShowText(Text); 35 if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); 36 return _hr; 37}
有了这些,你使用接口和函数就很方便了。 然后就这样:
WINOLEAPI CoInitializeEx(LPVOID pvReserved, DWORD dwCoInit)
为什么要这样呢?因为我们使用这个函数。那有必要这样么?在MSDN是说要 #define _DCOM_ 就行了。可惜我没有成功。就只好这样了。 接着就是实现代码了。现在看应该没有很大的问题。如果还是很难明白。那么我你得好好研究CRichEditCtrl和OLE了。听说Inside OLE和Inside COM很好。我没有弄到。就看了《COM+编程指南》和潘爱民的《COM原理和应用》,不错!还有一个好东西。就是 ActiveX Control Test Container 的源代码。 更多内容请看MSN图像 MSN专题 QQ表情专题,或 最后该出场的就是实现代码了。
1 LPLOCKBYTES lpLockBytes = NULL; 2 SCODE sc; 3 HRESULT hr; 4 //print to RichEdit' s IClientSite 5 LPOLECLIENTSITE m_lpClientSite; 6 //A smart point to IAnimator
7 IGifAnimatorPtr m_lpAnimator; 8 //ptr 2 storage 9 LPSTORAGE m_lpStorage; 10 //the object 2 b insert 2 11 LPOLEOBJECT m_lpObject; 12 13 //Create lockbytes 14 sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes); 15 if (sc != S_OK) 16 AfxThrowOleException(sc); 17 ASSERT(lpLockBytes != NULL); 18 19 //use lockbytes to create storage 20 sc = ::StgCreateDocfileOnILockBytes(lpLockBytes,
复制本页网址和标题,发送给你QQ/Msn的好友一起分享
上一篇:CRichEditCtrl实现MSN背景,字体,超链接
下一篇:用模拟精灵解百度编程大赛试题