How to set text color to Edit Contol in ATL Control? - atl

I have a ATL ActiveX Control with Edit Control. I want to set text color to the control of as per specific conditions.
I cannot use setTextColor as there is no MFC support to the the control.
I am also not able to use 'WM_CTLCOLOREDIT' message as I don't have access to CDC and CWnd.
I had similar issue setting text input limit but I accomplished it using SendMessage(EM_LIMITTEXT, (WPARAM)1000, (LPARAM)0); but could not find any message for setting text color.
Is there any other way to achieve this ?

Related

How to detect rich edit content in C++

How could I detect whether an edit control support rich content in windows with C++ code, for example, I could copy/paste an image into it.
Additionally, If I get the HWND of the foreground window, how could I get the edit control, but not the frame window?

How can one set the background color of a property sheet

How can I change the background color of a property sheet? I can change the color of the actual pages by handling the WM_CTLCOLOR... messages but the tabs and other parts of the property sheet seem to be beyond my reach.
Might there be something in the callback?
Here's what it looks like when I handle the WM_CTLCOLOR msgs in the page dialogs.
Tab controls are notoriously difficult to work with. You will likely have to implement an owner-drawn tab control to get the level of customization that you want.

Bitmap background in Edit Control

I'd like to use a bitmap as a background in a standard edit control. Handling WM_CTLCOLOREDIT only allows to set background color via SetBkColor.
Subclassing Edit control and handling WM_ERASEBKGND doesn't work because the background is drawn (probably) in WM_PAINT method.
Is there any way to use custom bitmap as a background without resorting to creating my own control?

Set background color of rich edit control 2.0 when it is created

In my app, pressing a button activates a dialog box. This dialog box contains a rich edit control 2.0. I want to set the background color of this rich edit control 2.0 to red on its creation,i.e, the default background color of this rich edit control should be red (instead of white, which is the actual default). I'm thinking of using SetBackgroundColor() function to set the color, but I want to know where to place the code so that it is executed when the rich edit control 2.0 is created.
Thanks
Can't do it when it is created. You have to do it after it is created. If the control is in a dialog box, generally, you will do it this way:
1) Override DoDataExchange() in your dialog box class and put an entry for DDX_Control(pDX, IDC_RICHEDI1, m_richedit) -- substitute proper id's and variable names
2) Override OnInitDialog() in your dialog box. Using m_richedit (or whatever you name it), set the background color with SetBackgroundColor. It may not do what you want and may have to look into SetDefaultCharFormat, SetParaFormat, or SetSelectionCharFormat.

Placing a image inside an CEdit control in Win32

I'm trying to achieve an effect where there's a visible logo inside an edit control and the logo becomes hidden when the user places the focus on the edit control.
What's the best way to approach this? Would it be better to place an image control on top of the edit control or paint the background of the edit control transparent and position the image control behind the edit control? Or possibly some other method?
The EDIT control has very broken paint behavior, you'll never get there by overriding the WM_PAINT message handler or using transparency. Yes, overlay it with a STATIC control that you hide when you see text being entered.