News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Having trouble with EM_GETIMECOLOR!!!

Started by xandaz, February 28, 2021, 10:40:07 PM

Previous topic - Next topic

xandaz

    I'm building this multidocument interface editor and i'm having trouble with EM_GETIMECOLOR. When i load the Project EM_SETIMECOLOR does nothing only EM_SETCHARFORMAT is working. Does anyone have any idea of why this is happening?    mov [edi.COMPCOLOR.dwEffects],CFE_BOLD+CFE_ITALIC
    invoke SendMessage,[eax.MdiStruct.hEdit],EM_GETIMECOLOR,0,edi
    invoke SendMessage,[eax.MdiStruct.hEdit],EM_SETIMECOLOR,0,edi
    add edi,

xandaz

   The error on EM_SETIMECOLOR is 0x5 ACCESS DENIED. Thanks

jj2007


hutch--

The problem may be that the IME messages are only supported on Windows version for languages that require IME.

xandaz


xandaz

   So, the problem is how to get the current background color for the edit control. Since the isnt any EM_GETBKGNDCOLOR message i would like to know how you would deal with this since IME isn't avaiable. Thanks

xandaz

    hi....i recentlly found out that there is a CHARFORMAT2 Structure. Still not working butit seems that way to go. Thanks

xandaz

   Can't get the CHARFORMAT2 struct to work together with EM_SETCHARFORMAT. It's suppose to identify the type of struct through the cbSize member but it doesn't work. I'm disapointed.

jj2007


xandaz

code:    invoke RtlZeroMemory,edi,sizeof CHARFORMAT2W
    mov [edi.CHARFORMAT2.cbSize],sizeof CHARFORMAT2W
    mov [edi.CHARFORMAT2.dwMask],CFM_FACE+CFM_COLOR+CFM_BACKCOLOR+CFM_BOLD+CFM_ITALIC
    mov [edi.CHARFORMAT2.dwEffects],CFE_BOLD+CFE_ITALIC
    mov eax,LongVal
    invoke SendMessage,[eax.MdiStruct.hEdit],EM_GETCHARFORMAT,SCF_ALL,edi
    add edi,sizeof CHARFORMAT2
    mov [edi.CHARFORMAT2.cbSize],sizeof CHARFORMAT2W
    mov [edi.CHARFORMAT2.dwMask],CFM_FACE+CFM_COLOR+CFM_BACKCOLOR+CFM_BOLD+CFM_ITALIC
    mov eax,LongVal
    invoke SendMessage,[eax.MdiStruct.hEdit],EM_SETCHARFORMAT,SCF_ALL,edi
    add edi,sizeof CHARFORMAT2

jj2007

The definition in the .data? section?
[eax.MdiStruct.hEdit] is a valid handle, for a RichEdit control?
GetLastError value?

CFM_FACE+CFM_COLOR+CFM_BACKCOLOR+CFM_BOLD+CFM_ITALIC

You should never use the + sign to compose flags!

xandaz

    Error value = 0 SUCCESS. The edi reigster points to the memory space of a project file where the CHARFORMAT struct is inserted. Doesnt return the Face name of the font.

jj2007

Quote from: xandaz on March 01, 2021, 08:56:20 AMmemory space of a project file where the CHARFORMAT struct is inserted

I don't insist that you post the complete code, but my crystal ball is broken tonight, so could you please show us at least the few lines in the .data? section? Thanks.

Btw there are 52 matches for CHARFORMAT in the source code of RichMasm. They all work just fine.

HSE

Richedit have several versions. CHARFORMAT2 it's not available in older versions. I don't remember if you need superior to 3.0. There is no warning. You can store charformat2, but Richedit only read charformat, that is first part of structure.(background color is in last part)
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on March 01, 2021, 11:23:02 AMCHARFORMAT2 it's not available in older versions.

That's true but it's difficult to find a sufficiently old version on a post-XP PC... I see that your crystal ball is not working, either  :tongue: