We have a RichEdit control into which we allow the user to insert an Office MathML equation object.
Basically the logic goes like this: the user click on insert math equation, we allow them to use an external MathML editor, then we will paste an image to represent the equation into the RichEdit control:
' Paste the picture into the RichTextBox.
SendMessage ctlLastFocus.hwnd, WM_PASTE, 0, 0
Find its position and lock it down using:
With ctlLastFocus
'lock the image
.SelStart = .SelStart - 1
.SelLength = 1
.SelProtected = True
It's all nice and good in the beautiful world of ANSI, but we also allow Unicode characters, and what I've noticed is that when you use Chinese characters, the position of the insertion is wrong by half the total position, i.e if it's supposed to be the 7th position now it's inserted at the third.
Basically divided by two, I guess because Unicode takes two bytes as compared to ANSI which requires just one. So because I'm a dummy with no experience with the RTF, RichEdit and Visual Basic 6.
So my question is: can I change the position of the image when I paste it using the sendMessage line?
Or via some other way to control the position of the image inserted into the RichEdit box?