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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. load image fail

load image fail

Scheduled Pinned Locked Moved C / C++ / MFC
databasegraphicshelptutorial
5 Posts 3 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.
  • V Offline
    V Offline
    vc programmer 0
    wrote on last edited by
    #1

    i want to run time image load. image path folder is in the database. fo example.."C:\Documents and Settings\mount top.bmp" i have image load fail error.. please explain me.. for image load fail error. following code is i using my demo. void CTestbitmapView::OnInitialUpdate() { CFormView::OnInitialUpdate(); ResizeParentToFit(); if(m_hBmpNew != NULL ) DeleteObject(m_hBmpNew); sourcex=sourcey=0; CString file; file="C:\Documents and Settings\mount top.bmp"; m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); if( m_hBmpNew == NULL ) { AfxMessageBox("Load Image Failed"); } else { m_stc.GetClientRect( &rectStaticClient ); rectStaticClient.NormalizeRect(); m_size.cx=rectStaticClient.Size().cx; m_size.cy=rectStaticClient.Size().cy; m_size.cx = rectStaticClient.Width(); m_size.cy = rectStaticClient.Height(); m_stc.ClientToScreen( &rectStaticClient ); ScreenToClient( &rectStaticClient); m_pt.x = rectStaticClient.left; m_pt.y = rectStaticClient.top; GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo ); VERIFY(m_hBmpOld = ( HBITMAP)SelectObject (m_dcMem,m_hBmpNew ) ); offsetx= m_pt.x; offsety=m_pt.y; InvalidateRect(&rectStaticClient); } }

    P N 2 Replies Last reply
    0
    • V vc programmer 0

      i want to run time image load. image path folder is in the database. fo example.."C:\Documents and Settings\mount top.bmp" i have image load fail error.. please explain me.. for image load fail error. following code is i using my demo. void CTestbitmapView::OnInitialUpdate() { CFormView::OnInitialUpdate(); ResizeParentToFit(); if(m_hBmpNew != NULL ) DeleteObject(m_hBmpNew); sourcex=sourcey=0; CString file; file="C:\Documents and Settings\mount top.bmp"; m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); if( m_hBmpNew == NULL ) { AfxMessageBox("Load Image Failed"); } else { m_stc.GetClientRect( &rectStaticClient ); rectStaticClient.NormalizeRect(); m_size.cx=rectStaticClient.Size().cx; m_size.cy=rectStaticClient.Size().cy; m_size.cx = rectStaticClient.Width(); m_size.cy = rectStaticClient.Height(); m_stc.ClientToScreen( &rectStaticClient ); ScreenToClient( &rectStaticClient); m_pt.x = rectStaticClient.left; m_pt.y = rectStaticClient.top; GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo ); VERIFY(m_hBmpOld = ( HBITMAP)SelectObject (m_dcMem,m_hBmpNew ) ); offsetx= m_pt.x; offsety=m_pt.y; InvalidateRect(&rectStaticClient); } }

      P Offline
      P Offline
      pubududilena
      wrote on last edited by
      #2

      hi, Replace: file="C:\Documents and Settings\mount top.bmp"; with file="C:\\Documents and Settings\\mount top.bmp";

      1 Reply Last reply
      0
      • V vc programmer 0

        i want to run time image load. image path folder is in the database. fo example.."C:\Documents and Settings\mount top.bmp" i have image load fail error.. please explain me.. for image load fail error. following code is i using my demo. void CTestbitmapView::OnInitialUpdate() { CFormView::OnInitialUpdate(); ResizeParentToFit(); if(m_hBmpNew != NULL ) DeleteObject(m_hBmpNew); sourcex=sourcey=0; CString file; file="C:\Documents and Settings\mount top.bmp"; m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); if( m_hBmpNew == NULL ) { AfxMessageBox("Load Image Failed"); } else { m_stc.GetClientRect( &rectStaticClient ); rectStaticClient.NormalizeRect(); m_size.cx=rectStaticClient.Size().cx; m_size.cy=rectStaticClient.Size().cy; m_size.cx = rectStaticClient.Width(); m_size.cy = rectStaticClient.Height(); m_stc.ClientToScreen( &rectStaticClient ); ScreenToClient( &rectStaticClient); m_pt.x = rectStaticClient.left; m_pt.y = rectStaticClient.top; GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo ); VERIFY(m_hBmpOld = ( HBITMAP)SelectObject (m_dcMem,m_hBmpNew ) ); offsetx= m_pt.x; offsety=m_pt.y; InvalidateRect(&rectStaticClient); } }

        N Offline
        N Offline
        namaskaaram
        wrote on last edited by
        #3

        please make the following correction... file="C:**\\Documents and Settings\\**mount top.bmp"; m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); cheerz.. :-D

        V 1 Reply Last reply
        0
        • N namaskaaram

          please make the following correction... file="C:**\\Documents and Settings\\**mount top.bmp"; m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); cheerz.. :-D

          V Offline
          V Offline
          vc programmer 0
          wrote on last edited by
          #4

          Thank you !! and another way i found... file="C:/Documents and Settings/mount top.bmp"; m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

          N 1 Reply Last reply
          0
          • V vc programmer 0

            Thank you !! and another way i found... file="C:/Documents and Settings/mount top.bmp"; m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

            N Offline
            N Offline
            namaskaaram
            wrote on last edited by
            #5

            happy programmin.....;) cheerz..... :-D

            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