News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Selecting Text [Still need help]

Started by chemicalNova, May 26, 2005, 12:08:36 PM

Previous topic - Next topic

ToutEnMasm

Hello,
try EM_GETTEXTRANGE instead of getwindowstext.
If it'snt enough, a symbolic debugger as winhelp can help you.
                     ToutEnMasm

Mark Jones

Quote from: hutch-- on June 11, 2005, 08:13:58 AM
I would find a solution to the "missing keyboard" problem, put locktite in her hair gel or fine chopped fibreglass in her washing basket.

"Hutch can be such a meanie! Why last week, he switched my regular toothpaste with Preperation-H! As you can see, all my teeth fell out!"
(Just kidding!)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

chemicalNova

Thanks for the help toutenmasm.

For the life of me I can't get it. No matter what I try, it doesn't select what I want. I've used TEXTRANGE, CHARRANGE, everything. I can select text fine, but I must specify the range (sendmessage,hrich,em_setsel,0,20 - etc..). Anyone got an example of searching and highlighting that isn't the syntax highlighting tutorial on Iczelion's MASM webpage. I don't want to do his way, as it is too much for what I need. All I want is the word that was just typed. Here's what I ended up with, but I think it's further away from what I wanted  :'(

ReColorText proc uses edi esi hWinH:HWND,hRich:HWND
;this will recolor the text
LOCAL tl:DWORD
LOCAL lpstring:DWORD
LOCAL lpstring2:DWORD
LOCAL rect:RECT
LOCAL theChar:TEXTRANGE


;invoke LockWindowUpdate,hRich
invoke SendMessage,hRich,WM_GETTEXTLENGTH,0,0
mov tl,eax
inc tl ;add 1 more because of option base 0
mov theChar.chrg.cpMin,0
mov theChar.chrg.cpMax,-1
push lpstring
pop theChar.lpstrText
invoke SendMessage,hRich,EM_GETTEXTRANGE,0,ADDR theChar
;invoke SendMessage,hRich,EM_POSFROMCHAR,ADDR rect,edi
mov esi,lpstring
add esi,2
@@:
cmp BYTE PTR [esi],32
jle nxt
sub esi,1 ;go backwards..
jmp @B

nxt:
mov edi, esi ;store this position in edi
add esi, 1

@@:
cmp BYTE PTR [esi],32
jle finish
add esi,1 ;go forwards
jmp @B

finish:

;invoke SendMessage,hRich,EM_SETSEL,0,2

;invoke LockWindowUpdate,0
ret
ReColorText endp

Anyone able to give links to source with something similar or possibly write a small algo for me? So sorry. I'll learn from a working example..

Ta in advance,

chem

chemicalNova

Anyone? I've tried absolutely everything now. Don't think I can continue it..  :'(

chem