How to Access a Subclassed Windows Control in an OLE ControlLast reviewed: July 10, 1997Article ID: Q135048 |
1.50 1.51 1.52 | 2.00 2.10 2.20
WINDOWS | WINDOWS NTkbprg kbcode The information in this article applies to:
SUMMARYThe ControlWizard provided with the CDK allows a new OLE control to be created by subclassing a common Windows control such as a button, toolbar, or edit box. The XLIST sample provided with the CDK illustrates how to do this by subclassing a Windows list box. The XLIST sample communicates with and manipulates the subclassed Windows control by using the Windows SendMessage() API. For example, to insert a string into the subclassed list box, use this code:
SendMessage(LB_INSERTSTRING, nIndex, (long)lpstrText);Because MFC provides wrapper classes for the common Windows controls, it would be useful to be able to use these classes to communicate with the subclassed control. This article illustrates one technique for doing this by showing how to connect the appropriate MFC control class to the COleControl-derived class that subclasses a Windows control.
MORE INFORMATIONThe following sample code illustrates how to use the MFC CListBox class to communicate with a Windows list box control subclassed by an OLE control. The process for doing this is as follows:
m_ListBox.InsertString(nIndex, _T("A String")); |
Additional reference words: kbinf 1.50 1.51 1.52 2.00 2.10 2.20 2.51
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |