Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. LPPICTUREDISP -- CPictureHolder --- How to release memory?

LPPICTUREDISP -- CPictureHolder --- How to release memory?

Scheduled Pinned Locked Moved C / C++ / MFC
comperformancehelpquestionc++
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SNathani
    wrote on last edited by
    #1

    Hi, I've been working on an image based application. I'm using VB and VC++ to work with the images. Both are activex controls. I created a property like Get/SetActivePicture(LPPICTUREDISP pPicture). The code is given below. I'm facing memory problems. Can someone help me how can I release the memory from VC++ after I use the picture object? Thanks in advance .. I can't release the component until I solve this issue. Pls. somebody help me. The implemenation in VB is like this ... After using this, the virtual memory has been increasing each time ... the performance became too slow !!! :( .... PicEd.Open("C:\Temp.bmp") set PicEd.ActivePicture = Picture1.Picture PicEd.RotateBy(90) set Picture1.Picture = PicEd.ActivePicture() .... //---------------------------------------------------------------------- void CPicEdCtrl::SetActivePicture(LPPICTUREDISP newValue) { // TODO: Add your property handler here if (newValue == NULL) return; try { HBITMAP hBMP; HRESULT lResult; newValue->AddRef (); m_Pic.SetPictureDispatch(newValue); newValue->Release(); lResult = m_Pic.m_pPict->get_Handle((OLE_HANDLE FAR *) &hBMP); //CxImage* image; image->CreateFromHBITMAP((HBITMAP)hBMP); }catch (CException e) { e.ReportError(); e.Delete(); } SetModifiedFlag(); } // ------------ ---------------------- --------------- ------ LPPICTUREDISP CPicEdCtrl::GetActivePicture() { // TODO: Add your property handler here if (image == NULL) { m_Pic.CreateEmpty(); goto EndProp; } try { m_Pic.CreateFromBitmap (image->MakeBitmap(0)); }catch (CException e) { //Suppress any exceptions e.Delete(); m_Pic.CreateEmpty(); } EndProp: //return the IPicture dispatch interface return m_Pic.GetPictureDispatch(); }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups