Setting Text Color of Date Time Picker

Has anyone tried setting the text color of a date-time picker? For edit controls, a WM_CTLCOLOREDIT message is sent from the edit control in order to determine the color. (Static controls send a similar message.) But I can't find a message that a date-time picker uses to ask for the text color in its edit box. (I'm not looking for any of the colors on the child drop-down window that shows the calendar: those are all well-documented.) I have also tried getting the device context and using SetTextColor when I build the rest of the date-time picker, but that doesn't seem to work either. I'm out of ideas at the moment.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cal = CreateWindow(
        		DATETIMEPICK_CLASS,
        		NULL,
        		WS_BORDER|WS_CHILD|WS_VISIBLE,
        		95,75,120,25,
        		hwnd,
        		NULL,instance,NULL);
        SendMessage(cal,WM_SETFONT,(WPARAM)tfont,(LPARAM)0);
//The above works fine.
        HDC calhdc = GetDC(cal);
        SetTextColor(calhdc,RGB(102,161,107));
//This part doesn't do anything.
        SendMessage(cal,DTM_SETMCFONT,(WPARAM)tfont,(LPARAM)0);
        SendMessage(cal,DTM_SETMCCOLOR,(WPARAM)MCSC_TITLEBK,(LPARAM)RGB(102,161,107));
        SendMessage(cal,DTM_SETMCCOLOR,(WPARAM)MCSC_MONTHBK,(LPARAM)RGB(214,171,77));
        SendMessage(cal,DTM_SETMCCOLOR,(WPARAM)MCSC_TEXT,(LPARAM)RGB(255,255,255));
        SendMessage(cal,DTM_SETMCCOLOR,(WPARAM)MCSC_TITLETEXT,(LPARAM)RGB(255,255,255));
//All these messages change the colors for the calendar itself.  


I can provide the full code if need be.
This is the full list of messages of the date time picker according to MSDN Online: http://msdn.microsoft.com/en-us/library/cc656442%28VS.85%29.aspx.

If not there, I would imagine that there is none for what you want. But I would also imagine that a date time picker has an EDIT control embedded. If this is the case, WM_CTLCOLOREDIT should apply. The thing that you must note here, is that WM_CTLCOLOREDIT will not be sent to the containing form; it will most likely be sent to the window procedure of the main window of the date time picker. If you subclass the date time picker, you can probably catch WM_CTLCOLOREDIT.
Topic archived. No new replies allowed.