News:

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

Character Attributes

Started by raleeper, April 25, 2007, 09:48:50 AM

Previous topic - Next topic

Tedd

Quote from: raleeper on May 04, 2007, 11:04:52 AM
I'm working thru richy [actually rich2] now.  [I have a day job & can only spend an hour - maybe steal another - on this.
That's okay, we all do - just work at your own pace, when you have the chance/motivation :wink

Quote
The assembler didn't recognize HMODULE - tho it's in the SDK docs - but hey, handles are just dwords, and the program assembles & works fine w/ that change.

I don't really know enough at this point to have an opinion, but it seems to me that instead of

    hRichDLL   HMODULE   ?

it would be better from several points of view to use:

    hRichDLL   DD   ?   ;handle to module - ret'd by !LoadLibrary
True, it is just a dword in reality, but the reason for using 'types' in asm at all is more for self documentation - it can make the code easier to understand. The value returned by LoadLibrary has more meaning than simply being 'just' a dword, it is a handle, so it's good to make note of that. You could equally define it as HINSTANCE - they're really the same (and both are really 'just' dwords) - though the definition for HMODULE should be in windows.inc, along with the one for HINSTANCE. Anyway, like I said, it doesn't make too much difference, it's just for making the code easier to understand.

Quote
And of course, to save a few bytes, your 'save as type: asm' routine (optionally) skips "tab,;" and anything after on/in that (line).
..what routine??


On snowflakes, etc: yep :wink
No snowflake in an avalanche feels responsible.

raleeper

Quote from: Tedd on May 03, 2007, 12:11:53 PM
And once you've got the hang of that..

Here's the proper reference for Rich-Edit Controls :bg
http://msdn2.microsoft.com/en-us/library/ms651298.aspx


I'm working thru richy again, and I can't seem to find any documentation for RichAppend, even at msdn2.com [or of course, the SDK or Google].

Is there some other source or have I just missed it?

Thanks

Tedd

RichAppend is my function (found at the end of the code) - it just appends the text you give it, setting the text colour.

..looks a bit like this :lol
RichAppend proc pBuff:DWORD,col:DWORD
    LOCAL charrng:CHARRANGE
    LOCAL charfmt:CHARFORMAT
    mov eax,-1
    mov charrng.cpMax,eax
    mov charrng.cpMin,eax
    mov charfmt.cbSize,SIZEOF CHARFORMAT
    mov charfmt.dwMask,CFM_COLOR
    mov eax,col
    mov charfmt.crTextColor,eax
    invoke SendMessage, hRWnd,EM_EXSETSEL,NULL,ADDR charrng
    invoke SendMessage, hRWnd,EM_SETCHARFORMAT,SCF_SELECTION,ADDR charfmt
    invoke SendMessage, hRWnd,EM_REPLACESEL,FALSE,pBuff
    invoke SendMessage, hRWnd,EM_SCROLLCARET,NULL,NULL      ;scroll the text into view
    ret
RichAppend endp


What you will want to do is look-up what each of the messages sent to the rich-edit control does - at the link provided previously :wink
e.g. RichEdit Controls -> RichEdit Controls Reference -> Messages -> EM_SETCHARFORMAT
No snowflake in an avalanche feels responsible.

raleeper

Quote from: Tedd on May 31, 2007, 11:30:35 AM
RichAppend is my function (found at the end of the code) - it just appends the text you give it, setting the text colour.



Doh!  Right in front of me.

Thanks.