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. LoadImage Failure

LoadImage Failure

Scheduled Pinned Locked Moved C / C++ / MFC
c++comgraphicsjson
7 Posts 3 Posters 2 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi I have a bitmap file of a red bullet Originally I tried to display it using RichEdit Ole Interface I copied the code modified it somewhat from the "Q220844: HOWTO: Insert a Bitmap Into RTF Document Using RichEdit Control" I was able to display it however it didn't fit quite right So I decided to go with a native Win32 and display on Static control adjacent to the rich edit Thing is where the OleCreateFromFile worked the LoadImage API fails GetLastError return a zero as well using File Explorer I can see the red bullet Thnaks

    L L 2 Replies Last reply
    0
    • F ForNow

      Hi I have a bitmap file of a red bullet Originally I tried to display it using RichEdit Ole Interface I copied the code modified it somewhat from the "Q220844: HOWTO: Insert a Bitmap Into RTF Document Using RichEdit Control" I was able to display it however it didn't fit quite right So I decided to go with a native Win32 and display on Static control adjacent to the rich edit Thing is where the OleCreateFromFile worked the LoadImage API fails GetLastError return a zero as well using File Explorer I can see the red bullet Thnaks

      L Offline
      L Offline
      leon de boer
      wrote on last edited by
      #2

      You aren't trying to load a jpg, gif or png are you .. loadimage does not support those it is strictly BMP and PCX. If you need those just use IPic and for that all you need is #include

      In vino veritas

      F 1 Reply Last reply
      0
      • F ForNow

        Hi I have a bitmap file of a red bullet Originally I tried to display it using RichEdit Ole Interface I copied the code modified it somewhat from the "Q220844: HOWTO: Insert a Bitmap Into RTF Document Using RichEdit Control" I was able to display it however it didn't fit quite right So I decided to go with a native Win32 and display on Static control adjacent to the rich edit Thing is where the OleCreateFromFile worked the LoadImage API fails GetLastError return a zero as well using File Explorer I can see the red bullet Thnaks

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        I expect your code is wrong. But since you have not shown us what code you are using it is impossible to say more.

        1 Reply Last reply
        0
        • L leon de boer

          You aren't trying to load a jpg, gif or png are you .. loadimage does not support those it is strictly BMP and PCX. If you need those just use IPic and for that all you need is #include

          In vino veritas

          F Offline
          F Offline
          ForNow
          wrote on last edited by
          #4

          Are you referring to OLeLoadPicturefile BTW As I mentioned to Richard when I used the code example in the following article

          Quote:

          Q220844: HOWTO: Insert a Bitmap Into RTF Document Using RichEdit Control"

          Even though I had a 1 in the first param of the SetSel the Red bullet didn't align itself right next the left border of the dialog box In file explorer the image looked fine. Opening up the image in Paintbrush I see a white rectangular border around the red bullet maybe that was part of the problem I loaded the image by doing a google search is if this is the problem is there a way from get this image (I am trying to get something like the visual studio Breakpoint) Thanks

          L 1 Reply Last reply
          0
          • F ForNow

            Are you referring to OLeLoadPicturefile BTW As I mentioned to Richard when I used the code example in the following article

            Quote:

            Q220844: HOWTO: Insert a Bitmap Into RTF Document Using RichEdit Control"

            Even though I had a 1 in the first param of the SetSel the Red bullet didn't align itself right next the left border of the dialog box In file explorer the image looked fine. Opening up the image in Paintbrush I see a white rectangular border around the red bullet maybe that was part of the problem I loaded the image by doing a google search is if this is the problem is there a way from get this image (I am trying to get something like the visual studio Breakpoint) Thanks

            L Offline
            L Offline
            leon de boer
            wrote on last edited by
            #5

            So much confusion and misunderstandings to know where to start. Lets start with SetSel misunderstanding which starts at 0 NOT 1 it is a zero-based index. Very important is the file type you didn't say what the file was look at the last 3 letters of the filename is it BMP, GIF, JPG or PNG? Yes if you have a white border the white border will be on the image UNLESS it is a transparent image which needs a special header and depends on file format (so again we need the file format). You said you change the code over to LoadImage and I warned you that you can only load files that are of BMP and PCX type. That is files that end with those 3 letters and have a proper matching header. If you try to load a wrong type it does pretty much what you describe returns NULL with a GetLastError of 0 because it can find the file but it's just junk it can't understand. So can we at least get a filetype to start with so we know what we are dealing with, so 3 letter filename extension please. If you can't see them on windows go up to view settings and tick the box that says file name extensions.

            In vino veritas

            F 1 Reply Last reply
            0
            • L leon de boer

              So much confusion and misunderstandings to know where to start. Lets start with SetSel misunderstanding which starts at 0 NOT 1 it is a zero-based index. Very important is the file type you didn't say what the file was look at the last 3 letters of the filename is it BMP, GIF, JPG or PNG? Yes if you have a white border the white border will be on the image UNLESS it is a transparent image which needs a special header and depends on file format (so again we need the file format). You said you change the code over to LoadImage and I warned you that you can only load files that are of BMP and PCX type. That is files that end with those 3 letters and have a proper matching header. If you try to load a wrong type it does pretty much what you describe returns NULL with a GetLastError of 0 because it can find the file but it's just junk it can't understand. So can we at least get a filetype to start with so we know what we are dealing with, so 3 letter filename extension please. If you can't see them on windows go up to view settings and tick the box that says file name extensions.

              In vino veritas

              F Offline
              F Offline
              ForNow
              wrote on last edited by
              #6

              I understand that LoadImage wont work, Let me ask the following if I use LineIndex(-1) then I am returned the char index on the line and its I ASSUME it is the first char index in that line that has the caret Afterwards if I do GetCharPos using that value I get the x,y coordinates in pixels of that char so I would like to place my bullet there and x = 1 that it should lie all the way to the left of the rich edit control and yet its off (about 1/8 of inch) my only guess is when I display the bullet in paintbrush there is white rectangle around it and that is what is pushing it off. what do you think if this true would you know how I would go about getting a red bullet bmp/png like the breakpoint in Visual studio Debugger Thanks

              L 1 Reply Last reply
              0
              • F ForNow

                I understand that LoadImage wont work, Let me ask the following if I use LineIndex(-1) then I am returned the char index on the line and its I ASSUME it is the first char index in that line that has the caret Afterwards if I do GetCharPos using that value I get the x,y coordinates in pixels of that char so I would like to place my bullet there and x = 1 that it should lie all the way to the left of the rich edit control and yet its off (about 1/8 of inch) my only guess is when I display the bullet in paintbrush there is white rectangle around it and that is what is pushing it off. what do you think if this true would you know how I would go about getting a red bullet bmp/png like the breakpoint in Visual studio Debugger Thanks

                L Offline
                L Offline
                leon de boer
                wrote on last edited by
                #7

                Well techinically it is x = 0 but there is nothing stopping you simply entering a negative x co-ordinate of a few pixels to allow for your white border. The richedit like all windows knows how to clip :-)

                In vino veritas

                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