How to change hardwired selection text color in (rich-)edit

Process Hacker development discussion
User avatar
keremg
Plugin Developer
Posts: 136
Location: Germany

How to change hardwired selection text color in (rich-)edit

Unread postby keremg » Sat Dec 10, 2011 1:19 am

Hi,

does anyone know (if possible at all!) how to change the systemwide hardwired text selection color for a edit(text) control and/or richedit control? The color (if not changed on systemwide settings) is mostly a dark blue variant you see when selecting some text inside the controls. A problem arises if one has a control with exactly that background color. There is a GetSysColor() with COLOR_HIGHLIGHTTEXT, the same can be set, but only systemwide. It would be amazing if there would be some way to do this on a control level basis.

K.

User avatar
dmex
Admin
Posts: 702
Location: Australia

Re: How to change hardwired selection text color in (rich-)e

Unread postby dmex » Mon Dec 12, 2011 6:46 am

keremg wrote:It would be amazing if there would be some way to do this on a control level basis.


You have to hook the indivudual application to change some RTF colours (like msgplus does with Messenger), although Windows does allow you to set the text selection colour across the entire system ;)

dmex

User avatar
keremg
Plugin Developer
Posts: 136
Location: Germany

Re: How to change hardwired selection text color in (rich-)e

Unread postby keremg » Mon Dec 12, 2011 10:27 am

dmex wrote:
keremg wrote:It would be amazing if there would be some way to do this on a control level basis.


You have to hook the indivudual application to change some RTF colours (like msgplus does with Messenger), although Windows does allow you to set the text selection colour across the entire system ;)

dmex

Hi,

what exactly has to be hooked (API?) and how(API/Window?) on the application?

k

User avatar
dmex
Admin
Posts: 702
Location: Australia

Re: How to change hardwired selection text color in (rich-)e

Unread postby dmex » Mon Dec 12, 2011 10:52 am

keremg wrote:what exactly has to be hooked (API?) and how(API/Window?) on the application?


I'm not too sure, I know the window procedure of the control or application.

Google is your friend ;)

User avatar
keremg
Plugin Developer
Posts: 136
Location: Germany

Re: How to change hardwired selection text color in (rich-)e

Unread postby keremg » Mon Dec 12, 2011 11:58 am

dmex wrote:
keremg wrote:what exactly has to be hooked (API?) and how(API/Window?) on the application?


I'm not too sure, I know the window procedure of the control or application.

Google is your friend ;)


I already did a lot of googling on the topic before asking here and could not find any useful information. :(

window procedure of the control or application


Only a "window" has a window procedure and not the application itself.

I am pretty sure that this is some RRGGBB structure or DWORD the rtf control is reading from somwhere, eiter system registry/file or out of some memory somewhere in the running OS. Either this is a API Hooking thing or i have to manipulate some place in my processes memory the rtf gets that info from. But i dont know where to start,...

Or this is nearly impossible to do without huge effort,...the "accentuation" is on the two words "huge effort",...

User avatar
dmex
Admin
Posts: 702
Location: Australia

Re: How to change hardwired selection text color in (rich-)e

Unread postby dmex » Mon Dec 12, 2011 11:56 pm

The following page might be of some use: http://www.codeguru.com/forum/showthread.php?t=355712

Find a way to get yourself in to the process before the richedit controls are created. Hook the GetProcAddress function and look for requests to the APIs in riched20.dll and msftedit.dll, then using the above technique just look for specific messages in the window procedure and change to your values.

You might also be able to change the System Selection colour (which richedit also uses): http://social.technet.microsoft.com/For ... 41d7170a3b


Return to “Source code”

Who is online

Users browsing this forum: No registered users and 6 guests