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. Assistance required on Bitmaps

Assistance required on Bitmaps

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
5 Posts 4 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.
  • B Offline
    B Offline
    Barm
    wrote on last edited by
    #1

    I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks

    S H A 3 Replies Last reply
    0
    • B Barm

      I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks

      S Offline
      S Offline
      Steve S
      wrote on last edited by
      #2

      What format are the saved images in? If they are BMP,JPEG,GIF you can use the OLE picture support to render them, and you could derive from CStatic to make your own picture box, or use something like the one from MSDN done by Paul DiLascia (spelling?) Steve S Developer for hire!

      B 1 Reply Last reply
      0
      • S Steve S

        What format are the saved images in? If they are BMP,JPEG,GIF you can use the OLE picture support to render them, and you could derive from CStatic to make your own picture box, or use something like the one from MSDN done by Paul DiLascia (spelling?) Steve S Developer for hire!

        B Offline
        B Offline
        Barm
        wrote on last edited by
        #3

        The images are .bmp, I have a picture control, CStatic m_StillPic I've tried using m_StillPic.SetBitmap() but without success. Can you explain the parameter inside SetBitmap(), where do I put the path to the file? Thanks

        1 Reply Last reply
        0
        • B Barm

          I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks

          H Offline
          H Offline
          Hamed Musavi
          wrote on last edited by
          #4

          Hi, If m_stillPic is a StaticCtrl & your BMP path is "C:\\Pic.bmp" : HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), _T("C:\\Pic.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); if (hBitmap) m_stillPic.SetBitmap(hBitmap); m_stillPic.UpdateWindow();

          1 Reply Last reply
          0
          • B Barm

            I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks

            A Offline
            A Offline
            Achim Klein
            wrote on last edited by
            #5

            Hi, create a CStatic control and choose type 'rectangle'. Use the following code to draw into that window.

            void DrawBitmap(CBitmap* pBitmap, CWnd* pWindow, CPoint Offset)
            {
            // get bitmap information
            BITMAP bmpInfo;
            pBitmap->GetObject(sizeof(bmpInfo), &bmpInfo);

            // get source size
            CSize srcSize;
            srcSize.cx = bmpInfo.bmWidth;
            srcSize.cy = bmpInfo.bmHeight;
            
            // get window's client device context
            CClientDC\* pDC = new CClientDC(pWindow);
            
            // create compatible divice context for stretching
            CDC\* memDC = new CDC; memDC->CreateCompatibleDC(pDC);
            
            // load bitmap in original size
            CBitmap\* old = memDC->SelectObject(pBitmap);
            
            // copy bitmap data
            pDC->BitBlt(Offset.x, Offset.y, srcSize.cx, srcSize.cy, memDC, 0, 0, SRCCOPY);
            
            // reselect first bitmap
            memDC->SelectObject(old);
            
            // delete device context and reset pointer
            delete memDC; memDC = 0;
            
            // delete device context and reset pointer
            delete pDC; pDC = 0;
            

            }

            Regards If I have seen further, it is by standing on the shoulders of giants. Isaac Newton

            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