Ketil,
I took your tip from yesterday regarding the EM_REPLACESEL message.
This code works with Rich Edit but not RAEdit.
It sets the cursor OK but inserts no text. This exact same code works on Rich Edit.
; LN:15 ed.inserttext 4,"Test"
mov edi,!ed
mov [!TargetGUIDesc],edi
mov eax,4
mov [_ArgSafe0],eax
mov esi,_StrConst1
mov [_TmpVec1],esi
mov [_TmpVec1+4],5
mov [_TmpVec1+8],0
invoke SendMessage, dword [edi+HandleOffs],EM_SETSEL,[_ArgSafe0],[_ArgSafe0]
mov edi,[!TargetGUIDesc]
call __IncZRank
invoke SendMessage, dword [edi+HandleOffs],EM_REPLACESEL,1,[_TmpVec1]
Hi
I have no idea what your code is supposed to do, the syntax seem veird to me.
Does [_TmpVec1] contain a pointer to a zero terminated ascii string? Unicode is not supported by RAEdit.
KetilO
Hi Ketil,
The reason the code looks wierd to you is because it is the output of my Basic compiler. (not written by human)
Quote
Does [_TmpVec1] contain a pointer to a zero terminated ascii string?
Yes it does. I never use UniCode strings.
Ketil,
Here is a hand commented version.
; LN:15 ed.inserttext 4,"Test"; This is the BASIC line shown as a comment only
mov edi,!ed; Load esi with address of contro'ls internal descriptor
mov [!TargetGUIDesc],edi; save in case edi is disturbed
mov eax,4; set eax to place I want to insert
mov [_ArgSafe0],eax; save for later
mov esi,_StrConst1; get address of literal string I want to insert
mov [_TmpVec1],esi; Set string address in string descriptor
mov [_TmpVec1+4],5; Set string length in string descriptor
mov [_TmpVec1+8],0; do not link to another section (ignore in this case)
invoke SendMessage, dword [edi+HandleOffs],EM_SETSEL,[_ArgSafe0],[_ArgSafe0]; call RAEdit with msg to set insert point
mov edi,[!TargetGUIDesc]; get back address of control's descriptor
call __IncZRank; ignore this (has to do with "last touched" control
invoke SendMessage, dword [edi+HandleOffs],EM_REPLACESEL,1,[_TmpVec1] call RAEdit with msg to insert text
Remember, this works fine on Rich Edit as is and <hopefiully> obeys the rules for these 2 messages.
Thanks,
Mike
Ketil,
I think I have found the problem. After a little more testing, I will know for sure.
It looks like it works if the EM_REPLACESEL is preceeded by a EM_EXSETSEL, NOT EM_SETSEL as I was using.
The Rich Edit control works with either one.
Thanks,
Mike
Ketil,
Here is a new version that works properly. My suspicions in the previous post regarding EM_EXSETSEL were mistaken.
; LN:1955 Edit.inserttext 4,"Havis"
mov edi,!Edit
mov eax,4
invoke SendMessage, dword [edi+HandleOffs],EM_SETSEL,eax,eax
mov esi,_StrConst184
mov [_TmpVec1],esi
mov [_TmpVec1+4],6
mov [_TmpVec1+8],0
invoke SendMessage, dword [edi+HandleOffs],EM_REPLACESEL,1,[_TmpVec1]
call __IncZRank
This implies to me that someting was whacking some of my variables.
Thanks,
Mike