请问如何完善下面的功能,RichEdit显示GIF动画?现在能够在RichEdit中添加BMP与GIF图片,
GIF也能动,想实现的功能是如何能存储RichEdit中内容到sql2000,并且能够读取,保证读出
后格式一样,且GIF也能动!请问该怎么改软件?下面是软件的下载链接!分不够开帖再加,前提要源码,可以发到,好用立即再加500分!
http://www.rayfile.com/zh-cn/files/71118f51-fdf0-11e0-b727-0015c55db73d/e1cd0109/

解决方案 »

  1.   

    下载不了,直接发我邮箱看看,[email protected]
      

  2.   

    ImageOle.dll使用了GdiPlus.dll,制作安装包时最好把这个dll也带上( XP系统自带)(本文的代码来自其他网友)参考a: http://www.codeproject.com/richedit/AnimatedEmoticon.asp?print=true参考b: http://blog.joycode.com/jiangsheng/archive/2004/12/15/41209.aspx1. 先用 regsvr32 注册一下ImageOle.dll2. 代码CRichEditCtrlEx 继承自CRichEditCtrlvoid CRichEditCtrlEx::insertGif(CString strFilePath) //strFilePath gif文件路径
    {
    LPLOCKBYTES lpLockBytes = NULL; 
    SCODE sc; 
    HRESULT hr; 
    //print to RichEdit' s IClientSite 
    LPOLECLIENTSITE m_lpClientSite; 
    //A smart point to IAnimator 
    ImageOleLib::IGifAnimatorPtr m_lpAnimator; 
    //ptr 2 storage 
    LPSTORAGE m_lpStorage; 
    //the object 2 b insert 2 
    LPOLEOBJECT m_lpObject; 
    //Create lockbytes 
    sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes); 
    if (sc != S_OK) 
    AfxThrowOleException(sc); 
    ASSERT(lpLockBytes != NULL); 
    //use lockbytes to create storage 
    sc = ::StgCreateDocfileOnILockBytes(lpLockBytes, 
    STGM_SHARE_EXCLUSIVE |STGM_CREATE |STGM_READWRITE, 0, &m_lpStorage); 
    if (sc != S_OK) 

    VERIFY(lpLockBytes->Release() == 0); 
    lpLockBytes = NULL; 
    AfxThrowOleException(sc); 

    ASSERT(m_lpStorage != NULL); 
    //get the ClientSite of the very RichEditCtrl 
    GetIRichEditOle()->GetClientSite(&m_lpClientSite); 
    ASSERT(m_lpClientSite != NULL); 
    try 

    //Initlize COM interface hr = ::CoInitialize(NULL) ;//( NULL, COINIT_APARTMENTTHREADED ); 
    if( FAILED(hr) ) 
    _com_issue_error(hr); //Get GifAnimator object 
    //here, I used a smart point, so I do not need to free it 
    hr = m_lpAnimator.CreateInstance(ImageOleLib::CLSID_GifAnimator); 
    if( FAILED(hr) ) 
    _com_issue_error(hr); 
    //COM operation need BSTR, so get a BSTR 
    BSTR path = strFilePath.AllocSysString(); //Load the gif 
    hr = m_lpAnimator->LoadFromFile(path); 
    if( FAILED(hr) ) 
    _com_issue_error(hr); TRACE0( m_lpAnimator->GetFilePath() ); //get the IOleObject 
    hr = m_lpAnimator.QueryInterface(IID_IOleObject, (void**)&m_lpObject); 
    if( FAILED(hr) ) 
    _com_issue_error(hr); //Set it 2 b inserted 
    OleSetContainedObject(m_lpObject, TRUE); //2 insert in 2 richedit, you need a struct of REOBJECT 
    REOBJECT reobject; 
    ZeroMemory(&reobject, sizeof(REOBJECT)); reobject.cbStruct = sizeof(REOBJECT); 
    CLSID clsid; 
    sc = m_lpObject->GetUserClassID(&clsid); 
    if (sc != S_OK) 
    AfxThrowOleException(sc); 
    //set clsid 
    reobject.clsid = clsid; 
    //can be selected 
    reobject.cp = REO_CP_SELECTION; 
    //content, but not static 
    reobject.dvaspect = DVASPECT_CONTENT; 
    //goes in the same line of text line 
    reobject.dwFlags = REO_BELOWBASELINE; //REO_RESIZABLE | 
    reobject.dwUser = 0; 
    //the very object 
    reobject.poleobj = m_lpObject; 
    //client site contain the object 
    reobject.polesite = m_lpClientSite; 
    //the storage 
    reobject.pstg = m_lpStorage; SIZEL sizel; 
    sizel.cx = sizel.cy = 0; 
    reobject.sizel = sizel; 
    HWND hWndRT = this->m_hWnd; 
    //Sel all text 
    // ::SendMessage(hWndRT, EM_SETSEL, 0, -1); 
    // DWORD dwStart, dwEnd; 
    // ::SendMessage(hWndRT, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd); 
    // ::SendMessage(hWndRT, EM_SETSEL, dwEnd+1, dwEnd+1); 
    //Insert after the line of text 
    GetIRichEditOle()->InsertObject(&reobject); 
    ::SendMessage(hWndRT, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0); 
    VARIANT_BOOL ret; 
    //do frame changing 
    ret = m_lpAnimator->TriggerFrameChange(); 
    //show it 
    m_lpObject->DoVerb(OLEIVERB_UIACTIVATE, NULL, m_lpClientSite, 0, m_hWnd, NULL); 
    m_lpObject->DoVerb(OLEIVERB_SHOW, NULL, m_lpClientSite, 0, m_hWnd, NULL); //redraw the window to show animation 
    RedrawWindow(); if (m_lpClientSite) 

    m_lpClientSite->Release(); 
    m_lpClientSite = NULL; 

    if (m_lpObject) 

    m_lpObject->Release(); 
    m_lpObject = NULL; 

    if (m_lpStorage) 

    m_lpStorage->Release(); 
    m_lpStorage = NULL; 
    } SysFreeString(path); 

    catch( _com_error e ) 

    AfxMessageBox(e.ErrorMessage()); 
    ::CoUninitialize(); 
    } }
      

  3.   

    下载地址在这,在下面TestGif.rar,上面的下载不了,帮帮忙啊!!!http://good.gd/1714805.htm
      

  4.   

    另外我提的建议可以参考下,我以前做过类似的图像控件,不过是bmp的,就是从固定路径来加载图片的
      

  5.   

    下载个Richview控件,用文件流直接读取
      

  6.   

    没有funxu,我还是想直接存到数据里,哪管分成两个表或两部分存取也行,考虑到安全隐患,另外
    左侧Richedit中添加Gif时最好可以用OpenPictureDialog打开选择添加,添加好后再存到数据库中,可以设个编号如:001,然后再根据编号001读出来放到右侧Richedite2中,格式不变,gif能动。
      

  7.   

    用别的控件也行,有说用RichView的,只要能实现功能就可以。
      

  8.   

    运行这个demo提示:没有注册类别。
    为什么会这样?不是已经导入类型库了吗?怎么还要注册DLL吗?