The information in this article applies to:
SUMMARY
This article shows you how to change the background color of an OLE control
that subclasses a Windows Control, with sample code for an Edit control. MORE INFORMATIONPlease refer to the following article in the Microsoft Knowledge Base: Q130952 WM_CTLCOLORxxx Message Changes for Windows 95for more about the exact WM_CTLCOLORxxx message sent by each control. If a control sends the WM_CTLCOLORSTATIC, you have to handle the OCM_CTLCOLORSTATIC message in the OCX and so on. To change the background color of an OLE Control that subclasses an Edit Control, you must handle the OCM_CTLCOLOREDIT(32-bit) messages. These messages are intercepted by the "reflector window" (created for an OLE control that subclasses a Windows control) that reflects them back to the OLE control itself. In response to these reflected messages, you must set the background color (and optionally the foreground color) and return a handle to a brush initialized with the background color. Step-by-Step ExampleThe sample code in this example illustrates how to handle OCM_CTLCOLOREDIT in order to change the background color of an OLE control that subclasses an Edit control
REFERENCESRefer to technical article [ASCII 147]TN062: Message Reflection for Windows Controls[ASCII 148] and the article [ASCII 147]ActiveX Controls: Sub-classing a Windows Control in Visual C++ Programmer's Guide.[ASCII 148] Additional query words: list box combo
Keywords : kbcode kbole kbMFC kbVC400 kbVC410 kbVC500 kbVC600 |
Last Reviewed: August 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |