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,
The error on EM_SETIMECOLOR is 0x5 ACCESS DENIED. Thanks
Try PostMessage, sometimes it works.
The problem may be that the IME messages are only supported on Windows version for languages that require IME.
Thanks guys.... a lot.
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
hi....i recentlly found out that there is a CHARFORMAT2 Structure. Still not working butit seems that way to go. Thanks
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.
Post code...
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
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!
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.
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.
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)
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:
By default I use Richedit20 :biggrin:. No charformat2.
<> ;------ATCHOUM---------
must be the covid !
To use properly the common contols structures, you need to know:
* The version of the windows system
* The version of richedit.
* ++++++++++++++
Sorry for the long reply. Your answers helped. I git over it. I have an issue tho. I have a button witha string and awnted to change the for to the general font used but the app. I send WM_SETFONT,hFont,TRUE but nothing happens. Any idea why. should i use BS_OWNERDRAW?
QuoteYou should never use the + sign to compose flags!
Why this JJ? Isn't it the same as OR?
Quote from: xandaz on March 07, 2021, 07:24:57 AM
QuoteYou should never use the + sign to compose flags!
Why this JJ? Isn't it the same as OR?
Test it:
mov eax, WS_OVERLAPPEDWINDOW+WS_THICKFRAME
mov ebx, WS_OVERLAPPEDWINDOW or WS_THICKFRAME
+ isn't the same as or.
11 + 1 = 100b
11 or 1 = 11b
Most of the time,windows constants are defined as follow:
OneConst equ 1 SHL 0 ;1b
TwoConst equ 1 SHL 1 ;10b and so on so you can define 32 or 64 constants it's enough most of the time
This made that you can use the signe + or OR with no different results.
OneConst + TwoConst = OneConst OR TwoConst
It's the case for the WS_OVERLAPPEDWINDOW+WS_THICKFRAME
Quote
Local phrase[100h]:BYTE
invoke sprintf,addr phrase,TXT("WS_OVERLAPPEDWINDOW+WS_THICKFRAME %x,WS_OVERLAPPEDWINDOW or WS_THICKFRAME %x"),\
WS_OVERLAPPEDWINDOW+WS_THICKFRAME,WS_OVERLAPPEDWINDOW or WS_THICKFRAME
invoke MessageBox,NULL,addr phrase,TXT("titre"),MB_OK
Result is the same CF0000h
xandaz,
Always use OR to combine styles, + works in some contexts but not all.
Thanks a lot guys. It's been helpful. Ty cu soon.