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. Displaying a picture?

Displaying a picture?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
16 Posts 5 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.
  • I iayd

    Hi I am not experienced at MFC.I want to ask that how can I display a jpeg format picture simply.I need that for a project in Windows CE and OleLoadPicture and IPicture methods are unsupported by Windows CE.So is there any other way without using these methods? Thanks for any help

    H Offline
    H Offline
    Hamid Taebi
    wrote on last edited by
    #7

    Do you need to like this code?

    CImage m_Image;
    m_Image.Load("C:\\1.hpg");
    m_Static.SetBitmap(m_Image.Detach());


    WhiteSky


    I 1 Reply Last reply
    0
    • H Hamid Taebi

      Do you need to like this code?

      CImage m_Image;
      m_Image.Load("C:\\1.hpg");
      m_Static.SetBitmap(m_Image.Detach());


      WhiteSky


      I Offline
      I Offline
      iayd
      wrote on last edited by
      #8

      I am sorry but I don't know what is CImage, I think it is not a MFC class.

      R H 2 Replies Last reply
      0
      • I iayd

        I tried the method you said in Visual C++ 6 but that did not show jpeg format picture(that works for bmp format).Can you say where can be my mistake.I wrote like that; HBITMAP bmpHandle = (HBITMAP)LoadImage(NULL, strPictureName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #9

        Try

        HBITMAP bmpHandle = (HBITMAP)LoadImage(NULL,
        strPictureName,
        IMAGE_BITMAP,
        0,
        0,
        LR_DEFAULTSIZE | LR_LOADFROMFILE);

        :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

        1 Reply Last reply
        0
        • I iayd

          I am sorry but I don't know what is CImage, I think it is not a MFC class.

          R Offline
          R Offline
          Rajkumar R
          wrote on last edited by
          #10

          You can use CImage from either MFC or ATL. Need to include "atlimage.h"

          I 1 Reply Last reply
          0
          • R Rajkumar R

            You can use CImage from either MFC or ATL. Need to include "atlimage.h"

            I Offline
            I Offline
            iayd
            wrote on last edited by
            #11

            I added the header file to the file where I used CImage ; #include "atlimage.h" But it gave an error as "fatal error C1083: Cannot open include file: 'atlimage.h': No such file or directory" What I missed?

            R H 2 Replies Last reply
            0
            • I iayd

              I added the header file to the file where I used CImage ; #include "atlimage.h" But it gave an error as "fatal error C1083: Cannot open include file: 'atlimage.h': No such file or directory" What I missed?

              R Offline
              R Offline
              Rajkumar R
              wrote on last edited by
              #12

              Sorry, May be WINCE don't support CImage. Search your VC headers for atlimage. If you can use CImage it is easy to use. Lets wait for other's response

              I 1 Reply Last reply
              0
              • R Rajkumar R

                Sorry, May be WINCE don't support CImage. Search your VC headers for atlimage. If you can use CImage it is easy to use. Lets wait for other's response

                I Offline
                I Offline
                iayd
                wrote on last edited by
                #13

                I did not try that in WinCE. I tried it in Visual C++ 6 so I think I have a mistake.Can you say that how can I add the header file to the project?is it enough to add the header file("atlimage.h") to Stdafx.h?

                R 1 Reply Last reply
                0
                • I iayd

                  I am sorry but I don't know what is CImage, I think it is not a MFC class.

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #14

                  You can use CImage with MFC or ATL,this is of the MSDN CImage provides enhanced bitmap support, including the ability to load and save images in JPEG, GIF, BMP, and Portable Network Graphics (PNG) formats.


                  WhiteSky


                  1 Reply Last reply
                  0
                  • I iayd

                    I added the header file to the file where I used CImage ; #include "atlimage.h" But it gave an error as "fatal error C1083: Cannot open include file: 'atlimage.h': No such file or directory" What I missed?

                    H Offline
                    H Offline
                    Hamid Taebi
                    wrote on last edited by
                    #15

                    Whats your compiler?


                    WhiteSky


                    1 Reply Last reply
                    0
                    • I iayd

                      I did not try that in WinCE. I tried it in Visual C++ 6 so I think I have a mistake.Can you say that how can I add the header file to the project?is it enough to add the header file("atlimage.h") to Stdafx.h?

                      R Offline
                      R Offline
                      Rajkumar R
                      wrote on last edited by
                      #16

                      Hi, May be this helps you, http://www.codeproject.com/bitmap/trans_cimage.asp?df=100&forumid=2625&exp=0&select=423969[^]

                      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