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. IRichEditOle::InsertObject shifts text one byte

IRichEditOle::InsertObject shifts text one byte

Scheduled Pinned Locked Moved C / C++ / MFC
graphicscareer
6 Posts 2 Posters 1 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

    The Inseertobject does its job inserting a red bullet bitmap however it shifts over all the text by one byte as it puts a leading X'3F' I tried using ReplaceSel shifting the text back one byte but upon display that line got duplicated Thanks

    L 1 Reply Last reply
    0
    • F ForNow

      The Inseertobject does its job inserting a red bullet bitmap however it shifts over all the text by one byte as it puts a leading X'3F' I tried using ReplaceSel shifting the text back one byte but upon display that line got duplicated Thanks

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

      You need to show the code and explain in more detail what you mean by "upon display that line got duplicated".

      F 1 Reply Last reply
      0
      • L Lost User

        You need to show the code and explain in more detail what you mean by "upon display that line got duplicated".

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

        first off I am trying to write a front end to debugger sort of like visual studio I have a red bullet and the insert object works it places it in the first position of the buffer but the result is it shifts over the text in the rich buffer. The X'3F' seems to represent the red bullet bmp so I wrote code to shift everything over to the left 1 byte however seems like the lines get duplicated meaning this is what in the rich edit before " STM R14,R12,12(R13) " After the insertobject " LR R3,R15 " " ;) STM R14,R12,12(R13) " " LR R3,R15 I cant cut and paste the rich edit display correctly but the insert object puts the bullet bmp where I want it, it just pushes the text to the right one byte thought if I wrote code to shit it over that would straighten it out but all did was display the STM line twice This my code

        myoleptr->InsertObject(&reobject);
        int i;
        RichListing->GetLine(RichListing->LineFromChar(-1), (LPTSTR)&buffer, 132);
        for (i = 1; i < 132; i++)
        buffer[i] = buffer[i + 1];

        buffer before

        0x00000004BEF4C2C0 3f 20 20 20 5f 20 20 20 20 20 20 20 32 33 20 20 20 20 20 20 20 20 30 30 30 30 30 30 20 20 20 20 ? _ 23 000000
        0x00000004BEF4C2E0 20 20 20 20 20 20 20 20 20 53 54 4d 20 20 20 52 31 34 2c 52 31 32 2c 31 32 28 52 31 33 29 20 20 STM R14,R12,12(R13)
        0x00000004BEF4C300 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
        0x00000004BEF4C320 20 20 20 20 20 20 20 20 30 30 30 32 31 30 35 31 0d 00 cc cc cc cc cc cc cc cc cc cc cc cc cc cc 00021051..ÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
        0x00000004BEF4C340 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
        0x00000004BEF4C360 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
        0x00000004BEF4C380 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ

        L 1 Reply Last reply
        0
        • F ForNow

          first off I am trying to write a front end to debugger sort of like visual studio I have a red bullet and the insert object works it places it in the first position of the buffer but the result is it shifts over the text in the rich buffer. The X'3F' seems to represent the red bullet bmp so I wrote code to shift everything over to the left 1 byte however seems like the lines get duplicated meaning this is what in the rich edit before " STM R14,R12,12(R13) " After the insertobject " LR R3,R15 " " ;) STM R14,R12,12(R13) " " LR R3,R15 I cant cut and paste the rich edit display correctly but the insert object puts the bullet bmp where I want it, it just pushes the text to the right one byte thought if I wrote code to shit it over that would straighten it out but all did was display the STM line twice This my code

          myoleptr->InsertObject(&reobject);
          int i;
          RichListing->GetLine(RichListing->LineFromChar(-1), (LPTSTR)&buffer, 132);
          for (i = 1; i < 132; i++)
          buffer[i] = buffer[i + 1];

          buffer before

          0x00000004BEF4C2C0 3f 20 20 20 5f 20 20 20 20 20 20 20 32 33 20 20 20 20 20 20 20 20 30 30 30 30 30 30 20 20 20 20 ? _ 23 000000
          0x00000004BEF4C2E0 20 20 20 20 20 20 20 20 20 53 54 4d 20 20 20 52 31 34 2c 52 31 32 2c 31 32 28 52 31 33 29 20 20 STM R14,R12,12(R13)
          0x00000004BEF4C300 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
          0x00000004BEF4C320 20 20 20 20 20 20 20 20 30 30 30 32 31 30 35 31 0d 00 cc cc cc cc cc cc cc cc cc cc cc cc cc cc 00021051..ÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
          0x00000004BEF4C340 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
          0x00000004BEF4C360 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
          0x00000004BEF4C380 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ

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

          I am not sure that I can see what is wrong with that. Anything inserted into the control will take space and thus move everything else along.

          F 1 Reply Last reply
          0
          • L Lost User

            I am not sure that I can see what is wrong with that. Anything inserted into the control will take space and thus move everything else along.

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

            Richard I think the selection range has to be in line with the number of characters that are in

            LPCTSTR lpszNewText,

            of the null terminated string parameter of ReplaceSel When you InsertObject a bitmap that bitmap depending on its size takes up a certain amount of characters depending among other things the size of font of the current selection and the size of the bitmap. I am not sure if there is a some way to calculate this i.e. if you have a string and you want to know how many pixels it takes you do GetTextExtent. the REOBJECT structure doesn't seem to have parameters for the size of the bitmap like BITBLT I just played around with the string and the selection size and got it to align

            L 1 Reply Last reply
            0
            • F ForNow

              Richard I think the selection range has to be in line with the number of characters that are in

              LPCTSTR lpszNewText,

              of the null terminated string parameter of ReplaceSel When you InsertObject a bitmap that bitmap depending on its size takes up a certain amount of characters depending among other things the size of font of the current selection and the size of the bitmap. I am not sure if there is a some way to calculate this i.e. if you have a string and you want to know how many pixels it takes you do GetTextExtent. the REOBJECT structure doesn't seem to have parameters for the size of the bitmap like BITBLT I just played around with the string and the selection size and got it to align

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

              Most image files and types have the size encoded in them. I don't know how you are loading the bitmap into the reobject variable but presumably you can check the source file/object.

              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