IRichEditOle::InsertObject shifts text one byte
-
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
-
You need to show the code and explain in more detail what you mean by "upon display that line got duplicated".
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 ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ -
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 ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ -
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.
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
-
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