MFC for Windows CE Programmer's Guide

The Microsoft Foundation Class (MFC) library for Windows CE is both a mature, comprehensive Windows CE class library and a complete object-oriented application framework designed to help you build robust, professional applications, components, and controls for Windows CE platforms. You can use MFC for Windows CE to create anything from a simple dialog box-based program to a powerful, sophisticated application that employs the MFC document/view architecture. You can also use MFC for Windows CE to create full-featured ActiveX controls and ActiveX containers.

To learn about class libraries and application frameworks, and how MFC for Windows CE makes application development easier, see Using MFC for Windows CE as a Class Library and Using MFC for Windows CE as an Application Framework.

To learn how the MFC for Windows CE AppWizards and ClassWizard can simplify application development, see Using the MFC for Windows CE Wizards to Simplify Application Development.

To learn how to link your application with the MFC libraries, see Linking your Application to the MFC for Windows CE Libraries.

For information on differences between MFC for Windows CE and MFC for desktop Windows platforms, see How is MFC for Windows CE Different from MFC for Desktop Platforms?

For an overview of supported MFC classes, by category, see Classes Derived from CObject and Classes Not Derived from CObject, and the Top Level Hierarchy Chart.

For a list of the new classes that are unique to Windows CE, see New MFC Classes for Windows CE.

For an alphabetical list of the classes that have been modified for use under Windows CE, see Modified MFC Classes.

For an alphabetical list of all the classes that MFC for Windows CE supports exactly the same way the standard MFC library supports them, see Fully Supported MFC Classes.

For a list of MFC classes that Windows CE does not support, see Unsupported MFC Classes.

For a list of MFC global functions and messages that are specific to Windows CE, see Windows CE-Specific MFC API Functions & Messages.

For a list of supported and unsupported MFC global functions, see MFC Global Functions.

For a list of supported and unsupported structures used in MFC, see Structures Used in MFC.


Using MFC for Windows CE as a Class Library

A class library in C++ is analogous to a function library in C. A C library provides a collection of precompiled functions packaged in a static library (.lib file). You can link the library with your program and call the library functions directly from within your application. You can use a class library the same way you use a C library, but you also get the added benefits that come with using classes, like encapsulation, inheritance, and polymorphism. Not only can you use the library classes directly in your program, you can also subclass them to derive classes that are specifically suited to your application domain.

The Microsoft Foundation Class library encapsulates much of the Windows CE application programming interface (API). By organizing related API functions into logical, well-defined classes, MFC for Windows CE makes it easier for C++ developers to take an object-oriented approach to Windows CE programming.

There are many programming elements that are common to nearly every Windows CE application, so it makes sense to encapsulate the behavior and properties of those elements into reusable classes. Each independent software vendor could write their own Windows CE class library from scratch, but it would take a lot of time, and many iterations of the development cycle, to develop solid, reliable, reusable classes that integrate properly with one another. By providing a standard Windows CE class library, Microsoft not only saves you a significant investment in time and resources, it also ensures that your applications conform to certain behavioral standards that users have come to expect from all Windows applications.


Using MFC for Windows CE as an Application Framework

As useful as MFC is as a basic Windows class library, there's a lot more to it than that. MFC is also a complete application framework. An application framework provides both a structural foundation, upon which many types of applications can be built, and a set of fundamental components that you can use to expand on the structure and adapt it to different purposes. MFC for Windows CE is a framework specifically designed for creating Windows CE applications.

One example of this is the MFC message mapping architecture. Windows CE is a message-driven operating system. This means the operating system communicates with an application window by placing messages in the message queue of the thread that created the window. The thread has a message pump, which removes the messages from the queue and dispatches them to the appropriate window procedure. In traditional, non-MFC applications, the window procedure is a large C++ switch statement whose purpose is to determine what kind of message it has received, then process the message accordingly.

The MFC framework manages messages a little bit more elegantly. CCommandTarget is the base class for MFC's message mapping architecture. The framework provides a message pump for every class derived from CCommandTarget. These classes use message maps, rather than switch statements, to route messages to their message handler functions. A message map is implemented by a set of simple macros defined in the MFC library. Although you can maintain your classes' message maps and handler functions yourself, the WCE MFC ClassWizard automates this process.

You generally won't derive classes from CCommandTarget directly. There are several classes derived from CCommandTarget, however, from which you will frequently derive classes of your own. One of the most important classes derived from CCommandTarget is the CWnd class. CWnd encapsulates all the behavior of Windows CE windows and all the functionality related to window management. This class and its subclasses are fundamental to almost every Windows CE application.

Another notable class derived from CCommandTarget is CWinApp. Every MFC application must have exactly one instance of a class derived from CWinApp. This object, called the application object, is always declared with global scope. This ensures that the application object is constructed before Windows CE calls WinMain, which is the Windows version of the C/C++ main function. WinMain calls the application object's member functions to initialize, run, and terminate the application. The MFC framework provides the implementation of the WinMain function.

If you're writing an application that has a standard user interface, you will reap enormous benefits from taking advantage of the MFC document/view architecture. This architecture is based on three important classes, CDocument, CView, and CFrameWnd. Document classes, which you derive from CDocument, encapsulate an application's data and are responsible for saving the data and retrieving it from storage. View classes, which you derive from CView or one of it's subclasses, provide the functionality necessary to present the data to the user and to receive user input. A single document may have several views associated with it, so you can present the same data in a variety of formats within the same application. When a user edits a view, the view object notifies the document object. The document object, in its turn, updates all the views associated with it whenever the data changes. The frame window, which you derive from CFrameWnd, provides the frame that contains the views and the command bar.


Using the MFC for Windows CE Wizards to Simplify Application Development

The Microsoft Windows CE Toolkit for Visual C++ 5.0 provides three wizards for the Microsoft Foundation Class library for Windows CE. These are the WCE MFC AppWizard, the WCE MFC ActiveX ControlWizard, and the MFC for Windows CE ClassWizard.

These wizards are not actually part of the Microsoft Foundation Class library. You can create an MFC application or control without using wizards. Wizards are convenient, however. They can save you a lot of time and eliminate some programming errors caused by entering code manually. Whether you use the standard Windows CE APIs or the Microsoft Foundation Class library for Windows CE, there's a lot of code that's common to every Windows CE application. The first thing many developers do when starting a new project is cut and paste this generic code from an existing project into the new one.

When you use the WCE MFC AppWizard or the WCE MFC ActiveX ControlWizard to create a new project, the wizard adds this boilerplate code to the new project for you. The wizard also presents a series of options regarding the type of project you want to create. One option is whether to use MFC as a shared DLL or a statically linked library. Other options include providing support for ActiveX controls, Windows CE sockets, or Windows CE databases. The wizard uses your responses to specify the appropriate compiler and linker settings and to include the appropriate header files for the type of project you're creating.

As you write your code, you can use the MFC for Windows CE ClassWizard to insert message maps for your application's windows, and properties, methods and events for your ActiveX controls. Of course, you can also do these things manually, but using the wizards saves you time and typing.


Linking Your Application to the MFC for Windows CE Libraries

You can use the MFC library for Windows CE either as a statically linked library or as a DLL. When you use MFC as a statically linked library, the MFC code is included in your executable the same way C functions are linked in when you use a standard C library. When you use MFC as a DLL, the MFC library is loaded at run-time, and the same DLL can be shared by multiple applications.

Using MFC as a shared DLL generates smaller applications. When developing for desktop Windows platfroms, if you you use MFC as a DLL, you have to include the MFC DLL when you ship your application. Many Windows CE devices, however, include the MFC DLLs in ROM.

In the Microsoft Foundation Class library for desktop platforms, the core classes and the OLE support classes are combined in the same dynamic link library (DLL). In MFC for Windows CE, the OLE support classes are contained in a separate DLL, called Olece20.dll. This helps conserve memory resources. If you're not using the OLE/ActiveX classes, they don't have to be loaded into memory. This also gives Windows CE device manufacturers more flexibility, becaue they can choose to support MFC for Windows CE, either with or without the OLE/ActiveX classes.

MFC for Windows CE supports the following four kinds of DLLs.

  • User DLLs that link statically with the MFC core.
  • User DLLs that share the MFC core.
  • Extension DLLs, which share the MFC core, and can only be called from other MFC modules.
  • ActiveX controls. ActiveX controls must link dynamically with both Mfcce20.dll and Olece20.dll.

To use the Windows CE MFC library as a shared DLL, your application must be linked with the following libraries.

Mfcce20.lib | Export library for linking against Mfcce20.dll
Mfcs42.lib | Static "helper" library for Mfcce20.dll
Olece20.lib | Export library for linking against Olece20.dll

When you use the Windows CE MFC library as a shared DLL, define _AFXDLL in your preprocessor definitions. This will cause your project to be linked with the Mfcce20.lib export library and the Mfcs42.lib static helper library. If your project supports ActiveX, it will also be linked with the Olece20.lib export library.

When you use the Windows CE MFC library as a statically linked library,do not define _AFXDLL. If _AFXDLL is not defined, your project will be linked with the static MFC library, uafxwce.lib.

If your project is an ActiveX control, you must include afxctl.h in your stdafx file. (The stdafx.h file is used to build precompiled headers, and is generated by the ClassWizard.) If your project is an ActiveX container, you must include afxdisp.h in your stdafx.h file, and call the AfxEnableControlContainer initialization function in the InitInstance method of your CWinApp derived class.

When you use the WCE MFC AppWizard to create an application or DLL, the AppWizard automatically specifies the compile and link settings that the linker uses to link your application to the appropriate MFC libraries. The AppWizard also includes the appropriate ActiveX header files in your project, if required.


Top Level Hierarchy Chart

For lists of classes in each category, see Classes Derived from CObject and Classes Not Derived from CObject.


Classes Derived from CObject

Most of the classes in the Microsoft Foundation Class library are derived from the root class, CObject. These classes can be divided into the following categories.

CObject

Application Architecture Classes

Exception Classes

File Service Classes

Graphical Drawing Classes

Control Support Classes

Graphical Drawing Object Classes

Menu Classes

Windows CE Database Classes

Synchronization Classes

Windows Sockets Classes

Array Classes

List Classes

Map Classes

Window Class Categories

Frame Windows and Splitter Windows

Property Sheets

Dialog Box Classes

View Classes

Control Classes

For an overview of the whole Windows CE class hierarchy, see Top Level Hierarchy Chart.


Application Architecture Classes

All the application architecture classes in the Microsoft Foundation Class library are derived from the CCmdTarget class.

MFC for Windows CE doesn't support OLE documents, message filters, or drag and drop, so it doesn't support all of the application architecture classes. There are also certain member functions, in the classes that MFC for Windows CE does support, that aren't applicable to the Windows CE platform.

The CWinThread, CWinApp, CDocTemplate, COleObjectFactory, and CDocument classes somewhat different in Windows CE than they are in the standard MFC library.

See the following topics for information about the MFC for Windows CE application architecture classes.

CCmdTarget

CWinThread

CWinApp

COleControlModule

CDocTemplate

CSingleDocTemplate

CConnectionPoint

CDocument

COleObjectFactory

To see where the application architecture classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Window Class Categories

All window classes in the MFC library are derived from the CWnd class. See the following topics for information about window classes.

CWnd

Frame Windows and Splitter Windows

Property Sheets

Dialog Box Classes

View Classes

Control Classes

To see where the window classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Control Classes

MFC for Windows CE supports most of the control classes. There are a few differences in the way MFC for Windows CE supports the CButton, CComboBox, CListBox, COleControl, CSpinButtonCtrl, CStatic, and CTabCtrl classes from the way they're supported in the standard MFC library but, for the most part, these differences are minor.

MFC for Windows CE doesn't support the CAnimateCtrl, CHotKeyCtrl, CChecklistBox, CDragListBox, CRichEditCtrl, CStatusBarCtrl, CToolbarCtr, and CToolTipCtrl classes because the Windows CE 2.0 operating system doesn't support these controls.

CButton

CBitmapButton

CComboBox

CEdit

CHeaderCtrl

CListBox

CListCtrl

COleControl

CProgressCtrl

CScrollBar

CSliderCtrl

CSpinButtonCtrl

CStatic

CTabCtrl

CTreeCtrl

To see where the control classes fit into the Windows CE class hierarchy, see Window Class Categories and Classes Derived from CObject.


Dialog Box Classes

Windows CE supports dialog boxes a little bit differently from the way they're supported on desktop Windows platforms.

One difference is that all dialog boxes in Windows CE are stationary. You can position them on the screen any way you like, but the user can't move them. Another difference is that Windows CE doesn't support wizards.

MFC for Windows CE doesn't support the Font dialog box, the Color dialog box, or the Print dialog box classes, although you can use functions to create the Color and Print dialog boxs. MFC for Windows CE also doesn't currently support any of the OLE dialog box classes.

See the following topics for information about the MFC for Windows CE dialog box classes.

CDialog

CCommonDialog

CFileDialog

CFindReplaceDialog

COlePropertyPage

CPropertyPage

To see where the dialog box classes fit into the Windows CE class hierarchy, see Window Class Categories and Classes Derived from CObject.


Frame Windows and Splitter Windows

The only frame window class MFC for Windows CE supports is CFrameWnd. Windows CE doesn't support multiple document interface (MDI).

MFC for Windows CE supports nine new member functions you can use to create and manipulate command bars. A command bar is a new common control, unique to Windows CE, that combines the functionality of a menu bar and a tool bar, and also supports the standard Close (X) and help (?) buttons in the upper right corner. Using a command bar instead of a title bar, a toolbar, and a menu bar conserves a lot of screen space, which is important on devices with small displays.

For more information about command bars, see Command Bars in the SDK documentation.

MFC for Windows CE fully supports the CSplitterWnd class.

To see where the frame window and splitter window classes fit into the Windows CE class hierarchy, see Window Class Categories and Classes Derived from CObject.


Property Sheets

The CPropertySheet class in MFC for Windows CE is the same as it is in the standard MFC library, with two exceptions. Windows CE doesn't support wizards, and you can't place an icon in the caption of a property sheet.

To see where the CPropertySheet class fits into the Windows CE class hierarchy, see Window Class Categories and Classes Derived from CObject.


View Classes

MFC for Windows CE supports all of the standard MFC view classes except for CRichEditView, CDaoRecordView, and CRecordView. The reason it doesn't support those classes is that Windows CE doesn't currently support rich edit controls or DAO database access. MFC for Windows CE does provide a CCeDBRecord class, however.

There are a couple of differences in the CView class, due mostly to the fact that the current version of MFC for Windows CE doesn't support drag and drop or printing. You can, however, print using the global functions in the Windows CE 2.0 SDK.

There are also a few CEditView member functions that MFC for Windows CE doesn't support.

See the following topics for information about the MFC for Windows CE view classes.

CView

CCtrlView

CEditView

CListView

CTreeView

CScrollView

CFormView

To see where the view classes fit into the Windows CE class hierarchy, see Window Class Categories and Classes Derived from CObject.


Array Classes

MFC for Windows CE supports the array classes the same way they're supported in the standard MFC library.

See the following topics for information about the MFC for Windows CE array classes.

CArray (template)

CByteArray

CDWordArray

CObArray

CPtrArray

CStringArray

CUIntArray

CWordArray

To see where the array classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


List Classes

MFC for Windows CE supports the list classes the same way they're supported in the standard MFC library.

See the following topics for information about the MFC for Windows CE list classes.

CList (template)

CObList

CPtrList

CStringList

To see where the list classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Map Classes

MFC for Windows CE supports the map classes the same way they're supported in the standard MFC library.

See the following topics for information about the MFC for Windows CE map classes.

CMap (template)

CMapPtrToPtr

CMapPtrToWord

CMapStringToOb

CMapStringToPtr

CMapStringToString

CMapWordToOb

CMapWordToPtr

To see where the map classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Exception Classes

Windows CE supports all the standard MFC exception classes, except for DaoException, ODBCException, and InternetException. It doesn't support those exceptions because it doesn't support DAO or ODBC database access, and it currently doesn't support internet classes.

See the following topics for information about the MFC for Windows CE exception classes.

CException

CArchiveException

CFileException

CMemoryException

CNotSupportedException

COleDispatchException

COleException

CResourceException

CUserException

To see where the exception classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


File Service Classes

MFC for Windows CE supports the main file classes. The main difference in the CFile class under Windows CE is that you can't lock a range of bytes in an open file.

MFC for Windows CE doesn't support CSharedFile or any of the classes derived from CMonkerFile or CStdioFile.

See the following topics for information about the MFC for Windows CE file service classes.

CFile

CMemFile

COleStreamFile

CSocketFile

CRecentFileList

To see where the file service classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Graphical Drawing Classes

MFC for Windows CE supports all the graphical drawing classes except for CMetaFileDC. The Windows CE 2.0 operating system doesn't support metafiles.

The CDC class is significantly different in MFC for Windows CE than it is in the standard MFC library. This is because Windows CE platforms are generally less graphically sophisticated than the standard desktop windows platforms.

See the following topics for information about the MFC for Windows CE graphical drawing classes.

CDC

CClientDC

CPaintDC

CWindowDC

To see where the graphical drawing classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Graphical Drawing Object Classes

MFC for Windows CE supports all the graphical drawing object classes except for CPalette, but they're supported a little bit differently than they are in the standard MFC library .

See the following topics for information about the MFC for Windows CE graphical drawing object classes.

CGdiObject

CBitmap

CBrush

CFont

CPen

CRgn

To see where the graphical drawing object classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Control Support Classes

MFC for Windows CE supports the CImageList class the same way standard MFC does.

MFC for Windows CE doesn't support the CDockState class.

To see where the CImageList class fits into the Windows CE class hierarchy, see Classes Derived from CObject.


Menu Classes

MFC for Windows CE supports the CMenu class very much the way standard MFC does, except that it doesn't support menu item bitmaps, menu templates, or context sensitive help for menus. It also supports a few of the member functions a little bit differently than the standard MFC implementation does.

To see where the CMenu class fits into the Windows CE class hierarchy, see Classes Derived from CObject.


Synchronization Classes

MFC for Windows CE support all the standard MFC synchronization classes except for CMutex and CSemaphore. The other synchronization classes are the same as they are in standard MFC, except that CEvent's SetEvent and ResetEvent member functions don't support waiting for a process or thread.

See the following topics for information about the MFC for Windows CE synchronization classes.

CSyncObject

CCriticalSection

CEvent

To see where these synchronization classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Windows Sockets Classes

MFC for Windows CE introduces a new socket class, called CCeSocket. Windows CE doesn't inherently support asynchronous socket communication, but the CCeSocket class provides asynchronous notification for certain types of socket events. If you require asynchronous event notification, you should always use the CCeSocket class when writing socket application for Windows CE.

See the following topics for information about the MFC for Windows CE socket classes.

CAsyncSocket

CCeSocket

CSocket

To see where the Windows CE sockets classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Windows CE Database Classes

MFC for Windows CE introduces four new database support classes. Two of them are derived from CObject.

The CCeDBDatabase represents a Windows CE object store database.

CCeDBProp encapsulates the attributes and functionality of a database property.

There are two other Windows CE database support classes, called CCeDBRecord, which represents a Windows CE database record, and CCeDBEnum, which is an object store database enumerator. See Windows CE Database Support for more information about these classes.

To see where these Windows CE database classes fit into the Windows CE class hierarchy, see Classes Derived from CObject.


Classes Not Derived from CObject

Not all classes in MFC for Windows CE are derived from CObject. You can use classes that aren't derived from CObject in applications that otherwise don't support MFC. See the following topics for information about these classes.

ActiveX Type Wrappers

Automation Types

Run-Time Object Model Support

Simple Value Types

Structures

Support Classes

Synchronization Support

Typed Template Collections

Windows CE Database Support

For an overview of the whole Windows CE class hierarchy, see Top Level Hierarchy Chart.


Run-Time Object Model Support

MFC for Windows CE supports all the run-time object model classes the same way the standard MFC library supports them.

See the following topics for information about the MFC for Windows CE run-time support classes.

CArchive

CDumpContext

CRuntimeClass

To see where the run-time object model support classes fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


Simple Value Types

MFC for Windows CE supports all the simple value type classes, but the CString class and the CTime class don't include all the standard member functions. For example, CString doesn't support OEM character sets, and CTime doesn't support the Greenwich Mean Time functions.

See the following topics for information about the MFC for Windows CE simple value type classes.

CPoint

CRect

CSize

CString

CTime

CTimeSpan

To see where the simple value type classes fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


Structures

MFC for Windows CE supports all the standard MFC structures except for CPrintInfo. It supports most of the other structures the same way they're supported in the standard MFC library.

The only difference is in the CCommandLineInfo class. MFC for Windows CE doesn't support all of the CCommandLineInfo data members, and there are a few command line flags the ParseParam member function doesn't parse.

See the following topics for information about the MFC for Windows CE structures.

CCommandLineInfo

CCreateContext

CFileStatus

COleSafeArray

For information about other structures used in MFC, see Structures Used in MFC.

To see where these structures fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


Support Classes

MFC for Windows CE supports the following classes the same way the standard MFC library does, with the one exception that you can't use the SetCursor member function of the CRectTracker class.

CCmdUI

CDataExchange

CLongBinary

COleDispatchDriver

CPropExchange

CRectTracker

CWaitCursor

MFC for Windows CE doesn't support the COleCmdUI, CDaoFieldExchange, CDBVariant, CFieldExchange, and COleDataObject support classes.

To see where the support classes fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


Typed Template Collections

MFC for Windows CE supports all the typed template collection classes the same way the standard MFC library supports them.

See the following topics for information about the MFC for Windows CE typed template collection classes.

CTypedPtrArray

CTypedPtrList

CTypedPtrMap

To see where the typed template collection classes fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


ActiveX Type Wrappers

MFC for Windows CE supports the CFontHolder class the same way the standard MFC library does. It does not support the CPictureHolder class.

To see where the CFontholder class fits into the Windows CE class hierarchy, see Classes Not Derived from CObject.


Automation Types

MFC for Windows CE supports the Automation type classes the same way the standard MFC library supports them, with the exception that it doesn't support the Format member function of the COleDateTime and COleDateTimeSpan classes.

See the following topics for information about the MFC for Windows CE Automation type classes.

COleCurrency

COleDateTime

COleDateTimeSpan

COleVariant

To see where the automation type classes fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


Synchronization Support

MFC for Windows CE supports the CSingleLock class the same way the standard MFC library supports it.

MFC for Windows CE doesn't support the CMultiLock class.

To see where these synchronization classes fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


Windows CE Database Support

MFC for Windows CE introduces four new database support classes. CCeDBRecord represents a database record in a Windows CE object store database (a CCeDatabase object). Each CCeDBRecord object contains pointers to the CCeDBProp objects that represent the record's properties.

The CCeDBEnum class is an object store database enumerator.

See Windows CE Database Classes for information on the CCeDatabase and CCeDBProp classes.

To see where these Windows CE database support classes fit into the Windows CE class hierarchy, see Classes Not Derived from CObject.


New MFC Classes for Windows CE

The following classes are unique to Windows CE. The CCeDB* classes provide support for creating and accessing Windows CE databases in the object store. The CCeSocket class provides asynchronous notification for certain socket events.

CCeDBDatabase

CCeDBEnum

CCeDBProp

CCeDBRecord

CCeSocket


Modified MFC Classes

In Windows CE, each of the following MFC classes is different in some respect than it is in the standard MFC implementation. See the following topics to find out what you have to do differently when using these classes in your Windows CE application.

CBitmap | COleControl
CBrush | COleDateTime
CButton | COleDateTimeSpan
CComboBox | COleObjectFactory
CCommandLineInfo | CPen
CCommonDialog | CPropertyPage
CDC | CPropertySheet
CDialog | CRectTracker
CDocTemplate | CRgn
CDocument | CScrollBar
CEdit | CSpinButtonCtrl
CEditView | CStatic
CEvent | CString
CFile | CSyncObject
CFileDialog | CTabCtrl
CFont | CTime
CFrameWnd | CView
CGdiObject | CWinApp
CListBox | CWinThread
CListCtrl | CWnd
CMenu |


Fully Supported MFC Classes

The following MFC classes the same in Windows CE as they are in Windows 95.

CArchive | COleControlModule
CArchiveException | COleCurrency
CArray (template) | COleDispatchDriver
CAsyncSocket | COleDispatchException
CBitmapButton | COleException
CByteArray | COlePropertyPage
CClientDC | COleSafeArray
CCmdTarget | COleStreamFile
CCmdUI | COleVariant
CConnectionPoint | CPaintDC
CCreateContext | CPoint
CCriticalSection | CProgressCtrl
CCtrlView | CPropExchange
CDataExchange | CPtrArray
CDumpContext | CPtrList
CDWordArray | CRecentFileList
CException | CRect
CFileException | CResourceException
CFileStatus | CRuntimeClass
CFindReplaceDialog | CScrollView
CFontHolder | CSingleDocTemplate
CFormView | CSingleLock
CHeaderCtrl | CSize
CImageList | CSliderCtrl
CList (template) | CSocket
CListView | CSocketFile
CLongBinary | CSplitterWnd
CMap (template) | CStringArray
CMapPtrToPtr | CStringList
CMapPtrToWord | CTimeSpan
CMapStringToOb | CTreeCtrl
CMapStringToPtr | CTreeView
CMapStringToString | CTypedPtrArray
CMapWordToOb | CTypedPtrList
CMapWordToPtr | CTypedPtrMap
CMemFile | CUIntArray
CMemoryException | CUserException
CNotSupportedException | CWaitCursor
CObArray | CWindowDC
CObject | CWordArray
CObList |


Unsupported MFC Classes

Windows CE doesn't currently support all of the classes in the Microsoft Foundation Class library.

The current version of Windows CE doesn't support Data Access Objects (DAO), Open Database Connectivity (ODBC), Multiple Document Interface (MDI), object linking and embedding, OLE documents and servers, OLE drag and drop, or rich edit controls. It also doesn't support some of the controls, common dialog boxes, synchronization objects, and a few other features that desktop Windows platforms support.

The current version of MFC for Windows CE also doesn't support internet access, metafiles, printing, or the color and print common dialog boxes.

Because of these differences, you can't use the following classes in Windows CE applications.

Common Dialogs | ODBC
CColorDialog | CDatabase
CFontDialog | CDBException
CPageSetupDialog | CDBVariant
CPrintDialog | CFieldExchange
 | CRecordset
Common Controls | CRecordView
CAnimateCtrl |
CCheckListBox | OLE
CDragListBox | CAsyncMonikerFile
CHotKeyCtrl | CCachedDataPathProperty
CMiniFrameWnd | CDataPathProperty
CStatusBarCtrl | CDocItem
CToolBarCtrl | CDocObjectServer
CToolTipCtrl | CDocObjectServerItem
 | CMonikerFile
Control Bars | COleClientItem
CControlBar | COleCmdUI
CDialogBar | COleDataObject
CStatusBar | COleDataSource
CToolBar | COleDocument
 | COleDropSource
DAO | COleDropTarget
CDaoDatabase | COleIPFrameWnd
CDaoException | COleLinkingDoc
CDaoFieldExchange | COleMessageFilter
CDaoQueryDef | COleServerDoc
CDaoRecordset | COleServerItem
CDaoRecordView | COleStreamFile
CDaoTableDef | COleTemplateServer
CDaoWorkspace | All COle*Dialog classes
Internet | Printing
CFtpConnection | CPrintDialog
CFtpFileFind | CPrintInfo
CGopherConnection |
CGopherFile | Rich Edit Controls
CGopherFileFind | CRichEditCntrl
CGopherLocator | CRichEditCntrlItem
CHtmlStream | CRichEditDoc
CHttpConnection | CRichEditView
CHttpFile |
CHttpFilter | Synchronization Classes
CHttpFilterContext | CMutex
CHttpServer | CMultiLock
CHttpServerContext | CSemaphore
CInternetConnection |
CInternetException | Other Unsupported Classes
CInternetFile | CDockState
CInternetSession | CFileFind
 | CMetaFileDC
MDI | CPalette
CMDIChildWnd | CPictureHolder
CMDIFrameWnd | CSharedFile
CMultiDocTemplate | CStdioFile


Windows CE-Specific MFC API Functions & Messages

MFC for Windows CE supports a new global function and a new window message that you can use in conjunction with the CCeSocket class. Windows CE does not natively support asynchronous event notification. Although CeSocket simulates asynchronous notifications, you may sometimes need to directly send messages to the window used by the by a CeSocket object.

You use the WM_SOCKET_NOTIFY message in a Windows CE application to notify a socket of an asynchronous event, for instance, when the socket to which it's connected is closing.

The WM_SOCKET_NOTIFY message is processed by a socket window that's maintained as part of the module's thread state. Use the AfxGetCeSocketWindow function to obtain the handle to this window.

For an example of how to use AfxGetCeSocketWindow and WM_SOCKET_NOTIFY in a Windows CE socket application, see the CHATTER/CHATSRVR sample application.


MFC Global Functions

MFC for Windows CE supports a new global function called AfxGetCeSocketWindow. You use this function to retrieve a window handle to which you can send socket notifications.

MFC for Windows CE supports the following global MFC functions the same way the standard MFC library supports them..

AfxAbort AfxOleInitModule
AfxBeginThread AfxOleRegisterControlClass
AfxCheckMemory AfxOleRegisterPropertyPageClass
AfxConnectionAdvise AfxOleRegisterServerClass
AfxConnectionUnadvise AfxOleRegisterTypeLib
AfxDoForAllClasses AfxOleUnregisterClass
AfxDoForAllObjects AfxOleUnregisterTypeLib
AfxDump AfxRegisterClass
AfxEnableControlContainer AfxRegisterWndClass
AfxEnableMemoryTracking AfxSetAllocHook
AfxEndThread AfxSetResourceHandle
AfxFormatString1 AfxSocketInit
AfxFormatString2 AfxTermExtensionModule
AfxFreeLibrary AfxThrowArchiveException
AfxGetApp AfxThrowFileException
AfxGetAppName AfxThrowOleDispatchException
AfxGetInstanceHandle AfxThrowOleException
AfxGetMainWnd AfxThrowMemoryException
AfxGetResourceHandle AfxThrowNotSupportedException
AfxGetStaticModuleState AfxThrowResourceException
AfxGetThread AfxThrowUserException
AfxInitExtensionModule CompareElements
AfxIsMemoryBlock ConstructElements
AfxIsValidAddress CopyElements
AfxIsValidString DestructElements
AfxLoadLibrary DumpElements
AfxMessageBox HashKey
AfxOleInit SerializeElements


Global MFC Functions Not Supported in Windows CE

Windows CE doesn't support the following MFC global functions.

AfxDaoInit | AfxOleLockControl
AfxDaoTerm | AfxOleSetEditMenu
AfxDbInit | AfxOleSetUserCtrl
AfxDbInitModule | AfxOleTypeMatchGuid
AfxGetInternetHandleType | AfxOleUnlockApp
AfxInitRichEdit | AfxOleUnlockControl
AfxNetInitModule | AfxOleParseURL
AfxOleCanExitApp | AfxThrowDaoException
AfxOleGetMessageFilter | AfxThrowDBException
AfxOleGetUserCtrl | AfxThrowInternetException
AfxOleLockApp |


Structures Used in MFC

Windows CE supports the following structures the same way Windows 95 and Windows NT support them.

AFX_EXTENSION_MODULE MSG
BITMAP PAINTSTRUCT
BITMAPINFO POINT
CCreateContext RECT
CFileStatus RGNDATA
CRuntimeClass SAFEARRAY
CREATESTRUCT SIZE
DELETEITEMSTRUCT SOCKADDR
DRAWITEMSTRUCT SOCKADDR_IN
FILETIME STGMEDIUM
FINDREPLACE SYSTEMTIME
FORMATETC TEXTMETRIC
LOGBRUSH VARIANT
LOGFONT WINDOWPOS
LOGPEN WSADATA
MEASUREITEMSTRUCT


Structures Not Supported in MFC for Windows CE

Windows CE doesn't support the following structures used in standard MFC.

ABC | DEVNAMES
ABCFLOAT | DOCINFO
CDaoDatabaseInfo | EXTENSION_CONTROL_BLOCK
CDaoErrorInfo | HSE_VERSION_INFO
CDaoFieldInfo | HTTP_FILTER_AUTHENT
CDaoIndexInfo | HTTP_FILTER_CONTEXT
CDaoIndexFieldInfo | HTTP_FILTER_LOG
CDaoParameterInfo | HTTP_FILTER_PREPROC_HEADERS
CDaoQueryDefInfo | HTTP_FILTER_RAW_DATA
CDaoRelationInfo | HTTP_FILTER_URL_MAP
CDaoRelationFieldInfo | HTTP_FILTER_VERSION
CDaoTableDefInfo | LINGER
CDaoWorkspaceInfo | MINMAXINFO
CODBCFieldInfo | NCCALCSIZE_PARAMS
COLORADJUSTMENT | WINDOWPLACEMENT
COMPAREITEMSTRUCT | XFORM
DEVMODE |


How is MFC for Windows CE Different from MFC for Desktop Platforms?

Windows CE is a more compact operating system than the desktop Windows platforms, so it supports a streamlined subset of the standard MFC library. The Windows CE implementation of this subset is designed to be as compatible as possible with standard MFC but there are, inevitably, some differences in some of the classes. MFC for Windows CE also introduces several new classes to support some of the features that are unique to Windows CE.

MFC for Windows CE introduces four new database classes that encapsulate the simple database functionality supported by the Windows CE object store. These classes are CCeDBDatabase, CCeDBRecord, CCeDBProp, and CCeDBEnum. CCeDBEnum is an enumerator for the databases in the object store.

Another new class that's unique to MFC for Windows CE is CCeSocket. Windows CE doesn't inherently support asynchronous socket communication, but the CCeSocket class simulates asynchronous notification for certain socket events. Use this class instead of CAsyncSocket for Windows CE socket applications.

One Windows CE feature that isn't supported on desktop Windows platforms is the command bar. The command bar is a common control that combines the functionality of a menu bar and a tool bar. It also includes the standard Windows Close (X) button and, optionally, the Help (?) button and the OK button. This control is very useful for devices with small displays. MFC for Windows CE supports command bars with nine new functions in the CFrameWnd class.


MFC for Windows CE Samples

The following sample applications show how to use the new Windows CE classes, and demonstrate some of the differences between MFC for Windows CE and the standard desktop version of MFC. You can find these sample applications in the Wce\Samples\Mfc directory.

CBARTEST | Demonstrates how to add a command bar to your application window.
CHATTER/CHATSRVR | Demonstrates how to use the new CCESocket class.
CHKBOOK | Demonstrates file I/O, CScrollView, and CFormView.
CMNCTRLS | Demonstrates how to use the CListCtrl, CTreeCtrl, CProgressCtrl, CSliderCtrl, and CSpinButtonCtrl common control classes.
COLLECT | Demonstrates how to use lists, maps and arrays.
CTRLTEST | Demonstrates several techniques for implementing and using custom controls.
DYNAMENU | Demonstrates how to dynamically modify menus and status bars.
ETCHA | Demonstrates the basic graphics and windowing functionality of Windows CE, using MFC.
GENERIC | Demonstrates basic techniques for writing a Windows CE application in MFC.
HELLO | Simple hello world.
HELLOAPP | Demonstrates the few simple steps needed to produce an application.
MATHS, MATHS1, MATHS2, MATHS3 | Demonstrates how to create ActiveX controls and embed them in an ActiveX container.
MODELESS | Demonstrates how to use modeless dialog boxes.
MTGDI | Demonstrates how to share GDI resources between multiple threads.
NPP | Demonstrates how to create a simple text editing application, similar to Notepad.
PROPDLG | Demonstrates how to use property sheets.
SMILEY/SMILEYDG | Demonstrates how to use ActiveX controls and containers.
STASPLIT | Demonstrates how to use static splitter windows.
WCEDBTST | Demonstrates how to use the four new Windows CE database classes


CBARTEST

The CBARTEST sample demonstrates how to add a command bar to your application window. This application creates an application window with a command bar that contains a menu, a toolbar, a combo box, and the Help, OK, and Exit buttons.

When a user selects one of these options, the function UpdateCommandBar resets the command bar and adds the selected objects for display. Menu options act as toggles. They're checked if the object is displayed in the command bar, unchecked if it is not currently displayed.

The menu options allow you to add and/or remove the following:

  • Toolbar
  • Help button
  • OK button
  • Combo box

Pressing one of the toolbar buttons will produce a message box, confirming that the WM_COMMAND message was routed to the application specific class, CMainWindow.

This sample demonstrates the following keywords:

CDC::DrawText

CDialog::DoModal

CDialog::OnOK

CFrameWnd::AddAdornments

CFrameWnd::AddComboBoxString

CFrameWnd::InsertButtons

CFrameWnd::InsertComboBox

CFrameWnd::InsertMenu

CFrameWnd::LoadFrame

CMenu::CheckMenuItem

CWinApp::InitInstance

CWnd::GetClientRect

CWnd::MessageBox

CWnd::OnPaint

CWnd::ShowWindow

CWnd::UpdateWindow

PostQuitMessage

You can find the CBARTEST project files in the Wce\Samples\Mfc\CBARTEST directory.

To build the CBARTEST sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


CHATTER/CHATSRVR

The CHATTER and CHATSRVR sample programs demonstrate how to use the CCeSocket class to create and use data sockets and listening sockets in Windows CE applications.

To execute these applications, you will need a desktop computer and a Handheld PC (H/PC). Start CHATSRVR on the desktop computer. CHATSRVR displays a dialog with a single edit box. Enter a number between 0 and 99, to assign a listening port.

Start CHATTER on the H/PC. You can run several instances of CHATTER on the same H/PC, or on different H/PCs, connected to the same instance of CHATSRVR. CHATTER displays a dialog in which you enter the following three elements:

  • A handle (a name or number by which to identify this client).
  • The network address of the server socket on the device on which CHATSRVR is running.
  • The channel number you used to establish the listening port on the device on which CHATSRVR is running.

The CHATTER user interface consists of a static splitter window with two panes, a chat view and a send view. When you enter a message in the send view pane and press the enter key, CHATTER sends the message, prefixed by its client handle, through its data socket to the listening socket on the H/PC running CHATSRVR.

CHATSRVR receives notification of the incoming connection on its listening socket, creates a data socket to receive the connection, and adds the new socket to its connection list. CHATSRVR reads the message from the data socket, and then sends that message to all the instances of CHATTER that are currently connected to its data sockets.

Each running instance of CHATTER receives the message through its data socket, and then displays it in the chat view pane of its splitter window. When an instance of CHATTER closes its data socket, it sends a final message to CHATSRVR with a flag set to indicate that the socket is being closed.

When CHATSRVR receives this message, it obtains its socket window handle by invoking the new WCE MFC API function, AfxGetCeSocketWindow, and sends this window a WM_SOCKET_NOTIFY message with the wParam set to the client socket's SOCKET handle and the lParam set to FD_CLOSE. This message is mapped to the OnClose handler of the socket connected to that client. Systems that support true asynchronous socket notifications provide this behavior automatically but, in Windows CE, you have to code it yourself.

These samples demonstrate the following keywords:

CHATSRVR CHATTER
CArchive::Abort CArchive::Abort
CArchive::Flush CArchive::Flush
CAsyncSocket::OnAccept CArchive::IsBufferEmpty
CAsyncSocket::OnClose CArchive::IsStoring
CAsyncSocket::OnReceive CAsyncSocket::OnReceive
CAsyncSocket::Receive CAsyncSocket::Connect
CAsyncSocket::Accept CAsyncSocket::ShutDown
CAsyncSocket::Close CCeSocket::Create
CAsyncSocket::ShutDown CDialog::DoModal
CCeSocket::Create CDocument::GetFirstViewPosition
CEdit::GetSel CDocument::GetNextView
CEdit::ReplaceSel CFileException
CEditView::SerializeRaw CSocketFile
CPtrList::AddTail CString::LoadString
CPtrList::GetHeadPosition CString::operator +
CPtrList::GetNext CString::operator =
CPtrList::IsEmpty CStringList::IsEmpty
CPtrList::RemoveHead CStringList::RemoveAll
CSocket::FromHandle CStringList::RemoveHead
CSocketFile CWnd::GetWindowText
CString::GetBuffer CWnd::SetWindowText
CString::LoadString AfxGetCeSocketWindow
CString::ReleaseBuffer AfxGetApp
CString::operator + AfxMessageBox
CString::operator = WM_SOCKET_NOTIFY
CStringList::AddTail
CStringList::GetCount
CStringList::RemoveAll
CWnd::GetWindowTextLength
CWnd::SendMessage
CloseSocket

You can find the CHATTER project files in the Wce\Samples\Mfc\CHATTER directory, and the CHATSRVR project files in the Wce\Samples\Mfc\CHATSRVR directory.

To build the CHATTER and CHATSRVR samples, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


CHKBOOK

The CHKBOOK sample demonstrates how to simulate multiple views in Windows CE by hiding/showing windows. (Windows CE doesn't support Multi-Document Interface (MDI).)

There is only one view of the document, implemented in class CCheckBookView. To enter or view data for a single check, select the menu item View Check, and a dialog is displayed. To show a summary of each check in the checkbook, select the menu item View Book, and an edit window is displayed. The two views cannot be seen at the same time, but you can toggle between them.

You can change the current selection in the checkbook view by using the menu items Previous and Next, or by tapping a check item with the stylus. The check view always shows the current selection in the checkbook view.

The check amount field in the check form view validates and converts a textual representation such as "19.98" to an internal DWORD representation. CHKBOOK does not do arithmetic, but it easily could be extended to add up all the check amounts and display the total on a bottom line.

Record-Based Document

A record-based document is one whose persistent data is updated each time the user adds, deletes, or modifies some portion of its data. This requires overriding the framework's default implementation for file-based documents. The default behavior is to read a file entirely into memory upon File Open and write it entirely back to the disk on File Close.

CHKBOOK Simplifications

The CHKBOOK sample has several simplifications to keep the code focused on MFC features and techniques the sample is designed to illustrate. For example:

  • CHKBOOK supports only checks. Other money transactions, such as deposits, are not supported. CHKBOOK also does not support the deletion (voiding) of checks. Check data is written using fixed-length records rather than the more space-efficient variable length records. These simplifications allow the CHKBOOK Doc class to access individual check records according to the following very simple algorithm. The location of the check is equal to the length of the file header, plus n times the fixed length of a check record, where n is the number of sequentially issued checks before the check in question.
  • CHKBOOK does not fully support resource-based localization to other languages. In particular, the check amount field assumes dollars and cents, and the written-out check amount (e.g., "Nineteen and 98/100ths Dollars") is displayed in English

This sample demonstrates the following keywords:

CArchive::IsStoring CString::Format
CCmdUI::Enable CString::LoadString
CCmdUI::SetCheck CString::GetLength
CDC::GetTextMetrics CString::Left
CDataExchange::Fail CWinApp::AddDocTemplate
CDataExchange::PrepareEditCtrl CWinApp::OnFileNew
CDialog::DoModal CWnd::Create
CDocument::GetFirstViewPosition CWnd::DoDataExchange
CDocument::GetNextView CWnd::GetClientRect
CEdit::CharFromPos CWnd::MessageBox
CEdit::LineIndex CWnd::OnShowWindow
CEdit::SetSel CWnd::SendMessage
CEdit::SetTabStops CWnd::SetFocus
CFile::Close CWnd::SetWindowText
CFile::Open CWnd::ShowWindow
CFile::Read CWnd::UpdateData
CFile::Seek CWnd::UpdateWindow
CFile::Write AfxMessageBox
CFrameWnd::AddAdornments GetWindowText
CFrameWnd::GetActiveDocument SetWindowText
CFrameWnd::InsertButtons _tcslen
CObject::AssertValid _ttoi
CObject::Dump _ttol
CObject::IsKindOf

You can find the CHKBOOK project files in the Wce\Samples\Mfc\CHKBOOK directory.

To build the CHKBOOK sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


CMNCTRLS

The CMNCTRLS sample demonstrates how to use the following common control MFC classes: CListCtrl , CTreeCtrl, CProgressCtrl, CSliderCtrl and CSpinButtonCtrl. It shows how to create the controls, and how to change them, using many of the different styles that are available.

Select a tab in the CMNCTRLS property sheet for a check box, radio button, or combo box. Then you can select various styles and views for the control from the property page displayed. Each one of the options changes the behavior and/or appearance of the control being displayed. For CListCtrl and CTreeCtrl, you will be able to see the different notification messages sent by the control as you experiment with it.

This sample demonstrates the following keywords:

CBitmap::LoadBitmap CSliderCtrl::SetRangeMax
CComboBox::AddString CSliderCtrl::SetRangeMin
CComboBox::ResetContent CSliderCtrl::SetSelection
CDialog::DoModal CSliderCtrl::SetTicFreq
CDialog::OnInitDialog CSpinButtonCtrl::Create
CEdit::LineLength CSpinButtonCtrl::GetBuddy
CEdit::LineIndex CSpinButtonCtrl::GetRange
CEdit::ReplaceSel CSpinButtonCtrl::SetBuddy
CEdit::SetSel CSpinButtonCtrl::SetRange
CGdiObject::DeleteObject CTreeCtrl::DeleteItem
CImageList::Add CTreeCtrl::GetImageList
CImageList::Create CTreeCtrl::GetChildItem
CImageList::DeleteImageList CTreeCtrl::GetParentItem
CImageList::DragEnter CTreeCtrl::InsertItem
CImageList::DragLeave CTreeCtrl::SetImageList
CImageList::DragMove CTreeCtrl::SetItem
CImageList::EndDrag CWinApp::LoadIcon
CListCtrl::GetItemText CWnd::DestroyWindow
CListCtrl::InsertColumn CWnd::GetDlgItem
CListCtrl::InsertItem CWnd::GetParent
CListCtrl::SetImageList CWnd::GetSafeHwnd
CListCtrl::SetItem CWnd::GetWindowRect
CListCtrl::SetItemPosition CWnd::GetWindowText
CListCtrl::SetItemText CWnd::Invalidate
CProgressCtrl::OffsetPos CWnd::SetIcon
CProgressCtrl::SetPos CWnd::SetWindowPos
CProgressCtrl::SetRange CWnd::SetWindowText
CProgressCtrl::SetStep CWnd::ScreenToClient
CProgressCtrl::StepIt CWnd::UpdateData
CPropertyPage::SetModified AfxGetApp
CPropertySheet::AddPage GetWindowLong
CSliderCtrl::Create MessageBeep
CSliderCtrl::ClearSel ReleaseCapture
CSliderCtrl::ClearTics _tcscpy
CSliderCtrl::SetLineSize _ttoi
CSliderCtrl::SetPageSize wsprintf
CSliderCtrl::SetRange

You can find the CMNCTRLS project files in the Wce\Samples\Mfc\CMNCTRLS directory.

To build the CMNCTRLS sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


COLLECT

The COLLECT sample illustrates a variety of the collection classes offered by the Microsoft Foundation Class Library for Windows CE (MFC CE).

The MFC collection classes can be classified according to shape and design, as follows:

Shapes:

  • Lists
  • Arrays
  • Maps

Designs:

  • Use of a C++ template–based collection of simple elements.
  • Use of a C++ template–based collection of type-safe pointers.
  • No use of C++ templates.

The COLLECT sample illustrates nine of these collections classes, representing a diverse combination of shapes and designs. Because the CTypedPtrArray and CTypedPtrList template-based collections are used differently, depending on whether they are being used to hold pointers to CObjects or to non-CObjects, the COLLECT sample illustrates both cases.

The nine collections illustrated by COLLECT are:

Shapes | Non-Template Based | Template-Based Simple Elements | Template-Based TypeSafe Pointers
List | CStringList | CList | CTypedPtrList (of pointers)
Array | CWordArray | CArray | CTypedPtrArray (of CObjects)
Map | CMapStringToString | CMap | CTypedPtrMap

Additional COLLECT Features

In addition to illustrating the MFC collection classes, COLLECT also illustrates:

  • Coordinating the addition and removal of entries in a list box with the addition and removal of entries in a collection.
  • Switching between different views of a document, with only one shown at a time. Although COLLECT has many different views, it has a single-document interface (SDI) instead of a multiple-document interface (MDI).

The Example menu lists the nine collection class illustrations. Each example presents a form view that exercises many of the common collection operations:

  • Adding a new element
  • Inserting a new element in the middle of a list.
  • Searching an element (by clicking its entry in the dialog box's list box).
  • Searching an entry in the map by entering the Key and clicking Find.
  • Updating the value of an element.
  • Removing an element.
  • Removing all the elements of the collection.

This sample demonstrates the following keywords:

CArchive::IsStoring CListBox::InsertString
CArray::Add CListBox::ResetContent
CArray::GetSize CListBox::SetItemDataPtr
CArray::RemoveAll CMap::GetNextAssoc
CArray::RemoveAt CMap::GetStartPosition
CCmdUI::SetCheck CMap::Lookup
CDataExchange::Fail CMap::RemoveAll
CDialog::DoModal CMap::RemoveKey
CFrameWnd::GetActiveView CObject::AssertValid
CFrameWnd::SetActiveView CObject::Dump
CList::AddTail CObject::Serialize
CList::Find CString::Empty
CList::GetHeadPosition CString::Format
CList::GetNext CString::LoadString
CList::InsertBefore CView::GetDocument
CList::RemoveAll CView::OnInitialUpdate
CList::RemoveAt CWinApp::AddDocTemplate
CListBox::AddString CWinApp::OnFileNew
CListBox::DeleteString CWnd::DestroyWindow
CListBox::FindString CWnd::UpdateData
CListBox::GetCurSel CWnd::ShowWindow
CListBox::GetItemDataPtr AfxMessageBox
CListBox::GetText SetWindowLong

You can find the COLLECT project files in the Wce\Samples\Mfc\COLLECT directory.

To build the COLLECT sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


CTRLTEST

The CTRLTEST sample demonstrates several techniques for implementing and using custom controls.

  • CParsedEdit is a specialized edit control that illustrates two methods of using custom controls.
  • The spin control has small up-arrow and down-arrow buttons for incrementing or decrementing a value.
  • The bitmapped button illustrates how to implement custom menu commands by using the CBitmapButton_idetls_mfc_CBitmapButton class.

Implementing and Using Custom Controls

You can implement a custom control from scratch by deriving from CWnd, but it is much easier if you can borrow functionality from one of the standard Windows controls by deriving from its control class in the library. CTRLTEST does this to implement a specialized edit control, CParsedEdit. This edit control accepts only specified sets of characters as user input -- numeric, alphabetic, and other non-control characters. CParsedEdit is derived from CEdit. It has an OnChar message handler to filter the characters.

The implementation of the commands in the Simple menu illustrates two methods for using a custom control. The methods are distinguished according to how the application associates instances of the control in the dialog box with the CParsedEdit class. Each Simple menu command displays a dialog box with four instances of the CParsedEdit control. Data entered in the dialog box is sent to the debug port as TRACE output. The two Simple menu commands are:

Test C++ Derived Class:

The CParsedEdit controls are data members of the dialog class. The controls are explicitly created in the dialog's OnInitDialog function by calling CParsedEdit::CreateSet. See DERTEST.CPP.

Test Dynamic Subclassing:

The controls are laid out in a dialog template resource (IDD_SUB_EDIT in CTRLTEST.RC) as standard edit controls. The controls are declared as CParsedEdit data members in the dialog class. The dialog's OnInitDialog function calls CParsedEdit::SubClassEdit, which in turn calls CWnd::SubclassDlgItem, to associate each specific instance of the edit control with the CParsedEdit class. See PAREDIT.CPP.

Example: Spin Control

The CTRLTEST sample includes an implementation of a spin control. The spin control has a small up-arrow and a small down-arrow button for incrementing or decrementing a value.

The Spin Control command calls a dialog box that has four CParsedEdit controls, each associated with a spin control. Data entered in the CParsedEdit controls in this dialog box is filtered to accept only nonnegative integers. The user can enter numeric data by either typing the value into the CParsedEdit control or using the associated spin control.

Example: Bitmap Button

The implementation of the following Custom menu commands illustrates ways to use CBitmapButton:

  • Bitmap Button 1: The dialog constructor explicitly loads the bitmap resources for each of the three states (up, down, and focus) of the button by calling CBitmapButton::LoadBitmaps.
  • Bitmap Button 2: The dialog's OnInitDialog function calls CBitmapButton::Autoload to load the bitmap resources based on the following naming convention. The window text of the control serves as the base resource name, and the letters U, D, and F are appended to create the names of the resources for each of the three bitmap images for, respectively, up, down, and focus. For example, the three bitmap resources for the OK button are named OKU, OKD, and OKF.
  • Bitmap Button 3: The dialog box is an extension of the second dialog box above, using a fourth possible button state, disabled. To use this dialog, click the left- or right-arrow bitmap button until the displayed number reaches 1, the lowest number, or 10, the highest number. When the limit is reached, the button is disabled and a fourth bitmap image is displayed. The naming convention for the bitmap resource for the disabled state is an X suffix, as is reflected in the resource names PREVX and NEXTX.

This sample demonstrates the following keywords:

CBitmapButton::AutoLoad CWnd::MessageBox
CBitmapButton::LoadBitmaps CWnd::OnChar
CBitmapButton::SizeToContent CWnd::SetFocus
CDialog::DoModal CWnd::SetWindowPos
CDialog::EndDialog CWnd::ShowWindow
CDialog::OnOK AfxGetInstanceHandle
CEdit::SetSel AfxMessageBox
CFrameWnd::AddAdornments AfxThrowResourceException
CString::Format CallWindowProc
CString::LoadString GetClassInfo
CWnd::Attach GetDlgItemInt
CWnd::Create IsCharAlpha
CWnd::EnableWindow IsCharAlphaNumeric
CWnd::GetDlgItem MessageBeep
CWnd::GetWindowRect SetDlgItemInt
CWnd::GetWindowText SetWindowLong
CWnd::IsWindowEnabled

You can find the CTRLTEST project files in the Wce\Samples\Mfc\CTRLTEST directory.

To build the CTRLTEST sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


DYNAMENU

The DYNAMENU sample demontrates dynamic modification of menus, regardless of whether handling commands are known at compile time.

DYNAMENU initially displays a window with the text "This text is displayed in the current color."

To exercise the dynamic menu update feature of DYNAMENU, click Change Options on the Color menu. This opens a Change Color Options dialog box. Four check boxes, for the colors Black, Dark Gray, Light Gray and White, allow you to choose which colors are dynamically offered in the Color menu. By unchecking the box for a particular color, you can clear the color from the Color menu.

Dynamically Updating the List of Items in a Menu

Class CMainFrame in MAINFRM.CPP implements dynamic updating of items in the Color menu. When the list of available colors is updated, the CMainFrame::RefreshColorMenu function resets the command bar, inserts the menu (without the color options), and uses CMenu::InsertMenu to add the currently available colors to the menu.

Implementing Command Handlers for Dynamic Menu Items

DYNAMENU could have been implemented by reserving a fixed list of command IDs for the colors: ID_COLOR_BLACK, ID_COLOR_WHITE, etc. In such a case, ON_COMMAND and ON_UPDATE_COMMAND_UI handlers could have been implemented for the color commands as usual. This would be the most straightforward way to implement DYNAMENU.

For sake of illustration, DYNAMENU does not use fixed command IDs. Instead, DYNAMENU dynamically assigns command IDs not known or associated with the menu items at compile time. This illustration can be applied to more complex cases, such as user-configurable menus.

The equivalent of ON_COMMAND and ON_UPDATE_COMMAND message map handling is implemented in the document's override of CCmdTarget::OnCmdMsg. If the OnCmdMsg function is called with a NULL pointer for the AFX_CMDHANDLERINFO* parameter, this means that no message map entry has been found for the command. In this case, the override of OnCmdMsg checks whether the command ID, passed as the first parameter, is one of the dynamically assigned command IDs for the color menu items. If so, the override calls either a command handler (DoSelectColor) or command user interface handler (DoUpdateSelectColor), depending on whether the second parameter passed to OnCmdMsg is the MFC-defined CN_COMMAND or CN_UPDATE_COMMAND_UI.

This sample demonstrates the following keywords:

CArchive::IsStoring CObject::AssertValid
CCmdTarget::OnCmdMsg CObject::Dump
CCmdUI::Enable CObject::Serialize
CDC::DrawText CString::LoadString
CDC::SetBkMode CView::GetDocument
CDC::SetTextColor CWinApp::AddDocTemplate
CDialog::DoModal CWinApp::OnFileNew
CDocument::GetFirstViewPosition CWnd::Attach
CDocument::GetNextView CWnd::CenterWindow
CDocument::OnNewDocument CWnd::GetClientRect
CDocument::UpdateAllViews CWnd::GetDlgItem
CFrameWnd::AddAdornments CWnd::GetMenu
CFrameWnd::GetActiveDocument CWnd::GetParentFrame
CFrameWnd::InsertMenu CWnd::SetWindowText
CMenu::CheckMenuItem AfxGetMainWnd
CMenu::InsertMenu

You can find the DYNAMENU project files in the Wce\Samples\Mfc\DYNAMENU directory.

To build the DYNAMENU sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


ETCHA

The ETCHA sample is a simple drawing application that demonstrates how to handle stylus input. The stylus is treated as a mouse. Touching the screen sends the WM_LBUTTONDOWN message; moving the stylus sends the WM_MOUSEMOVE message; and lifting the stylus from the screen sends the WM_LBUTTONUP message.

The main application window is used for drawing. Move the stylus around the main window to draw. Tap File New to erase any drawing in the window.

ETCHA keeps track of two points in an array of CPoint objects. The handler OnLButtonDown sets the current array item to the current position of the stylus on the screen. OnMouseMove then sets the next array item to the new current position and draws a line from point to point, using the Polyline function.

An HPC device would only send WM_MOUSEMOVE messages when the stylus was touching the screen. The test for the flag MK_LBUTTON is only necessary for the emulation environment, where there is a mouse. However, it is good practice to keep code portable.

This sample demonstrates the following keywords:

CDC::Polyline

CDialog::DoModal

CDialog::OnCancel

CFrameWnd::AddAdornments

CFrameWnd::LoadFrame

CWnd::GetClientRect

CWnd::InvalidateRect

CWnd::OnKillFocus

CWnd::OnLButtonDown

CWnd::OnMouseMove

CWnd::ShowWindow

CWnd::UpdateWindow

You can find the ETCHA project files in the Wce\Samples\Mfc\ETCHA directory.

To build the ETCHA sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


GENERIC

The GENERIC application demonstrates some of the basic functionality of Windows CE. This application creates the main application window and draws a horizontal and vertical line. Each line bisects the client area, creating four equal quadrants. The application captures the message WM_LBUTTONDOWN, and the processing depends on the quadrant in which the user tapped the stylus.

Top Left quadrant: | Exits the application
Top Right quadrant: | Toggles the mouse capture on/off
Bottom Left quadrant: | Changes the Z-order of the window
Bottom Right quadrant: | Draws a square with the lower left corner at the point of the stylus tap.

The drawing is done in the OnPaint handler, using the Polyline function.

This sample demonstrates the following keywords:

CDC::Polyline

CFrameWnd::LoadFrame

CWnd::GetClientRect

CWnd::InvalidateRect

CWnd::OnLButtonDown

CWnd::SetCapture

CWnd::SetWindowPos

CWnd::ShowWindow

CWnd::UpdateWindow

PostQuitMessage

ReleaseCapture

You can find the GENERIC project files in the Wce\Samples\Mfc\GENERIC directory.

To build the GENERIC sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


HELLO

This HELLO sample is the classic "Hello, World" application. HELLO displays a menu and an About box, with the text, "Hello, WCE!" centered in the application window.

Like any application written using MFC, HELLO has a CWinApp-derived class. This application class provides an implementation of InitInstance, which constructs a frame window object (of the application specific CMainWindow class), then calls the window's ShowWindow and UpdateWindow functions.

"Hello, WCE!" is displayed in response to the WM_PAINT message, by specifying a message map entry, ON_WM_PAINT, for CMainWindow and by implementing the OnPaint handler.

This sample demonstrates the following keywords:

CDC::DrawText

CDC::SetBkMode

CDC::SetTextColor

CDialog::DoModal

CFrameWnd::AddAdornments

CFrameWnd::LoadFrame

CString::LoadString

CWnd::GetClientRect

CWnd::ShowWindow

CWnd::UpdateWindow

GetSysColor

You can find the HELLO project files in the Wce\Samples\Mfc\HELLO directory.

To build the HELLO sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


HELLOAPP

HELLOAPP is the minimal Microsoft Foundation Class Library (MFC) sample. It illustrates how few lines of code are required make a window appear on the screen. HELLOAPP is even simpler than the HELLO sample: HELLOAPP does not paint anything in the main window's client area, nor does it have even a message map for the main window. HELLOAPP is nevertheless instructive in that it demonstrates the minimal overhead required for a content-less application, as opposed to, for example, a WinMain type of application developed using the Microsoft Windows® Software Development Kit.

When HELLOAPP runs, it displays the text, "Hello World!" in the task bar, and an empty application window.

Like any application written using MFC, HELLOAPP has a CWinApp-derived class. This application class provides a minimal implementation of InitInstance, constructs a frame window object (of the application-specific class CMainWindow), then calls the window's ShowWindow and UpdateWindow functions.

This sample demonstrates the following keywords:

CFrameWnd::AddAdornments

CFrameWnd::Create

CFrameWnd::rectDefault

CWinApp::InitInstance

CWnd::ShowWindow

CWnd::UpdateWindow

You can find the HELLOAPP project files in the Wce\Samples\Mfc\HELLOAPP directory.

To build the HELLOAPP sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


MATHS

The MATHS, MATHS1, MATHS2, and MATHS3 samples demonstrate how you can create ActiveX controls and embed them in an MFC ActiveX container.

The main dialog class in this application, CMathsDlg, has two controls, a check box, labeled "Opposite," and a control of the class CMathsCtl, which is derived from CWnd.

CMathsDlg's override of OnInitDialog displays a query dialog with a list box that presents three options.

  • Maths1
  • Maths2
  • Maths3

When you select a control from the list box and dismiss the query dialog, the main dialog retrieves the index of the control you selected. It then creates a CMathsCtl object below the check box.

CMathsDlg assigns the index of the control you selected to it's CMathsCtrl member's m_idControl member. The CMathsCtl object uses this identifier to determine which CLSID to pass to its CreateControl function. This CLSID determines which of the three ActiveX controls will be instantiated.

The three controls, MATHS1, MATHS2, and MATHS3 are very similar. MATHS1 draws a horizontal line and a vertical line. If the "Opposite" check box is checked, it only draws the horizontal line. When you tap one of the lines with the stylus, the control fires an "Inside" event to its container. When you tap any other part of the control, it fires an "Outside" event.

When the control's container, the CMathsDlg object, receives an "Inside" event, it reverses the foreground and background colors of its CMathCtl object. When it receives an "Outside" event, it toggles the check state of the "Opposite" check box. Whenever the state changes, the ActiveX control redraws itself.

The MATHS2 and MATHS3 controls behave the same way as MATHS1, except that MATHS2 draws diagonal lines, instead of horizontal and vertical, and MATHS3 draws a vertical line if "Opposite" is not checked, or a circle, if it is.

These samples demonstrate the following keywords:

MATHS MATHS1, MATHS2, MATHS3
CButton::GetCheck CBrush::CreateSolidBrush
CButton::SetCheck CDC::Ellipse
CDialog::OnInitDialog CDC::FillRect
CListBox::AddString CDC::LineTo
CListBox::GetCurSel CDC::MoveTo
CString::LoadString CDC::SelectObject
CWinApp::LoadIcon COleControl::GetClientRect
CWnd::Create COleControl::InitializeIIDs
CWnd::CreateControl COleControl::InvalidateControl
CWnd::GetDlgItem COleControl::TranslateColor
CWnd::GetProperty COlePropertyPage
CWnd::InvokeHelper CWnd::OnLButtonDown
CWnd::OnSysCommand AfxOleRegisterPropertyPageClass
CWnd::SetIcon AfxOleUnregisterClass
CWnd::SetProperty DDP_PostProcessing
CWnd::ShowWindow
CWnd::UpdateWindow
AfxGetApp
GetSystemMenu

You can find the MATHS project files in the Wce\Samples\Mfc\MATHS directory.

The MATHS1 project files are in the Wce\Samples\Mfc\MATHS1 directory.

The MATHS2 project files are in the Wce\Samples\Mfc\MATHS2 directory

The MATHS3 project files are in the Wce\Samples\Mfc\MATHS3 directory.

To build these samples, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


MODELESS

MODELESS is an MFC for Windows CE (MFC WCE) sample that demonstrates the use of an MFC WCE CDialog object as a modeless dialog. MODELESS is a very simple dialog-based application that manages a list box in its main dialog while providing a modeless dialog that allows you to add strings to the list box in the main window.

When the sample starts, it presents an empty list box. You can open the modeless dialog box by clicking Add. Even while the MODELESS Adder dialog box is open, you can bring focus back to the main dialog. The Add button on the main dialog is disabled when the modeless dialog box is open so that the user cannot create more than one instance of the modeless box.

The main dialog's CMainDlg class manages a pointer to the modeless dialog box. It does this just for convenience; once created, the modeless dialog box requires no further management.

The code for the Add button in the main dialog creates the modeless dialog box using the Create function, instead of calling DoModal. This is what makes the box modeless. When the box is destroyed, EndDialog is not used; instead, DestroyWindow is called. Since the normal OnOk and OnCancel member functions of a CDialog object would call EndDialog, you need to make sure your modeless dialog doesn't call those functions but instead overrides them to call DestroyWindow.

Usually, when you create a modal dialog box, you destroy it manually after DoModal returns. Since you can't wait for Create to return while displaying your modeless dialog box, you'll need to have some other mechanism for destroying the C++ object associated with the window. This sample uses a very simple mechanism: It performs delete this in the handler for OnPostNcDestroy, a function that is called after the client area of the box has been destroyed.

The MODELESS dialog communicates with its parent dialog in two different ways. First, when the user presses OK, the string in the edit control in the MODELESS dialog is added to the content of the list box in the modal dialog box. Second, when the user destroys the window by whatever means, the modeless box calls the BoxDone function in the modal window. This function simply resets the pointer to the modal dialog and re-enables the Add button.

This sample demonstrates the following keywords:

CDialog::Create

CDialog::DoModal

CListBox::AddString

CWinApp::LoadIcon

CWnd::DestroyWindow

CWnd::EnableWindow

CWnd::GetDlgItem

CWnd::GetWindowText

CWnd::OnPaint

CWnd::OnSysCommand

AfxGetApp

You can find the MODELESS project files in the Wce\Samples\Mfc\MODELESS directory.

To build the MODELESS sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


MTGDI

The MTGDI sample is a demonstration of sharing GDI resources among multiple threads using the framework's single document interface (SDI) support for documents and views.

You can use the menu to add 1, 10, or 25 new threads at a time. Each thread displays either a moving ball, rectangle, or line in a random color.

MTGDI uses a set of CWinThread-derived classes, all of which are implemented in THREADS.CPP. The sample's own CGDIThread is the virtual base class for each of these GDI thread classes (one each for balls, rectangles, and lines). Since GDI resources cannot be shared among threads as MFC objects, this sample also demonstrates how to convert from standard GDI resources to MFC objects and back.

The application creates the desired number of threads when the user chooses to add new objects to those being displayed by the Thread menu. Each new object displayed is handled in its own thread. Any number of threads can be added to those already in progress. The number of threads currently being handled is shown in the title bar.

The threads are shut down all at once from the Thread menu, but you have a choice between whether this shutdown is done slowly or quickly. If there are fewer than 100 threads, it is difficult to tell the difference in speed between these two methods for MTGDI.

This sample demonstrates the following keywords:

CArchive::IsStoring CRect::SetRect
CDC::Attach CSingleLock::Unlock
CDC::Detach CString::Format
CDC::Ellipse CString::LoadString
CDC::GetSafeHdc CWinApp::AddDocTemplate
CDC::LineTo CWinApp::OnFileNew
CDC::MoveTo CWinThread::CreateThread
CDC::Rectangle CWinThread::ResumeThread
CDC::SelectObject CWinThread::SetThreadPriority
CDialog::DoModal CWnd::GetClientRect
CGDIObject::Attach CWnd::Invalidate
CGDIObject::Detach CWnd::SetWindowText
CList::AddTail CloseHandle
CList::GetCount CreateEvent
CList::GetHeadPosition DeleteCriticalSection
CList::GetNext EnterCriticalSection
CList::IsEmpty InitializeCriticalSection
CList::RemoveHead LeaveCriticalSection
CObject::AssertValid SetEvent
CObject::Dump WaitForSingleObject
CRect::OffsetRect

You can find the MTGDI project files in the Wce\Samples\Mfc\MTGDI directory.

To build the MTGDI sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


NPP

The NPP sample is a simple demonstration of a note pad application. It has the following abilities:

  • Open and save documents
  • Cut, copy, and paste documents
  • Find, replace and go to within documents

This sample demonstrates the following keywords:

CCmdUI::Enable CList::RemoveAt
CComboBox::Copy CObject::AssertValid
CComboBox::Paste CObject::Dump
CDialog::DoModal CObject::IsKindOf
CDialog::EndDialog CString::Format
CDialog::GotoDlgCtrl CString::GetLength
CDialog::OnCancel CString::LoadString
CEdit::Copy CWinApp::AddDocTemplate
CEdit::GetLineCount CWinApp::OnFileNew
CEdit::LineFromChar CWnd::Attach
CEdit::LineScroll CWnd::Create
CEdit::Paste CWnd::Detach
CEditView::GetEditCtrl CWnd::GetDlgItem
CEditView::GetSelectedText CWnd::GetFocus
CEditView::SerializeRaw CWnd::ModifyStyle
CFrameWnd::AddAdornments CWnd::PostMessage
CFrameWnd::InsertButtons CWnd::SendMessage
CList::AddHead CWnd::SetFocus
CList::FindIndex CWnd::SetWindowText
CList::GetCount CWnd::UpdateData
CList::GetHeadPosition AfxMessageBox
CList::GetNext MessageBeep

You can find the NPP project files in the Wce\Samples\Mfc\NPP directory.

To build the NPP sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


PROPDLG

The PROPDLG sample illustrates MFC for Windows CE's support for property sheets or tabbed dialog boxes.

PROPDLG is a simple object drawing program that uses property sheets for entering the shape and color attributes of a currently selected object.

Click anywhere in view to add a new shape, which is initially a fixed-size rectangle. Click elsewhere to add more shapes. To select a shape, click that shape. The Object menu displays a simple property sheet that has tabs for Style and Shape. Click OK to apply the properties to the currently selected object and exit the dialog box. Click Cancel to exit the dialog box without applying properties. The Apply Now and Help buttons are always disabled in this sample.

This sample demonstrates the following keywords:

CArchive::IsStoring CList::GetTailPosition
CDC::Ellipse CObject::AssertValid
CDC::GetClipBox CObject::Dump
CDC::Rectangle CObject::Serialize
CDC::RoundRect CPropertyPage::SetModified
CDC::SelectObject CPropertySheet::AddPage
CDialog::DoModal CRect::IntersectRect
CDocument::SetModifiedFlag CRect::PtInRect
CDocument::UpdateAllViews CWinApp::AddDocTemplate
CFrameWnd::AddAdornments CWinApp::OnFileNew
CFrameWnd::GetActiveView CWnd::GetClientRect
CList::AddHead CWnd::InvalidateRect
CList::GetPrev CWnd::SendMessage
CList::GetHeadPosition CWnd::UpdateData
CList::GetNext AfxGetMainWnd

You can find the PROPDLG project files in the Wce\Samples\Mfc\PROPDLG directory.

To build the PROPDLG sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


SMILEY/SMILEYDG

The SMILEY and SMILEYDG samples demonstrate how easy it is to use Windows CE MFC support to handle ActiveX controls. The sample consists of the SMILEY ActiveX control inserted into the SMILEYDG control container. The sample allows you to modify properties, call methods, and handle events from the SMILEY control.

SMILEYDG uses regular Windows calls to modify the ActiveX control's caption in CSmileyDlg::OnInitDialog. The caption is displayed directly above the control and is set to "Smile!" by default. SMILEYDG hooks up a check box that is tied to the ActiveX control's "Sad" property. Finally, it includes its own EVENTSINK map and handles the ClickIn and ClickOut events from the ActiveX control.

You can interact with the SMILEY sample in one of two ways.

  • Click the Sad check box
  • Click the face itself.

If you click the Sad check box, you will set the "Sad" Automation property in the ActiveX control. This will cause the smiley face to smile or frown, depending upon the value of the check box.

If you click the face itself, the ActiveX control will fire a ClickIn event, which the dialog handles by calling the control's "Wink" automation method. If you click outside the face, the ActiveX control will fire a ClickOut event, which the dialog handles by returning the face to normal.

This sample demonstrates the following keywords:

CDC::DrawIcon CWnd::GetFont
CDC::GetSafeHdc CWnd::IsIconic
CDialog::DoModal CWnd::OnLButtonDblClk
CMenu::AppendMenu CWnd::OnPaint
CRect::Height CWnd::OnSysCommand
CRect::Width CWnd::SendMessage
CString::IsEmpty CWnd::SetFont
CString::LoadString GetSystemMenu
CWinApp::InitInstance GetSystemMetrics
CWnd::Create LoadIcon
CWnd::DoDataExchange SetWindowText
CWnd::GetClientRect AfxGetApp

You can find the SMILEY project files in the Wce\Samples\Mfc\SMILEY directory.

You can find the SMILEYDG project files in the Wce\Samples\Mfc\SMILEYDG directory.

To build the SMILEY and SMILEYDG samples, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


STASPLIT

The STASPLIT sample is used to demonstrate the use of static and dynamic splitter windows. The essential difference between these two forms of splitter window is:

  • A dynamic splitter window allows the user to split the window at any time by choosing a menu item or by dragging a splitter box located on the scroll bar.
  • The panes of a static splitter window are defined when the window is first created. The user can move the bars but cannot split or re-split the window.

STASPLIT initializes the main application window with four panes, using the static splitter window form. The user can move the splitter window bars between the panes, but cannot change the number of panes. The bottom right pane is created as a dynamic splitter window. The scroll bars in this pane have the splitter box, allowing the bottom right pane to be divided into a maximum of four panes.

Both forms of splitter window are created from the class CSplitterWnd. The dynamic splitter window is formed by using the function Create, whereas a static splitter window is formed by using the function CreateStatic.

Select the menu item Window Split to move the splitter bars. If the bottom right pane has the focus, you can move the dynamic splitter bars, otherwise you can move the static splitter bars.

This sample demonstrates the following keywords:

AfxGetMainWnd

CArchive::IsStoring

CDialog::DoModal

CDocument::OnNewDocument

CEdit::SetReadOnly

CFrameWnd::AddAdornments

CFrameWnd::SetActiveView

CObject::AssertValid

CObject::Dump

CObject::IsKindOf

CSplitterWnd::Create

CSplitterWnd::CreateStatic

CSplitterWnd::CreateView

CSplitterWnd::SplitColumn

CSplitterWnd::SplitRow

CStringArray::SetSize

CView::GetDocument

CWinApp::AddDocTemplate

CWinApp::OnFileNew

CWnd::Create

CWnd::OnCreate

CWnd::ModifyStyle

CWnd::SetWindowText

You can find the STASPLIT project files in the Wce\Samples\Mfc\STASPLIT directory.

To build the STASPLIT sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


WCEDBTST

The WCEDBTST sample demonstrates how to use the CCeDBDatabase, CCeDBRecord, CCeDBProp, and CCeDBEnum classes to create, destroy, sort, enumerate, access, and edit a Windows CE database in the object store.

To test the various operations you can perform on a Windows CE database, select any of the following commands from the File menu.

  • The Clear command clears the display.
  • The Basic Test command checks to see if a certain database exists in the object store. If the database exists, it opens it and then deletes it. Then it creates a new database, checks to verify that it was created, closes it, opens it again, and deletes it.
  • The Enumeration Test command creates three databases, and assigns the application-defined identifier '99' to each of them. It then creates two enumerators. The first enumerator enumerates all the databases in the object store; the second one enumerates only those databases that have the identifier '99.' The enumerators iterate through the specified databases, and the application retrieves the name and latest modification time of each one, and prints it to the display.
  • The Sort Test command creates a sample database and prints its contents to the display. Then it opens the database three times specifying a different sort property each time, and prints the results of each sort operation to the display. The first time, it specifies Age as the sort property. The second time it specifies Gender. Then it uses the sort property flags to reverse the sort order of the Last Names sort property, so the database is sorted alphabetically by last name, but in descending order, rather than ascending.
  • The Modify Test command creates a sample database and prints its contents to the display. Then it searches for a record that contains a specific value for a specific property (a person's last name), and changes the value of a different property in the retrieved record (the person's age). Then it prints the contents of the database to the display again.
  • The Seek Test command creates a sample database and prints its contents to the display. Then it performs several seek operations, printing the retrieved record to the display after each successful seek. It seeks the first record, the last record, and the second record, and saves a pointer to the second record so it can return to it later. Then it seeks the second from the last record, then the previous record, and then it returns to the record to which it previously saved a pointer. After that, it seeks the first record that has the value "Smith" for the Last Name property. Then it proceeds to seek the next two records in the database that also have the value "Smith" for their Last Name property. The last seek fails, because there are only two Smiths in the database.
  • The Deletion Test command creates a sample database and prints its contents to the display. Then it deletes a record and writes the contents of the database to the display again. Then it seeks a different record and deletes two properties from the record. After writing the contents of the database to the display again, it seeks another record, deletes a single property, and updates the display one more time.

These samples demonstrate the following keywords:

CCeDBDatabase::AddRecord CCeDBProp::GetString
CCeDBDatabase::Close CCeDBProp::GetUShort
CCeDBDatabase::Create CCeDBProp::operator =
CCeDBDatabase::Delete CCeDBProp::SetSortFlags
CCeDBDatabase::DeleteCurrRecord CCeDBProp::SetUShort
CCeDBDatabase::Exists CCeDBRecord::AddProps
CCeDBDatabase::GetCurrIndex CCeDBRecord::DeleteAllProps
CCeDBDatabase::GetCurrRecord CCeDBRecord::DeleteProp
CCeDBDatabase::GetLastModified CCeDBRecord::GetPropFromIdent
CCeDBDatabase::GetName CDC::GetTextMetrics
CCeDBDatabase::GetSortProps CDC::FillSolidRect
CCeDBDatabase::m_bAutoSeekNext CDC::DrawText
CCeDBDatabase::Open CDocument::UpdateAllViews
CCeDBDatabase::ReadCurrRecord CObArray::Add
CCeDBDatabase::SeekFirst CObArray::GetSize
CCeDBDatabase::SeekFirstEqual CObArray::RemoveAll
CCeDBDatabase::SeekLast CRect::OffsetRect
CCeDBDatabase::SeekNextEqual CScrollView::GetScrollPosition
CCeDBDatabase::SeekPrev CString::operator =
CCeDBDatabase::SeekToIndex CString::operator +=
CCeDBDatabase::SeekToRecord FileTimeToSystemTime
CCeDBDatabase::SetSortProps Sleep
CCeDBDatabase::WriteCurrRecord wsprintf
CCeDBEnum::Next

You can find the WCEDBTST project files in the Wce\Samples\Mfc\WCEDBTST directory.

To build the WCEDBTST sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.

  • WCE x86em (Desktop PC Windows CE emulation)
  • WCE x86
  • WCE PPC
  • WCE MIPS
  • WCE SH


MFC for Windows CE Reference

Windows CE supports many of the standard Microsoft Foundation Class library classes. Because Windows CE runs on platforms that are very different from the desktop Windows platforms, it has some different requirements. In order to meet these requirements, the designers of Windows CE have made changes to some of the classes in the library.

For an alphabetical listing of the classes that have been modified for use under Windows CE, see Modified MFC Classes.

For an alphabetical listing of all the classes that MFC for Windows CE supports exactly the same way standard MFC supports them, see Fully Supported MFC Classes.

For a list of MFC classes that Windows CE does not support, see Unsupported MFC Classes.

For a list of MFC global functions and messages that are specific to Windows CE, see Windows CE-Specific MFC API Functions & Messages.

For a list of supported and unsupported MFC global functions, see MFC Global Functions.

For a list of supported and unsupported structures used in MFC, see Structures Used in MFC.

For a listing of classes by category, see Classes Derived from CObject and Classes Not Derived from CObject, and the Top Level Hierarchy Chart.

The MFC for Windows CE Reference contains documentation for all Microsoft Foundation Classes supported in the following released versions of Windows CE:

  • Windows CE version 1.0
  • Windows CE version 1.01
  • Windows CE version 2.0
  • Unless otherwise noted, all documented API elements are present in version 2.0.

Each reference topic includes an At a Glance table containing the following information.

At a Glance

Header file: | Header file in which the class is defined.
Platforms: | Targeted platforms.
Windows CE versions: | Windows CE versions that include this API element.
Complete documentation: | Link to the complete documentation as originally published. Usually, this is a link to the Microsoft Platform SDK documentation.

When there is a link to original documentation, comments in the Remarks section are specific to Windows CE.


CArchive

The CArchive class allows you to save a complex network of objects in a permanent binary form (usually disk storage) that persists after those objects are deleted.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Member Functions, CArchive Operators,, CArchive Data Members, Run-Time Object Model Support, CFile


CArchive Member Functions

Construction |
CArchive | Creates a CArchive object.
Close | Flushes unwritten data and disconnects from the CFile.
Abort | Closes the archive without throwing an exception.
Basic Input/Output |
Flush | Flushes unwritten data from the archive buffer.
Read | Reads raw bytes.
Write | Writes raw bytes.
WriteString | Writes a single line of text.
ReadString | Reads a single line of text.
Status |
GetFile | Gets the CFile object pointer for this archive.
GetObjectSchema | Called from the Serialize function to determine the version of the object that is being deserialized.
SetObjectSchema | Sets the object schema stored in the archive object.
IsLoading | Determines whether the archive is loading.
IsStoring | Determines whether the archive is storing.
IsBufferEmpty | Determines whether the buffer has been emptied during a Windows Sockets receive process.
Object Input/Output |
ReadObject | Calls an object's Serialize function for loading.
WriteObject | Calls an object's Serialize function for storing.
MapObject | Places objects in the map that are not serialized to the file, but that are available for subobjects to reference.
SetStoreParams | Sets the hash table size and the block size of the map used to identify unique objects during the serialization process.
SetLoadParams | Sets the size to which the load array grows. Must be called before any object is loaded or before MapObject or ReadObject is called.
ReadClass | Reads a class reference previously stored with WriteClass.
WriteClass | Writes a reference to the CRuntimeClass to the CArchive.
SerializeClass | Reads or writes the class reference to the CArchive object depending on the direction of the CArchive.

See Also

CArchive Overview, CArchive Operators,, CArchive Data Members


CArchive::Abort

This member function closes the archive without throwing an exception. The CArchive destructor will normally call CArchive::Close, which will flush any data that has not been saved to the associated CFile object. This can cause exceptions.

Syntax

void Abort( );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Close, CArchive::Flush


CArchive::CArchive

This constructor constructs a CArchive object and specify whether it will be used for loading or storing objects. You cannot change this specification after you have created the archive.

Syntax

CArchive( CFile* pFile, UINT nMode, int nBufSize = 512, void* lpBuf = NULL); throw( CMemoryException, CArchiveException, CFileException);

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Close, CArchive::Flush, CFile::Close


CArchive::Close

This member function flushes any data remaining in the buffer, closes the archive, and disconnects the archive from the file.

Syntax

void Close( );
throw( CArchiveException, CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Flush


CArchive::Flush

This member function forces any data remaining in the archive buffer to be written to the file.

Syntax

void Flush( );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Close, CFile::Flush, CFile::Close


CArchive::GetFile

This member function obtains the CFile object pointer for this archive. You must flush the archive before using GetFile.

Syntax

CFile* GetFile( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Flush


CArchive::GetObjectSchema

This member function from the Serialize function determines the version of the object that is currently being deserialized.

Syntax

UINT GetObjectSchema( );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CObject::Serialize, CObject::IsSerializable, CArchive::IsLoading


CArchive::IsBufferEmpty

This member function determines whether the archive object's internal buffer is empty.

Syntax

BOOL IsBufferEmpty( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support


CArchive::IsLoading

This member function determines whether the archive is loading data, and is called by the Serialize functions of the archived classes.

Syntax

BOOL IsLoading( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::IsStoring


CArchive::IsStoring

This member function determines whether the archive is storing data, and is called by the Serialize functions of the archived classes.

Syntax

BOOL IsStoring( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::IsLoading


CArchive::MapObject

This member function places objects in the map that are not really serialized to the file, but that are available for subobjects to reference.

Syntax

void MapObject( const CObject* pOb );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::ReadObject, CArchive::WriteObject


CArchive::Read

This member function reads a specified number of bytes from the archive. The archive does not interpret the bytes.

Syntax

UINT Read( void* lpBuf, UINT nMax );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support


CArchive::ReadClass

This member function reads a reference to a class previously stored with WriteClass.

Syntax

CRuntimeClass* ReadClass( const CRuntimeClass* pClassRefRequested = NULL, UINT* pSchema = NULL, DWORD* obTag = NULL );
Throw CArchiveException;
Throw CNotSupportedException;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::WriteClass, CArchive::GetObjectSchema, CArchive::SetObjectSchema, CArchiveException, CNotSupportedException, CArchive::SerializeClass


CArchive::ReadObject

This member function reads object data from the archive and constructs an object of the appropriate type.

Syntax

CObject* ReadObject( const CRuntimeClass* pClass );
throw( CFileException, CArchiveException, CMemoryException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::WriteObject, CObject::IsKindOf


CArchive::ReadString

This member function reads text data into a buffer from the file associated with the CArchive object.

Syntax

Bool ReadString(CString& rString );
LPTSTR ReadString( LPTSTR lpsz, UINT nMax );
throw( CArchiveException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Read, CArchive::Write, CArchive::WriteString, CArchiveException


CArchive::SerializeClass

This member function stores and loads the version information of a base class.

Syntax

void SerializeClass( const CRuntimeClass* pRuntimeClass );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::ReadClass, CArchive::WriteClass, CArchive::GetObjectSchema, CArchive::SetObjectSchema, CArchiveException, CNotSupportedException


CArchive::SetLoadParams

This member function reads a large number of CObject-derived objects from an archive.

Syntax

void SetLoadParams( UINT nGrowBy = 1024 );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::SetStoreParams


CArchive::SetObjectSchema

This member function sets the object schema stored in the archive object to nSchema.

Syntax

void SetObjectSchema( UINT nSchema );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::GetObjectSchema


CArchive::SetStoreParams

This member function stores a large number of CObject-derived objects in an archive.

Syntax

void SetStoreParams( UINT nHashSize = 2053, UINT nBlockSize = 128 );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::SetLoadParams


CArchive::Write

This member function writes a specified number of bytes to the archive. The archive does not format the bytes.

Syntax

void Write( const void* lpBuf, UINT nMax );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Read


CArchive::WriteClass

This member function stores the version and class information of a base class during serialization of the derived class.

Syntax

void WriteClass( const CRuntimeClass* pClassRef );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::ReadClass, CArchive::GetObjectSchema, CArchive::SetObjectSchema, CArchive::SerializeClass, CArchiveException, CNotSupportedException


CArchive::WriteObject

This member function stores the specified CObject to the archive.

Syntax

void WriteObject( const CObject* pOb );
throw( CFileException, CArchiveException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::ReadObject


CArchive::WriteString

This member function writes data from a buffer to the file associated with the CArchive object.

Syntax

void WriteString( LPCTSTR lpsz );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Member Functions, Run-Time Object Model Support, CArchive::Write, CArchive::Read, CArchive::ReadString, CFileException


CArchive Operators

Basic Input/Output |
operator << | Stores objects and primitive types to the archive.
operator >> | Loads objects and primitive types from the archive.

See Also

CArchive Overview, CArchive Member Functions, CArchive Data Members


CArchive::operator <<

This operator stores the indicated object or primitive type to the archive.

friend CArchive& operator <<( CArchive& ar, const CObject* pOb );
throw( CArchiveException, CFileException );

CArchive& operator <<( BYTE by );
throw( CArchiveException, CFileException );

CArchive& operator <<( WORD w );
throw( CArchiveException, CFileException );

CArchive& operator <<( LONG l );
throw( CArchiveException, CFileException );

CArchive& operator <<( DWORD dw );
throw( CArchiveException, CFileException );

CArchive& operator <<( float f );
throw( CArchiveException, CFileException );

CArchive& operator <<( double d );
throw( CArchiveException, CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Operators,, Run-Time Object Model Support, CArchive::WriteObject, CObject::Serialize


CArchive::operator >>

This operator loads the indicated object or primitive type from the archive.

friend CArchive& operator >>( CArchive& ar, CObject *& pOb );
throw( CArchiveException, CFileException, CMemoryException );

friend CArchive& operator >>( CArchive& ar, const CObject *& pOb );
throw( CArchiveException, CFileException, CMemoryException );

CArchive& operator >>( BYTE& by );
throw( CArchiveException, CFileException );

CArchive& operator >>( WORD& w );
throw( CArchiveException, CFileException );

CArchive& operator >>( LONG& l );
throw( CArchiveException, CFileException );

CArchive& operator >>( DWORD& dw );
throw( CArchiveException, CFileException );

CArchive& operator >>( float& f );
throw( CArchiveException, CFileException );

CArchive& operator >>( double& d );
throw( CArchiveException, CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Operators,, Run-Time Object Model Support, CArchive::ReadObject, CObject::Serialize


CArchive Data Members

Data Members |
m_pDocument | Points to the CDocument object being serialized.

See Also

CArchive Overview, CArchive Member Functions, CArchive Operators,


CArchive::m_pDocument

This data member contains a pointer to a CDocument. You can use this pointer to convey additional information about the serialization process to all objects being serialized. Initialize the pointer, with the document that's being serialized, in such a way that objects within the document can access the document if necessary.

CDocument m_pDocument;

At a Glance

Header file: Afx.h
Platforms: !klink(m_pDocument)
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchive Overview, CArchive Data Members, Run-Time Object Model Support, CDocument


CArchiveException

A CArchiveException object represents a serialization exception condition. The CArchiveException class includes a public data member that indicates the cause of the exception.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Exception Classes, CArchiveException Member Functions, CArchiveException Data Members, CArchive


CArchiveException Member Functions

Construction |
CArchiveException | Constructs a CArchiveException object.

See Also

CArchiveException Overview, CArchiveException Data Members, Exception Classes


CArchiveException::CArchiveException

This member function constructs a CArchiveException object, storing the value of cause in the object.

Syntax

CArchiveException( int cause = CArchiveException::none );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchiveException Overview, CArchiveException Member Functions, Exception Classes


CArchiveException Data Members

Data Members |
m_cause | Indicates the exception cause.

See Also

CArchiveException Overview, CArchiveException Member Functions, CArchive, Exception Classes


CArchiveException::m_cause

The m_cause data member contains an integer whose value specifies the cause of the exception. Its values are defined by a CArchiveException enumerated type. See the Visual C++ documentation for details.

int m_cause;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArchiveException Overview, CArchiveException Data Members, Exception Classes


CArray

The CArray class supports arrays that are similar to C arrays, but can dynamically shrink and grow as necessary.

template< class TYPE, class ARG_TYPE > class CArray : public CObject

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Member Functions, CArray Operators, CObArray


CArray Member Functions

Construction |
CArray | Constructs an empty array.
Attributes |
GetSize | Gets the number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.
Operations |
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.
Element Access |
GetAt | Returns the value at a given index.
SetAt | Sets the value for a given index; array not allowed to grow.
ElementAt | Returns a temporary reference to the element pointer within the array.
GetData | Allows access to elements in the array. Can be NULL.
Growing the Array |
SetAtGrow | Sets the value for a given index; grows the array if necessary.
Add | Adds an element to the end of the array; grows the array if necessary.
Append | Appends another array to the array; grows the array if necessary
Copy | Copies another array to the array; grows the array if necessary.
Insertion/Removal |
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.

See Also

CArray Overview, CArray Operators


CArray::Add

This member function adds a new element to the end of an array, growing the array by one.

Syntax

int Add( ARG_TYPE newElement );
throw( CMemoryException );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::SetAt, CArray::SetAtGrow, CArray::InsertAt, CArray::operator []


CArray::Append

This member function adds the contents of one array to the end of another. The arrays must be of the same type.

Syntax

int Append( const CArray& src );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::Copy


CArray::CArray

This constructor constructs an empty array. The array grows one element at a time.

Syntax

CArray( );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CObArray::CObArray


CArray::Copy

This member function overwrites the elements of one array with the elements of another array.

Syntax

void Copy( const CArray& src );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::Append


CArray::ElementAt

This member function retrieves a temporary reference to the specified element within the array, and implements the left-side assignment operator for arrays.

Syntax

TYPE& ElementAt( int nIndex );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::operator []


CArray::FreeExtra

This member function frees any extra memory that was allocated while the array was grown. This function has no effect on the size or upper bound of the array.

Syntax

void FreeExtra( );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview


CArray::GetAt

This member function retrieves the array element at the specified index.

Syntax

TYPE GetAt( int nIndex ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::SetAt, CArray::operator []


CArray::GetData

This member function gains direct access to the elements in an array. If no elements are available, GetData returns a null value.

Syntax

const TYPE* GetData( ) const;
TYPE* GetData( );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::GetAt, CArray::SetAt, CArray::ElementAt


CArray::GetSize

This member function retrieves the size of the array. Since indexes are zero-based, the size is 1 greater than the largest index.

Syntax

int GetSize( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::GetUpperBound, CArray::SetSize


CArray::GetUpperBound

This member function retrieves the current upper bound of this array. Because array indexes are zero-based, this function returns a value 1 less than GetSize.

Syntax

int GetUpperBound( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::GetSize, CArray::SetSize


CArray::InsertAt

The first version of InsertAt inserts one element (or multiple copies of an element) at a specified index in an array. In the process, it shifts up (by incrementing the index) the existing element at this index, and it shifts up all the elements above it.

The second version inserts all the elements from another CArray collection, starting at the nStartIndex position.

The SetAt function, in contrast, replaces one specified array element and does not shift any elements.

Syntax

void InsertAt( int nIndex, ARG_TYPE newElement, int nCount = 1 );
throw( CMemoryException );

void InsertAt( int nStartIndex, CArray* pNewArray );
throw( CMemoryException );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, GetUpperBound, CArray::SetAt, CArray::RemoveAt


CArray::RemoveAll

This member function removes all the elements from this array. If the array is already empty, the function still works.

Syntax

void RemoveAll( );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions


CArray::RemoveAt

This member function removes one or more elements starting at a specified index in an array. In the process, it shifts down all the elements above the removed element(s).

Syntax

void RemoveAt( int nIndex, int nCount = 1 );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::SetAt, CArray::SetAtGrow, CArray::InsertAt


CArray::SetAt

This member function sets the array element at the specified index. SetAt will not cause the array to grow; use SetAtGrow if you want the array to grow automatically.

Syntax

void SetAt( int nIndex, ARG_TYPE newElement );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::GetAt, CArray::SetAtGrow, CArray::ElementAt, CArray::operator []


CArray::SetAtGrow

This member function sets the array element at the specified index. The array grows automatically if necessary (that is, the upper bound is adjusted to accommodate the new element).

Syntax

void SetAtGrow( int nIndex, ARG_TYPE newElement );
throw( CMemoryException );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::GetAt, CArray::SetAt, CArray::ElementAt, CArray::operator []


CArray::SetSize

This member function establishes the size of an empty or existing array; allocating memory if necessary.

If the new size is smaller than the old size, then the array is truncated and all unused memory is released.

Syntax

void SetSize( int nNewSize, int nGrowBy = –1 );
throw( CMemoryException );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Member Functions, CArray::GetUpperBound, CArray::GetSize


CArray Operators

Operators |
operator [] | Sets or gets the element at the specified index.

See Also

CArray Overview, CArray Member Functions, Array Classes


CArray::operator [ ]

These subscript operators are a convenient substitute for the SetAt and GetAt functions.

The first operator, called for arrays that are not const, may be used on either the right (r-value) or the left (l-value) of an assignment statement. The second, called for const arrays, may be used only on the right.

TYPE& operator []( int nIndex );

TYPE operator []( int nIndex ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CArray Overview, CArray Operators, CArray::GetAt, CArray::SetAt, CArray::ElementAt


CAsyncSocket

A CAsyncSocket object represents a Windows Socket, which is an endpoint of network communication. The CAsyncSocket class encapsulates the Windows Sockets API, providing an object-oriented abstraction for programmers who want to use Windows Sockets in conjunction with MFC.

Windows CE does not support asynchronous event notification so, when writing an application for Windows CE, you should use the new CCeSocket class, instead of CAsyncSocket. The CCeSocket class enables Windows CE applications to send and receive socket notifications for certain asynchronous events.

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

Remarks

MFC for Windows CE does not fully support asynchronous event notification, so it does not support the AsyncSelect member function of the CAsyncSocket class. It also does not support the lEvent parameter of the CAsyncSocket::Attach member function. The new CCeSocket class does support asynchronous notification for certain socket events.

You should always use the new CCeSocket class, instead of CAsyncSocket, when writing applications for Windows CE.

MFC for Windows CE does not support the GetLastError member function of the CAsyncSocket class. Use the global ::GetLastError function instead.

See Also

CAsyncSocket Member Functions, CAsyncSocket Data Members, Windows Sockets Classes, CAsyncSocket::Attach, CCeSocket, CSocket, :: GetLastError


CAsyncSocket Member Functions

Construction |
CAsyncSocket | Constructs a CAsyncSocket object.
Create | Creates a socket.
Attributes |
Attach | Attaches a SOCKET handle to a CAsyncSocket object.
Detach | Detaches a socket handle from a CAsyncSocket object.
FromHandle | Returns a pointer to a CasyncSocket object, given a SOCKET handle.
GetPeerName | Gets the address of the peer socket to which the socket is connected.
GetSockName | Gets the local name for a socket.
GetSockOpt | Retrieves a socket option.
SetSockOpt | Sets a socket option.
Operations |
Accept | Accepts a connection on the socket.
Bind | Associates a local address with the socket.
Close | Closes the socket.
Connect | Establishes a connection to a peer socket.
IOCtl | Controls the mode of the socket.
Listen | Establishes a socket to listen for incoming connection requests.
Receive | Receives data from the socket.
ReceiveFrom | Receives a datagram and stores the source address.
Send | Sends data to a connected socket.
SendTo | Sends data to a specific destination.
ShutDown | Disables Send and/or Receive calls on the socket.
Overridable Notification Functions |
OnAccept | Notifies a listening socket that it can accept pending connection requests by calling Accept.
OnClose | Notifies a socket that the socket connected to it has closed.
OnConnect | Notifies a connecting socket that the connection attempt is complete, whether successfully or in error.
OnOutOfBandData | Notifies a receiving socket that there is out-of-band data to be read on the socket, usually an urgent message.
OnReceive | Notifies a listening socket that there is data to be retrieved by calling Receive.
OnSend | Notifies a socket that it can send data by calling Send.

See Also

CAsyncSocket Overview, CAsyncSocket Data Members, Windows Sockets Classes


CAsyncSocket::Accept

This member function accepts a connection on a socket. This routine extracts the first connection in the queue of pending connections, creates a new socket with the same properties as this socket, and attaches it to rConnectedSocket. The accepted socket (rConnectedSocket) cannot be used to accept more connections. The original socket remains open and listening. If no pending connections are present on the queue, Accept returns zero and ::GetLastError returns an error.

Syntax

virtual BOOL Accept( CAsyncSocket& rConnectedSocket, SOCKADDR* lpSockAddr = NULL, int* lpSockAddrLen = NULL );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Bind, CAsyncSocket::Connect, CAsyncSocket::Listen, CAsyncSocket::Create, :: GetLastError


CAsyncSocket::CAsyncSocket

This constructor constructs a blank socket object. After constructing the object, you must call its Create member function to create the SOCKET data structure and bind its address. (On the server side of a Windows Sockets communication, when the listening socket creates a socket to use in the Accept call, do not call Create for that socket.)

Syntax

CAsyncSocket( );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Create


CAsyncSocket::Attach

This member function attaches an hSocket handle to the CAsyncSocket object. The SOCKET handle is stored in the object's m_hSocket data member.

Syntax

BOOL Attach( SOCKET hSocket );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

Remarks

Because Windows CE does not fully support asynchronous event notification, MFC for Windows CE does not support the lEvent parameter to this function.

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Detach, CAsyncSocket::m_hSocket


CAsyncSocket::Bind

This member function associates a local address with the socket. Before it can accept connection requests, a listening server socket must select a port number and make it known to Windows Sockets by calling Bind. Bind establishes the local association (host address/port number) of the socket by assigning a local name to an unnamed socket.

Syntax

BOOL Bind( UINT nSocketPort, LPCTSTR lpszSocketAddress = NULL );

BOOL Bind ( const SOCKADDR* lpSockAddr, int nSockAddrLen );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Connect, CAsyncSocket::Listen, CAsyncSocket::GetSockName, CAsyncSocket::SetSockOpt, CAsyncSocket::Create


CAsyncSocket::Close

This member function closes the socket. This function releases the socket descriptor, so further references to it will fail with the error WSAENOTSOCK. If this is the last reference to the underlying socket, the associated naming information and queued data are discarded. The socket object's destructor calls Close for you.

Syntax

virtual void Close( );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Accept, CAsyncSocket::CAsyncSocket, CAsyncSocket::IOCtl, CAsyncSocket::GetSockOpt, CAsyncSocket::SetSockOpt


CAsyncSocket::Connect

This member function establishes a connection to an unconnected stream or datagram socket. If the socket is unbound, unique values are assigned to the local association by the system, and the socket is marked as bound. Note that if the address field of the name structure is all zeroes, Connect will return zero. To get extended error information, call the ::GetLastError function.

Syntax

BOOL Connect( LPCTSTR lpszHostAddress, UINT nHostPort );

BOOL Connect( const SOCKADDR* lpSockAddr, int nSockAddrLen );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Accept, CAsyncSocket::CAsyncSocket, CAsyncSocket::IOCtl, CAsyncSocket::GetSockOpt, CAsyncSocket::SetSockOpt, :: GetLastError


CAsyncSocket::Create

This member function, after constructing a socket object, creates the Windows socket and attaches it. Create then calls the Bind function to bind the socket to the specified address.

Syntax

BOOL Create( UINT nSocketPort = 0, int nSocketType = SOCK_STREAM, long lEvent = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE, LPCTSTR lpszSocketAddress = NULL );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Accept, CAsyncSocket::Bind, CAsyncSocket::Connect, CAsyncSocket::CAsyncSocket, CAsyncSocket::GetSockName, CAsyncSocket::IOCtl, CAsyncSocket::Listen, CAsyncSocket::Receive, CAsyncSocket::Send, CAsyncSocket::ShutDown


CAsyncSocket::Detach

This member function detaches the SOCKET handle in the m_hSocket data member from the CAsyncSocket object and sets m_hSocket to NULL.

Syntax

SOCKET Detach( );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Attach, CAsyncSocket::m_hSocket


CAsyncSocket::FromHandle

This member function obtains a pointer to a CAsyncSocket object, when you have a handle to the socket.

Syntax

static CAsyncSocket* PASCAL FromHandle( SOCKET hSocket );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Attach, CAsyncSocket::Detach


CAsyncSocket::GetPeerName

This member function retrieves the address of the peer socket to which this socket is connected.

Syntax

BOOL GetPeerName( CString& rPeerAddress, UINT& rPeerPort );

BOOL GetPeerName( SOCKADDR* lpSockAddr, int* lpSockAddrLen );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Bind, CAsyncSocket::Connect, CAsyncSocket::Create, CAsyncSocket::GetSockName


CAsyncSocket::GetSockName

This member function retrieves the local name for a socket.

Syntax

BOOL GetSockName( CString& rSocketAddress, UINT& rSocketPort );

BOOL GetSockName( SOCKADDR* lpSockAddr, int* lpSockAddrLen );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Bind, CAsyncSocket::Create, CAsyncSocket::GetPeerName


CAsyncSocket::GetSockOpt

This member function retrieves the current value for a socket option associated with the socket.

Syntax

BOOL GetSockOpt( int nOptionName, void* lpOptionValue, int* lpOptionLen, int nLevel = SOL_SOCKET );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::SetSockOpt


CAsyncSocket::IOCtl

This member function retrieves operating parameters associated with the socket, independent of the protocol and communications subsystem.

Syntax

BOOL IOCtl( long lCommand, DWORD* lpArgument );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Create, CAsyncSocket::GetSockOpt, CAsyncSocket::SetSockOpt


CAsyncSocket::Listen

This member function sets up the socket to listen for incoming connection requests.

Syntax

BOOL Listen( int nConnectionBacklog = 5 );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Accept, CAsyncSocket::Connect, CAsyncSocket::Create


CAsyncSocket::OnAccept

This member function is called by the framework to notify a listening socket that it can accept pending connection requests. Override this member function if you want to do some special processing.

Syntax

virtual void OnAccept ( int nErrorCode );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Accept, CAsyncSocket::OnClose, CAsyncSocket::OnConnect, CAsyncSocket::OnOutOfBandData, CAsyncSocket::OnReceive, CAsyncSocket::OnSend, ::GetLastError


CAsyncSocket::OnClose

This member function is called by the framework to notify this socket that the socket to which it was connected was closed by its process. Override this member function if you want to do some special processing.

Syntax

virtual void OnClose( int nErrorCode );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Close, CAsyncSocket::OnAccept, CAsyncSocket::OnConnect, CAsyncSocket::OnOutOfBandData, CAsyncSocket::OnReceive, CAsyncSocket::OnSend, ::GetLastError


CAsyncSocket::OnConnect

This member function is called by the framework to notify the socket that its connection attempt has completed, whether successfully or in error. Override this member function if you want to do some special processing.

Syntax

virtual void OnConnect( int nErrorCode );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Connect, CAsyncSocket::OnAccept, CAsyncSocket::OnClose, CAsyncSocket::OnOutOfBandData, CAsyncSocket::OnReceive, CAsyncSocket::OnSend, ::GetLastError


CAsyncSocket::OnOutOfBandData

This member function is called by the framework to notify the receiving socket that the sending socket has out-of-band data to send. Out-of-band data is a logically independent channel that is associated with each pair of connected sockets of type SOCK_STREAM. The channel is generally used to send urgent data. Override this member function if you want to do some special processing.

Syntax

virtual void OnOutOfBandData( int nErrorCode );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::OnAccept, CAsyncSocket::OnClose, CAsyncSocket::OnConnect, CAsyncSocket::OnReceive, CAsyncSocket::OnSend, ::GetLastError


CAsyncSocket::OnReceive

This member function is called by the framework to notify the socket that there is data in the buffer that can be retrieved by calling the Receive member function. Override this member function if you want to do some special processing.

Syntax

virtual void OnReceive( int nErrorCode );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::OnAccept, CAsyncSocket::OnClose, CAsyncSocket::OnConnect, CAsyncSocket::OnOutOfBandData, CAsyncSocket::OnSend, CAsyncSocket::Receive, ::GetLastError


CAsyncSocket::OnSend

This member function is called by the framework to notify the socket that it can now send data by calling the Send member function. Override this member function if you want to do some special processing.

Syntax

virtual void OnSend( int nErrorCode );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::OnAccept, CAsyncSocket::OnClose, CAsyncSocket::OnConnect, CAsyncSocket::OnOutOfBandData, CAsyncSocket::OnReceive, CAsyncSocket::Send, ::GetLastError


CAsyncSocket::Receive

This member function reads incoming data from a connected stream or datagram socket.

Syntax

virtual int Receive( void* lpBuf, int nBufLen, int nFlags = 0 );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Create, CAsyncSocket::ReceiveFrom, CAsyncSocket::Send


CAsyncSocket::ReceiveFrom

This member function reads incoming data on a (possibly connected) socket and captures the address from which the data was sent.

Syntax

int ReceiveFrom( void* lpBuf, int nBufLen, CString& rSocketAddress, UINT& rSocketPort, int nFlags = 0 );

int ReceiveFrom( void* lpBuf, int nBufLen, SOCKADDR* lpSockAddr, int* lpSockAddrLen, int nFlags = 0 );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Create, CAsyncSocket::Receive, CAsyncSocket::Send


CAsyncSocket::Send

This member function writes outgoing data on a connected stream or datagram socket.

Syntax

virtual int Send( const void* lpBuf, int nBufLen, int nFlags = 0 );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Create, CAsyncSocket::Receive, CAsyncSocket::ReceiveFrom, CAsyncSocket::SendTo


CAsyncSocket::SendTo

This member function writes outgoing data on a connected stream or datagram socket, and sends it to a specific destination.

Syntax

int SendTo( const void* lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress = NULL, int nFlags = 0 );

int SendTo( const void* lpBuf, int nBufLen, const SOCKADDR* lpSockAddr, int nSockAddrLen, int nFlags = 0 );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Create, CAsyncSocket::Receive, CAsyncSocket::ReceiveFrom, CAsyncSocket::Send


CAsyncSocket::SetSockOpt

This member function sets the current value for a socket option associated with the socket.

Syntax

BOOL SetSockOpt( int nOptionName, const void* lpOptionValue, int nOptionLen, int nLevel = SOL_SOCKET );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Bind, CAsyncSocket::Create, CAsyncSocket::GetSockOpt, CAsyncSocket::IOCtl


CAsyncSocket::ShutDown

This member function disables reception, transmission, or both on a socket.

Syntax

BOOL ShutDown( int nHow = sends );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Connect, CAsyncSocket::Create


CAsyncSocket Data Members

Data Members |
m_hSocket | Indicates the SOCKET handle attached to this CAsyncSocket object.

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes


CAsyncSocket::m_hSocket

This data member contains the SOCKET handle for the socket encapsulated by this CAsyncSocket object.

SOCKET m_hSocket;

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Data Members, Windows Sockets Classes


CBitmap

The CBitmap class encapsulates the functionality of a Windows graphics device interface (GDI) bitmap, which is an array of bits that contains data describing the colors in a rectangular region on the screen or printer.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE supports the following member functions of the CBitmap class differently than the standard MFC library does.

CBitmap::CreateBitmap

CBitmap::LoadBitmap

CBitmap::LoadOEMBitmap

MFC for Windows CE does not support the following CBitmap member functions.

CreateDiscardableBitmap

GetBitmapBits

LoadMappedBitmap

SetBitmapBits

Note Because Windows CE 1.0 only supports black, white, light gray, and dark gray, you have to use the 2-bits per pixel (2bp) format for all bitmaps, if you're using version 1.0

See Also

CBitmap Member Functions, CBitmap Operators, Graphical Drawing Object Classes


CBitmap Member Functions

Construction |
CBitmap | Constructs a CBitmap object.
Initialization |  |
LoadBitmap |  | Initializes the object by loading a named bitmap resource from the application's executable file and attaching the bitmap to the object.
LoadOEMBitmap |  | Initializes the object by loading a predefined Windows bitmap and attaching the bitmap to the object.
CreateBitmap |  | Initializes the object with a device-dependent memory bitmap that has a specified width, height, and bit pattern.
CreateBitmapIndirect |  | Initializes the object with a bitmap with the width, height, and bit pattern (if one is specified) given in a BITMAP structure.
CreateCompatibleBitmap |  | Initializes the object with a bitmap so that it is compatible with a specified device.
Attributes |
GetBitmap | Returns a pointer to the specified CBitmap object.
Operations |
FromHandle | Returns a pointer to a CBitmap object when given a handle to a Windows HBITMAP bitmap.
SetBitmapDimension | Assigns a width and height to a bitmap in 0.1-millimeter units.
GetBitmapDimension | Returns the width and height of the bitmap. The height and width are assumed to have been set previously by the SetBitmapDimension member function.

See Also

CBitmap Overview, CBitmap Operators, Graphical Drawing Object Classes


CBitmap::CBitmap

This member function constructs a CBitmap object. The resulting object must be initialized with one of the initialization member functions.

Syntax

CBitmap( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes, CBitmap::LoadBitmap, CBitmap::LoadOEMBitmap, CBitmap::CreateBitmap, CBitmap::CreateBitmapIndirect, CBitmap::CreateCompatibleBitmap


CBitmap::CreateBitmap

This member function initializes a device-dependent memory bitmap with the specified width, height, and bit pattern.

Syntax

BOOL CreateBitmap ( int nWidth, int nHeight, UINT nPlanes, UINT nBitcount, const void* lpBits );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Because Windows CE 1.0 only supports gray scale bitmaps, you have to set the nPlanes parameter to 1 and the nBitCountl parameter to either 1 or 2 if you are targeting a Windows CE 1.0 platform.

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes, CDC::SelectObject, CGdiObject::DeleteObject, CDC::BitBlt


CBitmap::CreateBitmapIndirect

This member function initializes a bitmap that has the width, height, and bit pattern (if one is specified) given in the structure pointed to by lpBitmap.

Syntax

BOOL CreateBitmapIndirect( LPBITMAP lpBitmap );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes, CDC::SelectObject, CDC::BitBlt, CGdiObject::DeleteObject


CBitmap::CreateCompatibleBitmap

This member function initializes a bitmap that is compatible with the device specified by pDC.

Syntax

BOOL CreateCompatibleBitmap( CDC* pDC, int nWidth, int nHeight );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes, CGdiObject::DeleteObject


CBitmap::FromHandle

This member function obtains a pointer to a CBitmap object when you have a handle to a Windows GDI bitmap.

Syntax

static CBitmap* PASCAL FromHandle( HBITMAP hBitmap );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes


CBitmap::GetBitmap

This member function retrieves information about a CBitmap object.

Syntax

int GetBitmap( BITMAP* pBitMap );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes


CBitmap::GetBitmapDimension

This member function obtains the width and height of the bitmap.

Syntax

CSize GetBitmapDimension( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes, CBitmap::SetBitmapDimension


CBitmap::LoadBitmap

This member function loads the bitmap resource named by lpszResourceName, or identified by the ID number in nIDResource, from the application's executable file. The loaded bitmap is attached to the CBitmap object.

Syntax

BOOL LoadBitmap ( LPCTSTR lpszResourceName );

BOOL LoadBitmap ( UINT nIDResource );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, when you initialize a CBitmap object by using the CBitmap::LoadBitmap member function, the bitmap is read-only. This is because Windows CE doesn't copy the bitmap into RAM, as Windows 95 and Windows NT do. In Windows CE, the bitmap only exists in a resource, which is part of the program's executable file. When you select the bitmap into a device context, you cannot modify the device context (for instance, by drawing text into it) because that would require the ability to write to the bitmap.

Windows CE does not support any predefined bitmaps, so you can not use any of the OBM_* values in the lpszResourceName parameter.

Windows CE 1.0 only supports a 2 bit gray scale palette so, in version 1.0, you can only use one bit per pixel (monochrome .bmp) or two bit per pixel (.2bp) bitmaps.

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes, CBitmap::LoadOEMBitmap, CGdiObject::DeleteObject


CBitmap::LoadOEMBitmap

This member function loads the bitmap resource identified by the ID number in the nIDBitmap parameter from the application's executable file.

Syntax

BOOL LoadOEMBitmap ( UINT nIDBitmap );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support OEM bitmaps, but MFC for Windows CE supports the CBitmap::LoadOEMBitmap member function for compatibility with existing code. In Windows CE, this function just calls CBitmap::LoadBitmap.

See Also

CBitmap Overview, CBitmap Member Functions, Graphical Drawing Object Classes, CBitmap::LoadBitmap


CBitmap::SetBitmapDimension

This member function assigns a width and height to a bitmap in 0.1-millimeter units.

Syntax

CSize SetBitmapDimension( int nWidth, int nHeight );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Member Functions, CBitmap Member Functions, Graphical Drawing Object Classes, CBitmap::GetBitmapDimension


CBitmap Operators

Attributes |
operator HBITMAP | Returns the Windows handle attached to the CBitmap object.

See Also

CBitmap Overview, CBitmap Member Functions Graphical Drawing Object Classes


CBitmap::operator HBITMAP

This operator gets the attached Windows GDI handle to the CBitmap object. This operator is a casting operator, which supports direct use of an HBITMAP object.

Syntax

operator HBITMAP( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmap Overview, CBitmap Operators, Graphical Drawing Object Classes


CBitmapButton

Use the CBitmapButton class to create pushbutton controls labeled with bitmapped images instead of text.

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmapButton Member Functions, Control Classes, CButton, CBitmapButton::AutoLoad, CToolBar


CBitmapButton Member Functions

Construction |
CBitmapButton | Constructs a CBitmapButton object.
LoadBitmaps | Initializes the object by loading one or more named bitmap resources from the application's resource file and attaching the bitmaps to the object.
AutoLoad | Associates a button in a dialog box with an object of the CBitmapButton class, loads the bitmap(s) by name, and sizes the button to fit the bitmap.
Operations |  |
SizeToContent |  | Sizes the button to accommodate the bitmap.

See Also

CBitmapButton Overview, Control Classes


CBitmapButton::AutoLoad

This member function associates a button in a dialog box with an object of the CBitmapButton class. This function loads the bitmap(s) by name, and sizes the button to fit the bitmap.

Syntax

BOOL AutoLoad( UINT nID, CWnd* pParent );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmapButton Overview, CBitmapButton Member Functions, Control Classes, CBitmapButton::LoadBitmaps, CBitmapButton::SizeToContent


CBitmapButton::CBitmapButton

This constructor constructs a CBitmapButton object.

Syntax

CBitmapButton( );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmapButton Overview, CBitmapButton Member Functions, Control Classes, CBitmapButton::LoadBitmaps, CBitmapButton::AutoLoad, CBitmapButton::SizeToContent, CButton::Create


CBitmapButton::LoadBitmaps

This function loads bitmap images identified by their resource names or identifier numbers, or when you cannot use the AutoLoad function. For example, you could use this function if you are creating a bitmap button that is not part of a dialog box.

Syntax

BOOL LoadBitmaps( LPCTSTR lpszBitmapResource, LPCTSTR lpszBitmapResourceSel = NULL, LPCTSTR lpszBitmapResourceFocus = NULL, LPCTSTR lpszBitmapResourceDisabled = NULL );

BOOL LoadBitmaps( UINT nIDBitmapResource, UINT nIDBitmapResourceSel = 0, UINT nIDBitmapResourceFocus = 0, UINT nIDBitmapResourceDisabled = 0 );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmapButton Overview, CBitmapButton Member Functions, Control Classes, CBitmapButton::AutoLoad, CBitmapButton::SizeToContent, CButton::Create, CBitmap::LoadBitmap


CBitmapButton::SizeToContent

This member function resizes a bitmap button to the size of the bitmap.

Syntax

void SizeToContent( );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBitmapButton Overview, CBitmapButton Member Functions, Control Classes, CBitmapButton::LoadBitmaps, CBitmapButton::AutoLoad


CBrush

The CBrush class encapsulates the functionality of a Windows graphics device interface (GDI) brush, which is a bitmap that is used to fill the interior of closed shapes.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE supports the following member functions differently than the standard MFC library does.

CBrush::CreateBrushIndirect

CBrush::CreateDIBPatternBrush

CBrush::CreateSysColorBrush

MFC for Windows CE only supports three of the four constructor functions for the CBrush class.

The LOGBRUSH structure, used in some of the initialization functions, has also been modified for Windows CE.

Windows CE does not currently support hatched brushes, so you cannot use the CreateHatchBrush initialization function.

See Also

CBrush Member Functions, CBrush Operators, Graphical Drawing Object Classes, CBitmap, CDC, LOGBRUSH


CBrush Member Functions

Construction |
CBrush | Constructs a CBrush object.
Initialization |
CreateSolidBrush | Initializes a brush with the specified solid color.
CreateBrushIndirect | Initializes a brush with the style, color, and pattern specified in a LOGBRUSH structure.
CreateDIBPatternBrush | Initializes a brush with a pattern specified by a device-independent bitmap (DIB).
CreatePatternBrush | Initializes a brush with a pattern specified by a bitmap.
CreateSysColorBrush | Creates a brush that is the default system color.
Operations |
FromHandle | Returns a pointer to a CBrush object when given a handle to a Windows HBRUSH object.
Attributes |
GetLogBrush | Gets a LOGBRUSH structure.

See Also

CBrush Overview, CBrush Operators, Graphical Drawing Object Classes


CBrush::CBrush

Either of these constructors constructs a CBrush object. The default constructor constructs an uninitialized CBrush object that must be initialized before it can be used.

Syntax

CBrush()

CBrush(COLORREF crColor)

CBrush(CBitmap* pBitmap)

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the following overloaded versions of the constructor.

CBrush::CBrush(int nIndex, COLORREF crColor)

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes, CBrush::CreateSolidBrush, CBrush::CreateBrushIndirect, CBrush::CreateDIBPatternBrush, CGdiObject::CreateStockObject


CBrush::CreateBrushIndirect

This member function initializes a brush with a style, color, and pattern specified in a LOGBRUSH structure. The brush can subsequently be selected as the current brush for any device context.

Syntax

BOOL CreateBrushIndirect( LPLOGBRUSH lpLogBrush );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The only values supported for the lbStyle field in the LOGBRUSH structure referenced by the lpLogBrush parameter are the following.

BS_SOLID

BS_DIBPATTERNPT

NULL_BRUSH

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes, CBrush::CreateDIBPatternBrush, CBrush::CreateSolidBrush, CGdiObject::CreateStockObject, CGdiObject::DeleteObject


CBrush::CreateDIBPatternBrush

This member function initializes a brush with the pattern specified by a device-independent bitmap (DIB). The brush can subsequently be selected for any device context that supports raster operations.

Syntax

BOOL CreateDIBPatternBrush ( HGLOBAL hPackedDIB, UINT nUsage );

BOOL CreateDIBPatternBrush( const void* lpPackedDIB, UINT nUsage );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 doesn't support the DIB_PAL_COLORS flag in the nUsage parameter.

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes, CBrush::CreateBrushIndirect, CBrush::CreateSolidBrush, CGdiObject::CreateStockObject, CDC::SelectObject, CGdiObject::DeleteObject, CDC::GetBrushOrg, CDC::SetBrushOrg

CBrush::CreatePatternBrush

This member function initializes a brush with a pattern specified by a bitmap. The brush can subsequently be selected for any device context that supports raster operations.

Syntax

BOOL CreatePatternBrush( CBitmap* pBitmap );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 3.0 and later
Complete documentation: Visual C++ documentation

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes, CBrush::CreateBrushIndirect, CBrush::CreateDIBPatternBrush, CGdiObject::DeleteObject


CBrush::CreateSolidBrush

This member function initializes a brush with a specified solid color.

Syntax

BOOL CreateSolidBrush( COLORREF crColor );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes, CBrush::CreateBrushIndirect, CBrush::CreateDIBPatternBrush, CGdiObject::DeleteObject


CBrush::CreateSysColorBrush

This member function initializes a brush color.

Syntax

BOOL CreateSysColorBrush ( int nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

This function behaves the same way in MFC for Windows CE as it does in the standard MFC implementation, except that you must use one of the color index flags from the following list for the nIndex parameter. You can not use an integer value because these flags have different values in MFC for Windows CE than in the standard MFC implementation.

The color index value corresponds to the color used to paint one of the following 21 window elements:

COLOR_3DDKSHADOW
Dark shadow for three-dimensional display elements.
COLOR_3DFACE
Face color for three-dimensional display elements.
COLOR_3DHIGHLIGHT
Highlight color for three-dimensional display elements (for edges facing the light source.)
COLOR_3DLIGHT
Light color for three-dimensional display elements (for edges facing the light source.)
COLOR_3DSHADOW
Shadow color for three-dimensional display elements (for edges facing away from the light source).
COLOR_ACTIVEBORDER
Active window border.
COLOR_ACTIVECAPTION
Active window caption.
COLOR_BACKGROUND
Desktop.
COLOR_BTNFACE
Face shading on push buttons.
COLOR_BTNHIGHLIGHT
Highlight color for buttons (same as COLOR_3DHILIGHT).
COLOR_BTNSHADOW
Edge shading on push buttons.
COLOR_BTNTEXT
Text on push buttons.
COLOR_CAPTIONTEXT
Text in caption, size box, and scroll bar arrow box.
COLOR_DESKTOP
Same as COLOR_BACKGROUND.
COLOR_GRAYTEXT
Grayed (disabled) text. This color is set to zero if the current display driver does not support a solid gray color.
COLOR_HIGHLIGHT
Item(s) selected in a control.
COLOR_HIGHLIGHTTEXT
Text of item(s) selected in a control.
COLOR_INACTIVEBORDER
Inactive window border.
COLOR_INACTIVECAPTION
Inactive window caption.
COLOR_INACTIVECAPTIONTEXT
Color of text in an inactive caption.
COLOR_INFOBK
Background color for tooltip controls.
COLOR_INFOTEXT
Text color for tooltip controls.
COLOR_MENU
Menu background.
COLOR_MENUTEXT
Text in menus.
COLOR_SCROLLBAR
Scroll bar gray area.
COLOR_WINDOW
Window background.
COLOR_WINDOWFRAME
Window frame.
COLOR_WINDOWTEXT
Text in windows.

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes, CBrush::CreateBrushIndirect, CBrush::CreateDIBPatternBrush, CBrush::CreateSolidBrush, CGdiObject::DeleteObject


CBrush::FromHandle

This member function obtains a pointer to a CBrush object when you have a handle to a Windows HBRUSH object.

Syntax

static CBrush* PASCAL FromHandle( HBRUSH hBrush );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes


CBrush::GetLogBrush

This member function retrieves the LOGBRUSH structure.

Syntax

int GetLogBrush( LOGBRUSH* pLogBrush );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes


CBrush Operators

Attributes |
operator HBRUSH | Returns the Windows handle attached to the CBrush object.

See Also

CBrush Overview, CBrush Member Functions, Graphical Drawing Object Classes


CBrush::operator HBRUSH

This operator gets the attached Windows GDI handle to the CBrush object. This operator is a casting operator, which supports direct use of an HBRUSH object.

Syntax

operator HBRUSH( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CBrush Overview, CBrush Operators, Graphical Drawing Object Classes


CButton

The CButton class encapsulates the functionality of a Windows CE button, which is a small rectangular control that a user can turn on or off by tapping it with the stylus.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE doesn't support the GetBitmap, SetBitmap, GetIcon, SetIcon, GetCursor or SetCursor member functions of the CButtton class.

See Also

CButton Member Functions, Control Classes, CWnd, CComboBox, CEdit, CListBox, CScrollBar, CStatic, CBitmapButton, CDialog


CButton Member Functions

Construction |
CButton | Constructs a CButton object.
Initialization |
Create | Creates the Windows button control and attaches it to the CButton object.
Operations |
GetState | Retrieves the check state, highlight state, and focus state of a button control.
SetState | Sets the highlighting state of a button control.
GetCheck | Retrieves the check state of a button control.
SetCheck | Sets the check state of a button control.
GetButtonStyle | Retrieves information about the button control style.
SetButtonStyle | Changes the style of a button.
Overridables |
DrawItem | Override to draw an owner-drawn CButton object.

See Also

CButton Overview, Control Classes


CButton::CButton

This constructor constructs a CButton object.

Syntax

CButton( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::Create


CButton::Create

This member function creates the Windows button control and attaches it to the CButton object.

You construct a CButton object in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE doesn't support the BS_BITMAP, BS_ICON, BS_LEFTTEXT, BS_MULTILINE, BS_PUSHBOX, BS_TEXT, or BS_USERBUTTON styles for buttons. You can use the BS_RIGHTBUTTON style instead of BS_LEFTTEXT to place a checkbox or radio button to the right of the associated text. You can use the BS_OWNERDRAW style to create the effects you'd otherwise achieve by using the BS_USERBUTTON, BS_BITMAP or BS_ICON button styles. See the following topics for information on supported styles.

Check Box Styles

Push Button Styles

Radio Button Styles

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::CButton


CButton::DrawItem

This member function is called by the framework when a visual aspect of an owner-drawn button has changed. An owner-drawn button has the BS_OWNERDRAW style set. Override this member function to implement drawing for an owner-drawn CButton object. The application should restore all graphics device interface (GDI) objects selected for the display context supplied in lpDrawItemStruct before the member function terminates.

Syntax

virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::SetButtonStyle


CButton::GetButtonStyle

This member function retrieves the button styles for this CButton object. This function returns only the BS_ style values; it does not return any of the other window styles.

Syntax

UINT GetButtonStyle( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::SetButtonStyle


CButton::GetCheck

This member function retrieves the check state of a radio button or check box.

Syntax

int GetCheck( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::GetState, CButton::SetState, CButton::SetCheck


CButton::GetState

This member function retrieves the state of a radio button or check box.

Syntax

UINT GetState( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::GetCheck, CButton::SetCheck, CButton::SetState


CButton::SetButtonStyle

This member function changes the style of a button.

Use the GetButtonStyle member function to retrieve the button style. The low-order word of the complete button style is the button-specific style.

Syntax

void SetButtonStyle( UINT nStyle, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::GetButtonStyle


CButton::SetCheck

This member function sets or resets the check state of a radio button or check box, and has no effect on a pushbutton.

Syntax

void SetCheck( int nCheck );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::GetCheck, CButton::GetState, CButton::SetState


CButton::SetState

This member function sets the highlighting state of a button control. Highlighting affects the exterior of a button control. It has no effect on the check state of a radio button or check box.

A button control is automatically highlighted when the user clicks and holds the left mouse button. The highlighting is removed when the user releases the mouse button.

Syntax

void SetState( BOOL bHighlight );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CButton Overview, CButton Member Functions, Control Classes, CButton::GetState, CButton::SetCheck, CButton::GetCheck


CByteArray

The CByteArray class supports dynamic arrays of bytes.

The member functions of CByteArray are similar to the member functions of class CObArray. Because of this similarity, you can use the CObArray reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CByteArray Class Members, Array Classes, CObArray


CByteArray Class Members

Construction |
CByteArray | Constructs an empty array for bytes.
Bounds |
GetSize | Gets the number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.
Operations |
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.
Element Access |  |
GetAt |  | Returns the value at a given index.
SetAt |  | Sets the value for a given index; array not allowed to grow.
ElementAt |  | Returns a temporary reference to the byte within the array.
GetData |  | Allows access to elements in the array. Can be NULL.
Growing the Array |  |
SetAtGrow |  | Sets the value for a given index; grows the array if necessary.
Add |  | Adds an element to the end of the array; grows the array if necessary.
Append |  | Appends another array to the array; grows the array if necessary.
Copy |  | Copies another array to the array; grows the array if necessary.
Insertion/Removal |
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.
Operators |
operator [] | Sets or gets the element at the specified index.

See Also

CByteArray Overview, Array Classes


CCeDBDatabase

The CCeDBProp class encapsulates a database in the object store. A Windows CE database is not a full-function database, but a general-purpose structured collection of data.

Each Windows CE object store database has a unique name. You can also assign a database an application-defined type identifier, which you can use to group similar databases.

A Windows CE database can have up to four sort properties that specify how the records are ordered.

Two records in the same Windows CE database can have different numbers or types of properties. If you specify a sort property when you open a database, and there are records in the database that don't contain the property on which the database is being sorted, those records will be placed last in the sort order. (If the sort property was defined with the flag Sort_UnknownFirst, they are placed before the sorted records, instead.)

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

A Windows CE database only supports one level of hierarchy. Records cannot be shared by multiple databases. Every record has a unique object identifier, and is present in exactly one database.

In Windows CE 2.0, a database can have up to CEDB_MAXSORTORDER sort properties, which are used to determine the order in which records are arranged. In order to do a seek operation on a property value, that property must be one of the properties specified in the database's sort order. You cannot have two sort properties in the same database with the same application-defined identifier.

If no sort order is specified when a database is opened, the order in which the records are sorted is undefined.

In MFC for Windows CE 2.0, CEDB_MAXSORTORDER is defined as four.

See Also

CCeDBDatabase Member Functions, CCeDBDatabase Data Members, Windows CE Database Classes, CCeDBRecord, CCeDBProp


CCeDBDatabase Member Functions

Construction |
CCeDBDatabase | Constructs a CCeDBDatabase object.
Create | Creates and initializes the database associated with the CCeDBDatabase object. It does not open the database.
Operations |
AddRecord | Adds a new record to the database.
Close | Closes the database.
Delete | Removes the database from object store, closing it first, if necessary.
DeleteCurrRecord | Deletes the current record.
DeleteCurrRecordProps | Deletes a subset of the properties in the current record.
Exists | Determines whether the specified database exists. This is a static member function.
GetCurrIndex | Returns the current index from the top of the database.
GetCurrRecord | Returns the object identifier of the current record.
GetIdent | Retrieves the application-defined type identifier of the database.
GetLastModified | Retrieves the most recent modification time of the database.
GetName | Retrieves the object store name of the database.
GetNumRecords | Returns the number of records in the database.
GetSize | Returns the size of the database, in bytes.
GetSortProps | Retrieves the current sort order.
Open | Opens the database.
ReadCurrRecord | Reads the current record.
SeekToIndex | Searches for a record by index, from the top or bottom of the database.
SeekFirst | Seeks the first record in the database.
SeekFirstEqual | Seeks the first record with a property that matches the property specified.
SeekLast | Seeks the last record in the database.
SeekNext | Seeks the next record.
SeekNextEqual | Seeks the next record with a property that matches the property specified.
SeekPrev | Seeks the previous record.
SeekToRecord | Seeks the specified record.
SeekValueGreater | Searches for the next record in the database for which the value of the specified property is greater than or equal to the value of the property passed in.
SeekValueSmaller | Searches for the next record in the database for which the value of the specified property is smaller than the value of the property passed in.
SetIdent | Sets the application-defined type identifier of the database.
SetLastModified | Sets the most recent modification time of the database.
SetName | Sets the object store name of the database.
SetSortProps | Sets a new sort order.
WriteCurrRecord | Writes to the current record.

See Also

CCeDBDatabase Overview, CCeDBDatabase Data Members, Windows CE Database Classes


CCeDBDatabase::AddRecord

This member function adds a new record to the database.

Syntax

BOOL AddRecord( CCeDBRecord* pRecord );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

pRecord
A pointer to the record to add to the database.

Return Values

TRUE if the record was successfully added. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

Remarks

The position at which the record is entered depends on the sort orders currently in force for the database. If there are no sort orders defined, the record is placed at the end.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, ::GetLastError


CCeDBDatabase::CCeDBDatabase

This constructor constructs an empty database object.

Syntax

CCeDBDatabase( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

After constructing a database, you have to open it before you can call any member functions on it, other than Create and Exists.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Create


CCeDBDatabase::Close

This member function closes the database.

Syntax

BOOL Close( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

TRUE if the operation succeeded. FALSE if the database could not be closed. Call ::GetLastError to determine why the operation failed.

Remarks

Calling this function is optional. The database is automatically closed by the destructor.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Open, ::GetLastError


CCeDBDatabase::Create

This member function creates a Windows CE database, but does not open it.

Syntax

CEOID Create( LPCWSTR szName, DWORD dwIdent = 0, int nNumSortProps = 0, const CCeDBProp* pSortProps = NULL );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

szName
A null-terminated Unicode string containing the name of the database. The maximum length of the name, including the null-terminator, is MAX_PATH.
dwIdent
The application-defined identifier of the database type.
nNumSortProps
The number of sort properties. This number cannot be greater than CEDB_MAXSORTORDER. Construct the sort properties using the sort property constructor, CCeDBProp::CCeDBProp(CCeDBProp::enType nType,WORD wIdent, WORD wSortFlags).
pSortProps
Pointer to an array of sort properties. The array must have the same number of properties as specified in nNumSortProps.

Return Values

The object identifier of the new database, or NULL if there is an error. Call ::GetLastError to determine why the operation failed.

Remarks

If the specified database already exists, it is not recreated, and the function returns FALSE.

The pSortProps parameter cannot contain more than CEDB_MAXSORTORDER sort properties. In Windows CE 2.0, this number is four.

You cannot have two sort properties in the same database with the same application-defined identifier.

The sort property you pass in the pKeyProp parameter of the Open member function must be one of the properties you previously specified in a call to either Create or SetSortProps.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::CCeDBDatabase, CCeDBDatabase::SetSortProps, CCeDBDatabase::Open, CCeDBProp::CCeDBProp, ::GetLastError


CCeDBDatabase::Delete

This member function removes the database from the object store, closing it if necessary.

Syntax

BOOL Delete( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

TRUE if the operation succeeded. FALSE if the database could not be deleted. Call ::GetLastError to determine why the operation failed.

Remarks

This function does not delete the CCeDBDatabase object but, after calling it, you cannot call any other member functions on the database, except for Create and Exists.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Close, ::GetLastError


CCeDBDatabase::DeleteCurrRecord

This member function deletes the current record from the database.

Syntax

BOOL DeleteCurrRecord( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

TRUE if the record was successfully deleted. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

Remarks

If m_bAutoSeekNext is set to TRUE, the current record will be the next record in the sort order, rather than the record just read.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::DeleteCurrRecordProps, ::GetLastError


CCeDBDatabase::DeleteCurrRecordProps

This member function deletes a subset of the properties of the current record in the database.

Syntax

BOOL DeleteCurrRecordProps( int nNumProps = 0,CCeDBProp *pPropArray = NULL );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

nNumProps
The number of properties in pPropArray. If this parameter is set to zero, the entire record will be deleted.
pPropArray
An array of valueless properties whose application-defined identifiers specify which properties to delete from the current database record. Construct the valueless properties by using the sort property constructor CCeDBProp::CCeDBProp(CCeDBProp::enType nType,WORD wIdent, WORD wSortFlags). (Sort flags are ignored.) If you pass in a null pointer, the entire record will be deleted from the database.

Return Values

TRUE if the properties were successfully deleted. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

Remarks

If you do not pass any parameters, this function behaves exactly like DeleteCurrRecord.

In a Windows CE object store database, you can delete a property on which a sort order has been defined without any adverse effects. By default, records that do not contain the sort property currently in effect are placed last in the sort order. If the sort property was defined in CCeDBDatabase::Create or CCeDBDatabase::SetSortProps with the flag Sort_UnknownFirst, they are placed first.

Whenever you alter a record, the records are resorted so they'll be in the proper order for next seek operation.

If m_bAutoSeekNext is set to TRUE, the current record will be the next record in the sort order, rather than the record just read.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::DeleteCurrRecord, CCeDBProp::CCeDBProp, ::GetLastError


CCeDBDatabase::Exists

This member function determines whether the specified database exists in the object store..

Syntax

static BOOL Exists( LPCWSTR szName );

static BOOL Exists( CEOID CeOID );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

szName
A null-terminated string containing the name of the database.
CeOID
The object identifier of the database.

Return Values

TRUE if the database exists in the object store. FALSE if the database could not be found.

Remarks

This is a static member function. You don't call it from a specific database object.

This function does not tell you whether the object with the specified object identifier is a database. It just tells you whether it exists.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes


CCeDBDatabase::GetCurrIndex

This member function retrieves the zero-based index of the current record, based on the current sort order.

Syntax

DWORD GetCurrIndex( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The index of the current record in the database, with respect to the current sort order.

Remarks

The index is calculated from the beginning of the database.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes


CCeDBDatabase::GetCurrRecord

This member function retrieves the object identifier of the current record.

Syntax

CEOID GetCurrRecord( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The object identifier of the current record, or NULL if there is no current record.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes


CCeDBDatabase::GetIdent

This member function retrieves the application-defined identifier of the database.

Syntax

DWORD GetIdent( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The application-defined identifier of the database.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SetIdent


CCeDBDatabase::GetLastModified

This member function retrieves the date and time at which the database was last modified.

Syntax

FILETIME GetLastModified( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

A FILETIME structure containing the last date and time at which the database was modified.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SetLastModified, FILETIME


CCeDBDatabase::GetName

This member function retrieves the name of the database.

Syntax

void GetName( LPWSTR szName ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

szName
A pointer to a string buffer. On return, this string will contain the name of the database. The string must be large enough to contain the name and the null-terminator. The maximum length for a name, including the null-terminator, is MAX_PATH.

Return Values

This function has no return value.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SetName


CCeDBDatabase::GetNumRecords

This member function retrieves the number of records in the database.

Syntax

WORD GetNumRecords( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The number of records in the database.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes


CCeDBDatabase::GetSize

This member function retrieves the size of the database, in bytes.

Syntax

DWORD GetSize( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The size of the database, in bytes.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes


CCeDBDatabase::GetSortProps

This member function retrieves the current sort order of the database.

Syntax

void GetSortProps( int *pnSize, CCeDBProp *pSortProps ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

pnSize
A pointer to an integer. On return, the integer will contain the number of sort properties currently assigned to the database. This will be the number of sort properties in pSortProps.
pSortProps
An array of at least CEDB_MAXSORTORDER properties. On return, the array will contain the sort properties currently assigned to the database. The array should be at least CEDB_MAXSORTORDER properties to ensure that all sort properties associated with the database can be accommodated.

Return Values

This function has no return value.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SetSortProps, CCeDBProp


CCeDBDatabase::Open

This member function opens the database and, optionally, specifies which sort order to use.

Syntax

BOOL Open( CEOID CeOID, const CCeDBProp* pKeyProp = NULL, const CWnd* pWndNotify = NULL );

BOOL Open( LPCWSTR szName, const CCeDBProp* pKeyProp = NULL, const CWnd* pWndNotify = NULL );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

CeOID
The object identifier of the database.
szName
A null-terminated string containing the name of the database.
pKeyProp
Sort property that represents the primary key for the sort order in which to search the database or list its records. The sort property must be one of the sort properties established for this database in either the Create or SetSortProps member function. If the sort order is not important, set this parameter to zero.
pWndNotify
Handle to the window that should receive notification messages if another thread modifies the database while your application has it open. If your application does not need to receive notifications, set this parameter to NULL.

Return Values

TRUE if the operation succeeded. FALSE if the database could not be opened. Call ::GetLastError to determine why the operation failed.

Remarks

All seek operations performed on the database will use the sort order specified in pKeyProp. If you want to select a different sort order, you must reopen the database. If no sort order is specified, the order in which the records are sorted is undefined.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Close, ::GetLastError


CCeDBDatabase::ReadCurrRecord

This member function reads the current record.

Syntax

BOOL ReadCurrRecord( CCeDBRecord* pRecord, int nNumFilterProps = 0, CCeDBProp *PropFilterArray = NULL );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

pRecord
A pointer to a record. On return, this record contains the data read from the current record in the database. Any data that was previously contained in the record is destroyed, and any memory it owns is released.
nNumFilterProps
The number of properties in PropFilterArray. If this parameter is set to zero, the entire record will be read.
PropFilterArray
An array of valueless properties that specifies which properties to read from the current record. Construct the valueless properties by using the sort property constructor CCeDBProp::CCeDBProp(CCeDBProp::enType nType,WORD wIdent, WORD wSortFlags). (Sort flags are ignored.) If you pass in a null pointer, the entire record will be read.

Return Values

TRUE if the record was successfully read. FALSE if there was an error. Call ::GetLastError to determine why the operation failed. This member function also returns FALSE if the m_bEOF data member has been set to TRUE during this call.

Remarks

If you do not pass in an array of properties, this function will read the entire current record.

If the m_bAutoSeekNext data member is set to TRUE, ReadCurrRecord calls the member function SeekNext after reading the current record. If SeekNext advances the current position past the end of the database, the m_bEOF data member is set to TRUE.

The memory allocated for the record's properties, and their associated CEBLOBs and strings, is released when the record is destroyed.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::m_bAutoSeekNext, CCeDBDatabase::m_bEOF, CCeDBDatabase::SeekNext, CCeDBDatabase::WriteCurrRecord, CCeDBProp::CCeDBProp, ::GetLastError


CCeDBDatabase::SeekFirst

This member function positions the read/write pointer to the first record in the database.

Syntax

CEOID SeekFirst( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The object identifier of the first record, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

If the database was opened using a key sort property, the corresponding sort order is used to determine the first record.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Open, CCeDBDatabase::SeekLast, ::GetLastError


CCeDBDatabase::SeekFirstEqual

This member function searches for the first record in the database that has a property that matches the property passed in the Prop parameter. A matching property has the same application-defined identifier and the same value.

Syntax

CEOID SeekFirstEqual( CCeDBProp& Prop );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

Prop
A property having the same application-defined identifier and value as the property for which to seek.

Return Values

The object identifier of the first record having the same value for the specified property, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

A CCeDBDatabase object can only do a search on a property for which a sort order has been defined. This means that the database must have a sort property associated with it that has the same application-defined identifier as the property you pass in the Prop parameter. The SeekFirstEqual function searches the database in the order specified by this sort property.

If the property for which you are seeking does not have a sort order defined for it, SeekFirstEqual will fail, regardless of whether the record being sought actually exists in the database. SeekFirstEqual will also fail if the record being sought is before the current read/write position. To prevent this, call SeekFirst before calling this function.

This function never sets the m_bEOF data member to TRUE.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SeekFirst, CCeDBDatabase::SeekNextEqual, ::GetLastError


CCeDBDatabase::SeekLast

This member function positions the read/write pointer to the last record in the database.

Syntax

CEOID SeekFirst( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The object identifier of the last record, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

If the database was opened using a key sort property, the corresponding sort order is used to determine the last record.

SeekLast does not set the m_bEOF data member to TRUE.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Open, CCeDBDatabase::SeekFirst, ::GetLastError


CCeDBDatabase::SeekNext

This member function positions the read/write pointer to the next record in the database.

Syntax

CEOID SeekNext( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The object identifier of the next record, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

If the database was opened using a key sort property, the corresponding sort order is used to determine the next record.

This is the only function that sets the m_bEOF data member to TRUE when it encounters the end of the database.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::m_bEOF, CCeDBDatabase::Open, CCeDBDatabase::SeekPrev, ::GetLastError


CCeDBDatabase::SeekNextEqual

This member function searches for the next record in the database that has a property that matches the property passed in the Prop parameter. A matching property has both the same application-defined identifier and the same value.

Syntax

CEOID SeekNextEqual( CCeDBProp& Prop );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

Prop
A property having the same application-defined identifier and value as the property for which to seek.

Return Values

The object identifier of the next record having the same value for the specified property, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

A CCeDBDatabase object can only do a search on a property for which a sort order has been defined. This means that the database must have a sort property associated with it that has the same application-defined identifier as the property you pass in the Prop parameter. The SeekNextEqual function searches the database in the order specified by this sort property. If the property for which you are seeking does not have a sort order defined for it, SeekNextEqual will fail, regardless of whether the record being sought actually exists in the database.

This function never sets the m_bEOF data member to TRUE.

When there is no next record with a value equal to the value of Prop, this function returns zero.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SeekFirstEqual, ::GetLastError


CCeDBDatabase::SeekPrev

This member function positions the read/write pointer to the previous record in the database.

Syntax

CEOID SeekPrev( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The object identifier of the previous record, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

If the database was opened using a key sort property, the corresponding sort order is used to determine the previous record.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SeekNext, CCeDBDatabase::Open, ::GetLastError


CCeDBDatabase::SeekToIndex

This member function searches for a record by index, either from the top or the bottom of the database, and positions the read/write pointer at that record's location.

Syntax

CEOID SeekToIndex( DWORD dwCurrIndex, BOOL bFromEnd = FALSE );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

dwCurrIndex
The zero-based index of the record sought. If bFromEnd is TRUE, the index is the number of records from the end of the database.
bFromEnd
TRUE if searching from the end of the database, FALSE if searching from the beginning.

Return Values

The object identifier of the specified record, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

If the database was opened using a key sort property, the corresponding sort order is used to determine the record indexes.

This function never sets the m_bEOF data member to TRUE.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Open, ::GetLastError


CCeDBDatabase::SeekToRecord

This member function searches for the record specified by CeOID, and positions the read/write pointer at the location of the specified record.

Syntax

CEOID SeekToRecord( CEOID CeOID );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

CeOID
The object identifier of the record for which to search.

Return Values

The object identifier of the specified record, or zero if the seek operation fails. Call ::GetLastError to determine why the operation failed.

Remarks

This function never sets the m_bEOF data member to TRUE.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, ::GetLastError


CCeDBDatabase::SeekValueGreater

This member function searches for a record in the database for which the value of the specified property is greater than or equal to the value of the property passed in the Prop parameter. This function positions the read/write pointer at the record's location.

Syntax

CEOID SeekValueGreater( CCeDBProp& Prop );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

Prop
The property whose value is to be compared with the values of all properties in the database of the same type.

Return Values

The object identifier of a record having either the same value as Prop, or having the smallest value that is greater than the value of Prop, for the same type of property (as specified by the application-defined identifier of Prop). Zero if the seek operation fails; call ::GetLastError to determine why the operation failed.

Remarks

As an example, assume you have a database in which one of the properties has the enumerated constant AGE as its application-defined identifier. If you pass in a property whose identifier is AGE, and whose value is 39, this function will return the record whose AGE property is either equal to 39, or greater than 39, but less than any other AGE in the database that is also greater than 39. If multiple records satisfy the criteria (for instance, if there are two 40s in the database), this function will return whichever record comes first in the current sort order of the database.

A CCeDBDatabase object can only do a search on a property for which a sort order has been defined. This means that the database must have a sort property associated with it that has the same application-defined identifier as the property you pass in the Prop parameter. If the property for which you are seeking does not have a sort order defined for it, SeekValueGreater will fail, regardless of whether the record being sought actually exists in the database.

This function never sets the m_bEOF data member to TRUE.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SeekValueSmaller, ::GetLastError


CCeDBDatabase::SeekValueSmaller

This member function searches for the record for which the value of the specified property is smaller than the value of the property passed in the Prop parameter. This function positions the read/write pointer at the record's location.

Syntax

CEOID SeekValueSmaller( CCeDBProp& Prop );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

Prop
The property whose value is to be compared with the values of all properties in the database of the same type.

Return Values

The object identifier of the record having the largest value that is smaller than the value of Prop, for the same type of property (as specified by the application-defined identifier of Prop). Zero if the seek operation fails; call GetLastError to determine why the operation failed.

Remarks

As an example, assume you have a database in which one of the properties has the enumerated constant NAME as its application-defined identifier. If you pass in a property whose identifier is NAME, and whose value is "Jones", this function will return the record for which the string value of the NAME property evaluates to less than Jones, but to greater than any other name in the database whose string value is also less than "Jones". If multiple records satisfy the criteria (for instance, if there are two "Jacksons" in the database), this function will return whichever record comes first in the current sort order of the database.

A CCeDBDatabase object can only do a search on a property for which a sort order has been defined. This means that the database must have a sort property associated with it that has the same application-defined identifier as the property you pass in the Prop parameter. If the property for which you are seeking does not have a sort order defined for it, SeekValueSmaller will fail, regardless of whether the record being sought actually exists in the database.

This function never sets the m_bEOF data member to TRUE.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::SeekValueGreater, ::GetLastError


CCeDBDatabase::SetIdent

This member function sets the application-defined identifier of the database.

Syntax

BOOL SetIdent( DWORD dwIdent );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

dwIdent
The application-defined identifier to assign to the database.

Return Values

TRUE if the property's identifier was successfully set. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

Remarks

The application-defined identifier must be unique within the object store.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::GetIdent, ::GetLastError


CCeDBDatabase::SetLastModified

This member function sets the date and time at which the database was last modified.

Syntax

BOOL SetLastModified( FILETIME ftLastModified );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

ftLastModified
The date and time at which the database was last modified.

Return Values

TRUE if the last modified date and time were successfully set. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::GetLastModified, FILETIME, ::GetLastError


CCeDBDatabase::SetName

This member function sets the name of the database.

Syntax

BOOL SetName( LPCWSTR wszName );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

wszName
A pointer to a null-terminated Unicode string containing the name to assign to the database.

Return Values

TRUE if the name was successfully assigned to the database. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

Remarks

The name must be unique within the object store.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::GetName, ::GetLastError


CCeDBDatabase::SetSortProps

This member function sets the new sort order of the database.

Syntax

BOOL SetSortProps( int nSize, const CCeDBProp *pSortProps );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

nSize
The number of sort properties in pSortProps. This number cannot be greater than CEDB_MAXSORTORDER.
pSortProps
An array of sort properties to assign to the database. There should be nSize sort properties in the array. Construct the sort properties using the sort property constructor, CCeDBProp::CCeDBProp(CCeDBProp::enType nType,WORD wIdent, WORD wSortFlags).

Return Values

TRUE if the last modified date and time were successfully set. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

Remarks

The pSortProps parameter cannot contain more than CEDB_MAXSORTORDER sort properties. In Windows CE 2.0, this number is four.

You cannot have two sort properties in the same database with the same application-defined identifier.

The sort property you pass in the pKeyProp parameter of the Open member function must be one of the properties you previously specified in a call to either SetSortProps or Create.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::Create, CCeDBDatabase::GetSortProps, CCeDBDatabase::Open, CCeDBProp::CCeDBProp, ::GetLastError


CCeDBDatabase::WriteCurrRecord

This member function writes properties to the current record.

Syntax

BOOL WriteCurrRecord( CCeDBRecord* pRecord, int nNumFilterProps = 0, CCeDBProp *PropFilterArray = NULL );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

pRecord
A pointer to a record that contains the data you want to write to the current record in the database.
nNumFilterProps
The number of properties in PropFilterArray. If this parameter is set to zero, the entire contents of pRecord will be written to the current record in the database.
PropFilterArray
An array of valueless properties whose application-defined identifiers specify which properties to copy from pRecord into the current database record. Construct the valueless properties by using the sort property constructor CCeDBProp::CCeDBProp(CCeDBProp::enType nType,WORD wIdent, WORD wSortFlags). (Sort flags are ignored.) If you pass in a null pointer, the entire record will be written to the database.

Return Values

TRUE if the record was successfully written. FALSE if there was an error. Call ::GetLastError to determine why the operation failed.

Remarks

The CCeDBRecord object you pass by reference in the pRecord parameter does not have to contain all the properties that the current record in the database does. You can pass in a record that contains only the specific properties you want to change. In this case, you do not need to use a filter array. For example, if the record in the database has eight properties, and you only need to modify two of them, you can create a new record with just those two properties, and pass a pointer to that record in pRecord. You would not use the other two parameters.

On the other hand, if you already have the current record open from a previous ReadCurrRecord operation, you can make changes directly to the properties in that CCeDBRecord object. Then, create a filter array of valueless properties with the same application-defined identifiers as the properties you want to change in the record. Then pass a pointer to the record in the pRecord parameter, the number of properties you modified in the nNumFilterProps parameter, and the filter array in the PropFilterArray parameter.

Whenever you alter a record, the records are resorted so they'll be in the proper order for next seek operation.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes, CCeDBDatabase::ReadCurrRecord, CCeDBDatabase::SeekNext, CCeDBProp::CCeDBProp, ::GetLastError


CCeDBDatabase Data Members

Data Members |
m_bAutoSeekNext | A flag that specifies whether to call SeekNext when calling ReadCurrRecord. The default is FALSE.
m_bEOF | The end-of-file flag. Set when m_bAutoSeekNext is set to TRUE and ReadCurrRecord reads past the end of the database.
m_CEOID | The database's object identifier.
m_hHandle | The database handle.

See Also

CCeDBDatabase Overview, CCeDBDatabase Member Functions, Windows CE Database Classes


CCeDBDatabase::m_bAutoSeekNext

This data member contains a flag that specifies whether to automatically call SeekNext after reading a record.

BOOL m_bAutoSeekNext;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

The default value is FALSE. If you want to use the m_bEOF data member to check for the end of the file when reading records sequentially, you should set the m_bAutoSeekNext flag to TRUE. The m_bEOF data member is only set by the SeekNext function.

See Also

CCeDBDatabase Overview, CCeDBDatabase Data Members, Windows CE Database Classes, CCeDBDatabase::m_bEOF, CCeDBDatabase::SeekNext


CCeDBDatabase::m_bEOF

This data member contains the end of file flag.

BOOL m_bEOF;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

This flag is only set to TRUE by the SeekNext function, when it reaches the end of the database. If you want to use m_bEOF when reading records sequentially, you should set the m_bAutoSeekNext flag to TRUE.

See Also

CCeDBDatabase Overview, CCeDBDatabase Data Members, Windows CE Database Classes, CCeDBDatabase::m_bAutoSeekNext, CCeDBDatabase::SeekNext


CCeDBDatabase::m_CEOID

This data member contains the object identifier of the database, with respect to the object store.

CEOID m_CEOID;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

When you call either the Create or Open member function, it sets the CCeDBDatabase object's m_CEOID member to a non-NULL value.

Every object in the object store has a unique object identifier. A database is one type of object that can exist in the object store. Its object identifier is stored in its m_CEOID data member. For more information about object identifiers, see About Object Identifiers.

See Also

CCeDBDatabase Overview, CCeDBDatabase Data Members, Windows CE Database Classes


CCeDBDatabase::m_hHandle

This data member contains the handle to an open database.

HANDLE m_hHandle;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

When you call the Open member function, it sets the m_hHandle data member to a non-NULL value.

See Also

CCeDBDatabase Overview, CCeDBDatabase Data Members, Windows CE Database Classes


CCeDBEnum

The CCeDBEnum class enumerates the databases in the object store. The constructor starts the enumeration, and the enumeration continues until all databases are enumerated or the enumerator is destroyed.

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

See Also

CCeDBEnum Member Functions, Windows CE Database Support


CCeDBEnum Member Functions

Construction |
CCeDBEnum | Constructs a database enumerator object and begins the enumeration.
Operations |
Next | Gets the next database in the enumeration, or returns NULL if no more databases are found.

See Also

CCeDBEnum Overview, Windows CE Database Support


CCeDBEnum::CCeDBEnum

Use this constructor to construct a CCeDBEnum object and begin an enumeration of the databases in the object store.

Syntax

CCeDBEnum ( DWORD dwIdent = 0 );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

dwIdent
The application-defined identifier of the databases to enumerate. The default value of this parameter is zero. When zero is specified, the enumerator enumerates all databases in the object store. If a value other than zero is passed in, the enumerator enumerates only those databases that have this type identifier value.

Remarks

Constructing the enumerator begins the enumeration. To get the CEOID of the next database in the object store with the specified identifier, call the member function Next. The enumeration ends when either Next returns NULL or the CCeDBEnum object is destroyed.

You assign a database its application-defined identifier either when you call CCeDBDatabase::Create or by calling CCeDBDatabase::SetIdent.

See Also

CCeDBEnum Overview, CCeDBEnum Member Functions, Windows CE Database Support, CCeDBEnum::Next, CCeDBDatabase::Create, , CCeDBDatabase::SetIdent


CCeDBEnum::Next

This member function retrieves the next CCeDBDatabase object in the enumeration. This function returns NULL if no more databases are found.

Syntax

CEOID Next ( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The object identifier (CEOID) of the next database in the object store.

Remarks

If the CCeDBEnum object is constructed with an application-defined identifier other than 0, Next will only enumerate the databases with the specified identifier. Otherwise, it will enumerate all the databases in the object store.

Repeated calls to Next will return the CEOIDs of the databases being enumerated. Enumeration ends when either Next returns NULL or the CCeDBEnum object is destroyed.

See Also

CCeDBEnum Overview, CCeDBEnum Member Functions, Windows CE Database Support, CEOID


CCeDBProp

The CCeDBProp class encapsulates a Windows CE database property. A property is a data item that consists of an application-defined property identifier, a data type identifier, and the data.

A CCeDBProp object can also serve as a "sort" property. A sort property contains an application-defined identifier, a data type, and a set of flags that specify sorting information. A sort property is valueless, i.e. it does not contain any data.

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

In Windows CE 2.0, a database can have up to four sort properties, which are used to determine the sort order in which records are arranged. You cannot have two sort properties in the same database with the same application-defined identifier. In order to do a seek operation on a property value, that property must be one of the properties specified in the database's sort order.

If you specify a sort property when you open a database, and there are records in the database that don't contain the property on which the database is being sorted, those records will be placed last in the sort order. (If the sort property was defined with the flag Sort_UnknownFirst, they are placed before the sorted records, instead.)

See Also

CCeDBProp Member Functions, CCeDBProp Operators, CCeDBProp Data Members, Windows CE Database Classes, CEPROPVAL, SORTORDERSPEC


CCeDBProp Member Functions

Construction |
CCeDBProp | Constructs a CCeDBProp object.
Operations |
GetBlob | Retrieves the value of a property whose data type is CEBLOB.
GetFiletime | Retrieves the value of a property whose data type is FILETIME.
GetIdent | Retrieves the application-defined identifier.
GetLong | Retrieves the value of a property whose data type is a long integer.
GetShort | Retrieves the value of a property whose data type is a short integer.
GetSortFlags | Retrieves the sort flags.
GetString | Retrieves the value of a property whose data type is a wide character array (WCHAR). The value returned is the same string pointed to by the property, not a copy.
GetType | Retrieves the property's data type.
GetULong | Retrieves the value of a property whose data type is an unsigned long integer.
GetUShort | Retrieves the value of a property whose data type is an unsigned short integer.
SetBlob | Sets the value of a property whose data type is CEBLOB.
SetFiletime | Sets the value of a property whose data type is FILETIME.
SetIdent | Sets the application-defined identifier.
SetLong | Sets the value of a property whose data type is a long integer.
SetShort | Sets the value of a property whose data type is a short integer.
SetSortFlags | Sets the sort flags.
SetString | Sets the value of a property whose data type is a wide character array (WCHAR).
SetType | Sets the property's data type.
SetULong | Sets the value of a property whose data type is an unsigned long integer.
SetUShort | Sets the value of a property whose data type is an unsigned short integer.

See Also

CCeDBProp Overview, CCeDBProp Operators, CCeDBProp Data Members, Windows CE Database Classes


CCeDBProp::CCeDBProp

Use this constructor to construct a CCeDBProp object.

Syntax

CCeDBProp( );

CCeDBProp( CCeDBProp::enType nType, WORD wIdent = 0, WORD wSortFlags = Sort_Ascending );

CCeDBProp( short iVal, WORD wIdent = 0 );

CCeDBProp( USHORT uiVal, WORD wIdent = 0 );

CCeDBProp( long lVal, WORD wIdent = 0 );

CCeDBProp( ULONG ulVal, WORD wIdent = 0 );

CCeDBProp( FILETIME filetime, WORD wIdent = 0 );

CCeDBProp( LPWSTR lpwstr, WORD wIdent = 0, CCeDBProp::enCopyMode nMode = Copy );

CCeDBProp( CEBLOB blob, WORD wIdent = 0, CCeDBProp::enCopyMode nMode = Copy );

CCeDBProp( CCeDBProp& prop );// copy constructor

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

nType
The data type of the property, used only when constructing valueless properties. CCeDBProp::enType is an enumeration, that defines the following values.
CCeDBProp::Type_Short
A signed short integer.
CCeDBProp::Type_UShort
An unsigned short integer.
CCeDBProp::Type_Long
A signed long integer.
CCeDBProp::Type_ULong
An unsigned long integer.
CCeDBProp::Type_Filetime
A FILETIME structure.
CCeDBProp::Type_String
A null-terminated string. (This is a wide character array (WCHAR), not a CString object.)
CCeDBProp::Type_Blob
A CEBLOB structure.
wIdent
The property's application-defined identifier. The default value is zero.
wSortFlags
For a sort property, the flags that determine the sort order. This parameter can have one of the following values:
CCeDBProp::Sort_Ascending
The sort is done in ascending order.
CCeDBProp::Sort_CaseInsensitive
The sort operation is case insensitive. This value is valid only for strings.
CCeDBProp::Sort_Descending
The sort is done in descending order.
CCeDBProp::Sort_UnknownFirst
Records that do not contain the property identified by wIdent are placed before all the other records. By default, these records are placed after all other records.
iVal
A signed short integer value.
uiVal
An unsigned short integer value.
lVal
A signed long integer value.
ulVal
An unsigned long integer value.
filetime
A FILETIME structure, initialized with meaningful data.
lpwstr
A null-terminated string. (This must be a wide character array (WCHAR), not a CString object.)
blob
A CEBLOB structure, initialized with meaningful data.
nMode
A flag that specifies whether to allocate memory to store the passed in string or BLOB. This parameter can have one of the following values.
CCeDBProp::Copy
Allocate new memory. The property will have its own copy of the string or BLOB used to create it.
CCeDBProp::NoCopy
The property will maintain a pointer to the existing string or BLOB, but will not own it.
prop
The CCeDBProp object to be copied.

Remarks

The default constructor sets the property's value to (long) 0. The default sort flag is CCeDBProp::Sort_Ascending.

The overloaded constructor with the syntax CCeDBProp(CCeDBProp::enType nType, WORD wIdent , WORD wSortFlags) is used to create valueless properties. You use valueless properties to set a database's sort orders, and to create filters for reading and writing records. When you create valueless properties for filters, you ignore the wSortFlags parameter.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CEBLOB, FILETIME


CCeDBProp::GetBlob

This member function retrieves the value of a property, when the property's data type is a binary large object (CEBLOB). (CCeDBProp::Type_Blob).

Syntax

CEBLOB GetBlob( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

A pointer to the string represented by the property.

Remarks

You can only call GetBlob on a property of the type CeDBProp::Type_Blob.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetBlob, CEBLOB


CCeDBProp::GetFiletime

This member function retrieves the value of a property, when the property's data type is a FILETIME. (CeDBProp::Type_Filetime).

Syntax

FILETIME GetFiletime( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The value of the FILETIME property.

Remarks

You can only call GetFiletime on a property of the type CeDBProp::Type_Filetime.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetFiletime, FILETIME


CCeDBProp::GetIdent

This member function retrieves the application-defined identifier of a property.

Syntax

WORD GetIdent( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The property's application-defined identifier.

Remarks

A property's identifier is determined by the application. The application can use these identifiers to sort and retrieve records in the database.

See Also

Windows CE Database Classes, CCeDBProp::SetIdent


CCeDBProp::GetLong

This member function retrieves the value of a property, when the property's data type is an unsigned long integer (CCeDBProp::Type_Long).

Syntax

long GetLong( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The value of the property.

Remarks

You can only call GetLong on a property of the type CeDBProp::Type_Long.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetLong


CCeDBProp::GetShort

This member function retrieves the value of a property, when the property's data type is a signed short integer (CCeDBProp::Type_Short).

Syntax

short GetShort( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The value of the property.

Remarks

You can only call GetShort on a property of the type CeDBProp::Type_Short.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetShort


CCeDBProp::GetSortFlags

This member function retrieves the sort flags of a sort property.

Syntax

WORD GetSortFlags( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The flags that determine the sort order for the database. This parameter can be one of any of the following enumerated values.

CCeDBProp::Sort_Ascending
The sort is done in ascending order.
CCeDBProp::Sort_Descending
The sort is done in descending order.
CCeDBProp::Sort_CaseInsensitive
The sort operation is case sensitive. This value is valid only for strings.
CCeDBProp::Sort_UnknownFirst
Records that do not contain the property identified by wIdent are placed before all the other records. By default, these records are placed after all other records.
CCeDBProp::Sort_GenericOrder
This flag indicates the sort property is only a placeholder. If a CCeDBDatabase object has no sort properties assigned to it, CCeDBProp::Sort_GenericOrder is assigned as the default sort flag.

Remarks

You can pass one or more sort properties to the CCeDBProp::Create function when you create a CCeDBProp database object, in order to specify the sorting orders to use in the database.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBDatabase::Create, CCeDBProp::SetSortFlags


CCeDBProp::GetString

This member function retrieves the value of a property, when the property's data type is a wide (Unicode) character string (CCeDBProp::Type_String).

Syntax

LPWSTR GetString( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

A pointer to the string represented by the property.

Remarks

You can only call GetString on a property of the type CeDBProp::Type_String.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetString


CCeDBProp::GetType

This member function retrieves the data type of a property.

Syntax

CeDBProp::enType GetType( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The data type of the property. This parameter can have one of the following values:

CeDBProp::Type_Short
A signed short integer.
CeDBProp::Type_UShort
An unsigned short integer.
CeDBProp::Type_Long
A signed long integer.
CeDBProp::Type_ULong
A unsigned long integer.
CeDBProp::Type_Filetime
A FILETIME structure.
CeDBProp::Type_String
A null-terminated wide (Unicode) character string (not a CString).
CeDBProp::Type_Blob
A CEBLOB structure.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetType, CEBLOB, FILETIME


CCeDBProp::GetULong

This member function retrieves the value of a property, when the property's data type is an unsigned long integer (CeDBProp::Type_ULong).

Syntax

ULONG GetULong( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The value of the property.

Remarks

You can only call GetULong on a property of the type CeDBProp::Type_ULong.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetULong


CCeDBProp::GetUShort

This member function retrieves the value of a property, when the property's data type is an unsigned short integer (Type_Short).

Syntax

USHORT GetUShort( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The value of the property.

Remarks

You can only call GetUShort on a property of the type CeDBProp::Type_UShort.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::SetUShort


CCeDBProp::SetBlob

This member function sets the value of a binary large object (BLOB) property (CCeDBProp::Type_Blob).

Syntax

void SetBlob( CEBLOB blob, UINT nMode = Copy );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

blob
An initialized CEBLOB structure.
nMode
A flag that specifies whether to allocate memory to store the passed in CEBLOB structure. This parameter can have one of the following values.
CCeDBProp::Copy
Creates a copy of the data buffer pointed to by the lpb member of the CEBLOB passed in the blob parameter. This memory is released when the CCeDBProp object is destroyed.
CCeDBProp::NoCopy
The property maintains a pointer to the same data buffer pointed to by lpb member of the CEBLOB passed in the blob parameter, but doesn't own it. The memory is not released when the CCeDBProp object is destroyed.

Return Values

This member function has no return value.

Remarks

The blob parameter must be properly initialized.

You can only call SetBlob on a property of the type CeDBProp::Type_Blob.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetBlob, CEBLOB


CCeDBProp::SetFiletime

This member function sets the value of a FILETIME property (CCeDBProp::Type_Filetime).

Syntax

void SetFiletime( FILETIME filetime );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

filetime
The value of the FILETIME property.

Return Values

This member function has no return value.

Remarks

You can only call SetFiletime on a property of the type CeDBProp::Type_Filetime.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetFiletime, FILETIME


CCeDBProp::SetIdent

This member function sets the application-defined identifier of a property.

Syntax

void SetIdent( WORD wIdent );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

wIdent
The property's application-defined identifier.

Return Values

This member function has no return value.

Remarks

A property's identifier is determined by the application. The application can use these identifiers to sort and retrieve records in the database.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetIdent


CCeDBProp::SetLong

This member function sets the value of a long integer property (CCeDBProp::Type_Long).

Syntax

void SetLong( long lVal );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

lVal
The value of the property.

Return Values

This member function has no return value.

Remarks

You can only call SetLong on a property of the type CeDBProp::Type_Long.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetLong


CCeDBProp::SetShort

This member function sets the value of a short integer property (CCeDBProp::Type_Short).

Syntax

void SetShort( short iVal );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

iVal
The value of the property.

Return Values

This member function has no return value.

Remarks

You can only call SetShort on a property of the type CeDBProp::Type_Short.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetShort


CCeDBProp::SetSortFlags

This member function sets the sort flags of a sort property.

Syntax

void SetSortFlags( WORD wSortFlags );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

wSortFlags
The flags that determine the sort order for the database. This parameter can be one of any of the following enumerated values.
CCeDBProp::Sort_Ascending
The sort is done in ascending order.
CCeDBProp::Sort_Descending
The sort is done in descending order.
CCeDBProp::Sort_CaseInsensitive
The sort operation is case insensitive. This option is valid only for strings.
CCeDBProp::Sort_UnknownFirst
Records that do not contain the property identified by wIdent are placed before all the other records. By default, these records are placed after all other records.

Return Values

This member function has no return value.

Remarks

You can pass one or more sort properties to the CCeDBProp::Create function when you create a CCeDBProp database object, in order to specify the sorting orders to use in the database.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBDatabase::Create, CCeDBProp::GetSortFlags


CCeDBProp::SetString

This member function sets the value of a string property (CCeDBProp::Type_String).

Syntax

void SetString( LPWSTR lpwstr, UINT nMode = Copy );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

lpwstr
A pointer to a string.
nMode
A flag that specifies whether to allocate memory to store the passed in string. This parameter can have one of the following values.
CCeDBProp::Copy
Creates a copy of the string pointed to by the lpwstr parameter. This memory is released when the CCeDBProp object is destroyed.
CCeDBProp::NoCopy
The property maintains a pointer to the existing string, passed in the lpwstr parameter, but doesn't own it. The memory is not released when the CCeDBProp object is destroyed.

Return Values

This member function has no return value.

Remarks

You can only call SetString on a property of the type CeDBProp::Type_String.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetString


CCeDBProp::SetType

This member function sets the data type of a property.

Syntax

void SetType( CCeDBProp::enType nType );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

nType
The data type of the property. This parameter can have one of the following values:
CCeDBProp::Type_Short
A signed short integer.
CCeDBProp::Type_UShort
An unsigned short integer.
CCeDBProp::Type_Long
A signed long integer.
CCeDBProp::Type_ULong
An unsigned long integer.
CCeDBProp::Type_Filetime
A FILETIME structure.
CCeDBProp::Type_String
A null-terminated wide (Unicode) character string (not a CString object).
CCeDBProp::Type_Blob
A CEBLOB structure.

Return Values

This member function has no return value.

Remarks

When you call SetType, any data currently belonging to the property is lost. The new data value is zero or NULL, depending on the data type.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetType, CEBLOB, FILETIME


CCeDBProp::SetULong

This member function sets the value of an unsigned long integer property (CCeDBProp::Type_ULong).

Syntax

void SetULong( ULONG ulVal );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

ulVal
The value of the property.

Return Values

This member function has no return value.

Remarks

You can only call SetULong on a property of the type CeDBProp::Type_ULong.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetULong


CCeDBProp::SetUShort

This member function sets the value of an unsigned short integer property (CCeDBProp::Type_UShort).

Syntax

void SetUShort( USHORT uiVal );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

uiVal
The value of the property.

Return Values

This member function has no return value.

Remarks

You can only call SetUShort on a property of the type CeDBProp::Type_UShort.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, Windows CE Database Classes, CCeDBProp::GetUShort


CCeDBProp Operators

Construction |
operator = | The assignment operator.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, CCeDBProp Data Members, Windows CE Database Classes


CCeDBProp::operator =

The assignment operator copies the CCeDBProp object's m_CePropVal data member. If the property being copied is a string or a BLOB, the CCeDBProp object to which its value is being assigned makes a copy of the pointer to the string or data buffer belonging to the other property, but does not own it. The memory is not released when the CCeDBProp object to which it is assigned is destroyed.

Syntax

CCeDBProp& operator=( const CCeDBProp& prop );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

prop
The CCeDBProp object being copied.

See Also

CCeDBProp Overview, CCeDBProp Operators, Windows CE Database Classes, CCeDBProp::m_CePropVal


CCeDBProp Data Members

Data Members |
m_CePropVal | The value of the property.
m_wSortFlags | For a sort property only; the flags that determine the sort order of the database.

See Also

CCeDBProp Overview, CCeDBProp Member Functions, CCeDBProp Operators, Windows CE Database Classes


CCeDBProp::m_CePropVal

This data member contains a CEPROPVAL structure that contains information about the property's data, as well as the data itself.

CEPROPVAL m_CePropVal;

See Also

CCeDBProp Overview, CCeDBProp Data Members, Windows CE Database Classes, CEPROPVAL


CCeDBProp::m_wSortFlags

This data member applies only to sort properties. It contains the flags used to specify the sort order of the data in the database.

WORD m_wSortFlags;

This data member can have one of the following enumerated values.

CCeDBProp::Sort_Ascending
The sort is done in ascending order.
CCeDBProp::Sort_Descending
The sort is done in descending order.
CCeDBProp::Sort_CaseInsensitive
The sort operation is case insensitive. This option is valid only for strings.
CCeDBProp::Sort_UnknownFirst
Records that do not contain the property identified by wIdent are placed before all the other records. By default, these records are placed after all other records.
CCeDBProp::Sort_GenericOrder
This flag indicates the sort property is only a placeholder. If a CCeDBDatabase object has no sort properties assigned to it, Sort_GenericOrder is assigned as the default sort flag.

See Also

CCeDBProp Overview, CCeDBProp Data Members, Windows CE Database Classes, CCeDBProp::GetSortFlags, CCeDBProp::SetSortFlags


CCeDBRecord

The CCeDBRecord class encapsulates the functionality of a Windows CE database record. CCeDBRecord represents the record as it resides in RAM. You use the ReadCurrRecord and WriteCurrRecord member functions to transfer properties to and from the database in the object store.

Two records in the same Windows CE database can have different numbers or types of properties. If you specify a sort property when you open a database, and there are records in the database that don't contain the property on which the database is being sorted, those records will be placed last in the sort order. (If the sort property was defined with the flag Sort_UnknownFirst, they are placed before the sorted records, instead.)

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

See Also

CCeDBRecord Member Functions, CCeDBRecord Operators, CCeDBRecord Data Members, Windows CE Database Support


CCeDBRecord Member Functions

Construction |
CCeDBRecord | Constructs a CCeDBRecord object.
Operations |
AddProp | Adds a property to the record.
AddProps | Adds an array of properties to the record.
DeleteAllProps | Deletes all properties from the record
DeleteProp | Deletes a property from the record.
GetNumProps | Retrieves the number of properties in the record.
GetPropFromIdent | Retrieves a property based on its application-defined identifier.
GetPropFromIndex | Retrieves a property based on its index.

See Also

CCeDBRecord Overview, CCeDBRecord Operators, CCeDBRecord Data Members, Windows CE Database Support


CCeDBRecord::CCeDBRecord

Use this constructor to construct a CCeDBRecord object.

Syntax

CCeDBRecord( );

CCeDBRecord( CCeDBRecord& rec );// copy constructor

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

rec
The CCeDBRecord object to be copied.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support


CCeDBRecord::AddProp

This member function adds a property to the record.

Syntax

BOOL AddProp( CCeDBProp* p Prop );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

pProp
A pointer to the CCeDBProp object to be added.

Return Values

TRUE if the operation was successful; FALSE if there was not enough memory available to add the property.

Remarks

When you add a property to a record by using the AddProp function, the CCeDBRecord object keeps a pointer to the property you pass in. It does not make a copy of the property itself. When the record is destroyed, it does not release the memory occupied by that property. By contrast, when you read a record from the object store by calling ReadCurrentRecord, the properties in that record are owned by the record, and are consequently freed when the record is destroyed.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support, CCeDBProp, CCeDBRecord::AddProps


CCeDBRecord::AddProps

This member function adds several properties to the record at the same time.

Syntax

BOOL AddProps( CCeDBProp* pPropArray, int nNumProps );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

pPropArray
A pointer to an array of CCeDBProp objects to be added to the record.
nNumProps
The number of CCeDBProp objects in pPropArray.

Return Values

TRUE if the operation was successful; FALSE if the properties could not be added.

Remarks

When you add propertie to a record by using the AddProps function, the CCeDBRecord object keeps pointers to the properties you pass in. It does not make copies of the properties themselves. When the record is destroyed, it does not release the memory occupied by the properties you added. By contrast, when you read a record from the object store by calling ReadCurrentRecord, the properties in that record are owned by the record, and are consequently freed when the record is destroyed.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support, CCeDBProp, CCeDBRecord::AddProp


CCeDBRecord::DeleteAllProps

This member function deletes all the properties from the record.

Syntax

void DeleteAllProps( );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

This function has no return value.

Remarks

DeleteAllProps releases all pointers to properties stored in the record's internal list, and frees their associated member strings CEBLOB structures. The CCeDBRecord object's internal list only contains pointers to properties that were created by calling ReadCurrRecord, however. If there are any properties in the record that were added using the AddProp or AddProps member functions, DeleteAllProps does not release the memory occupied by those properties.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support, CCeDBProp, CCeDBRecord::DeleteProp


CCeDBRecord::DeleteProp

This member function deletes a property from the record.

Syntax

void DeleteProp( WORD wPropIdent );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

wPropIdent
The application-defined identifier of the property to delete.

Return Values

This function has no return value.

Remarks

DeleteProp releases the pointer to a property stored in the CCeDBRecord object's internal list, and frees its member strings and CEBLOB structure. The record's internal list only contains pointers to properties that were created by calling ReadCurrRecord. If the property specified was added using either the AddProp or AddProps member function, DeleteProp does not free its memory.

In a Windows CE object store database, you can delete a property on which a sort order has been defined without any adverse effects. By default, when a database is opened with an active sort property, records that do not contain the corresponding property are placed last in the sort order. If the sort property was defined in CCeDBDatabase::Create or CCeDBDatabase::SetSortProps with the flag Sort_UnknownFirst, they are placed first.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support, CCeDBProp, CCeDBDatabase::Create, CCeDBRecord::DeleteAllProps, CCeDBDatabase::SetSortProps


CCeDBRecord::GetNumProps

This member function retrieves the number of properties to which the record holds pointers.

Syntax

int GetNumProps( ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Return Values

The number of properties belonging to the record.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support, CCeDBProp


CCeDBRecord::GetPropFromIdent

This member function retrieves a property based on the application-defined identifier, wPropIdent.

Syntax

CCeDBProp* GetPropFromIdent( WORD wPropIdent ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

wPropIdent
The application-defined identifier of the property to retrieve.

Return Values

A pointer to the CCeDBProp object identified by wPropIdent, or NULL if the record does have any properties with the specified identifier.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support, CCeDBRecord::GetPropFromIndex , CCeDBProp


CCeDBRecord::GetPropFromIndex

This member function retrieves a property based on its index within the record.

Syntax

CCeDBProp* GetPropFromIndex( int nIndex ) const;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Parameters

nIndex
The zero-based index of the property to retrieve.

Return Values

A pointer to the CCeDBProp object identified by nIndex, or NULL if nIndex is out of range.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, Windows CE Database Support, CCeDBRecord::GetPropFromIdent , CCeDBProp


CCeDBRecord Operators

Construction |
operator = | The assignment operator.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, CCeDBRecord Data Members, Windows CE Database Support


CCeDBRecord::operator =

This assignment operator copies rec's m_PropArray data member, which contains the array of properties that belong to the record., into this CCeDBRecord object's m_PropArray data member.

Syntax

CCeDBRecord& operator=( const CCeDBRecord& rec );

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

Remarks

This operator does a shallow copy. It only copies pointers to the properties belonging to rec; it does not make copies of the properties themselves.

See Also

CCeDBRecord Overview, CCeDBRecord Operators, Windows CE Database Support, CCeDBRecord::m_PropArray


CCeDBRecord Data Members

Data Members |
m_PropArray | The array of properties belonging to the record.

See Also

CCeDBRecord Overview, CCeDBRecord Member Functions, CCeDBRecord Operators, Windows CE Database Support


CCeDBRecord::m_PropArray

This data member contains a CObArray object consisting of pointers to CCeDBProperty objects.

CObArray m_PropArray;

At a Glance

Header file: | Wcedb.h
Platforms: |
Versions: | 2.0 and later

See Also

CCeDBRecord Overview, CCeDBRecord Data Members, Windows CE Database Support, CCeDBProp, CObArray


CCeSocket

The CCeSocket class is derived from the CSocket class. If you want to use asynchronous communication in Windows CE, you must use the CCeSocket class. Windows CE does not inherently support asynchronous socket communication, but the CCeSocket class provides asynchronous notification for the following three types of socket events:

  • Notification that the socket is ready for reading (FD_READ)
  • Notification of incoming connections (FD_ACCEPT)
  • Notification of completed connections (FD_CONNECT)

At a Glance

Header file: | Wcesock.h
Platforms: |
Versions: | 2.0 and later

Remarks

Use the CCeSocket class, or a class derived from CCeSocket, for Windows CE applications, rather than using CSocket or CAsyncSocket.

The CSocket and CAsyncSocket classes rely on the standard Windows message-based notification of network events, but Windows CE doesn't support asynchronous event notification. Without access to asynchronous event notification, an application would have to poll for network events that it wished to handle. This would be very inefficient. The CCeSocket class achieves the effect of asynchronous event notification by creating two threads that monitor socket events. When a thread detects one of the three events for which the CCeSocket class provides notifications, it sends a message to the appropriate handler. All instances of CCeSocket share the same two monitor threads.

The CHATTER/CHATSRVR sample programs demonstrate how to use the CCeSocket class. You can find them in the Wce\Samples\Mfc directory.

See Also

CCeSocket Member Functions, Windows Sockets Classes, CArchive, CAsyncSocket, CSocketFile


CCeSocket Member Functions

Construction |
CCeSocket | Constructs a CCeSocket object.
Create | Creates a socket.
Overridables |
OnAccept | Called by the framework to notify a listening socket that it can accept pending connection requests.
OnConnect | Called by the framework to notify the socket that its connection attempt is completed, either successfully or not.

See Also

CCeSocket Overview, Windows Sockets Classes


CCeSocket::CCeSocket

Use this constructor to construct a socket object. When you construct a CCeSocket object, specify whether it is a listening socket or a data socket. After construction, you must call the Create member function.

Syntax

CCeSocket ( PURPOSE_E iPurpose=FOR_DATA );

At a Glance

Header file: | Wcesock.h
Platforms: |
Versions: | 2.0 and later

Parameters

iPurpose
An enumerated constant that specifies whether the socket is to be a listening socket or a data socket. The possible values are:

FOR_LISTENING

FOR_DATA

Remarks

If you do not specify the purpose of the socket, the constructor constructs a data socket by default.

See Also

CCeSocket Overview, CCeSocket Member Functions, Windows Sockets Classes, CCeSocket::Create


CCeSocket::Create

This member function creates the Windows socket after a socket object is constructed, and attaches it to the CCeSocket object. Create then calls Bind to bind the socket to the specified address.

Syntax

virtual BOOL Create ( UINT nSocketPort=0 );

At a Glance

Header file: | Wcesock.h
Platforms: |
Versions: | 2.0 and later

Parameters

nSocketPort
A well-known port to be used with the socket, or zero if you want Windows Sockets to select a port.

Return Values

TRUE if the socket was successfully created; FALSE if the operation failed.

Remarks

If the socket is a listening socket, this function also ensures that the socket is open for reading.

See Also

CCeSocket Overview, CCeSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Attach, CAsyncSocket::Bind, CCeSocket::CCeSocket


CCeSocket::OnAccept

This member function is called by the framework to notify a listening socket that it can accept pending connection requests. Override this member function if you want to do some special processing.

Syntax

virtual void OnAccept( int nErrorCode );

At a Glance

Header file: | Wcesock.h
Platforms: |
Versions: | 2.0 and later

Parameters

nErrorCode
The most recent error on a socket. Zero indicates the function executed successfully. WSAENETDOWN indicates the network subsystem failed.

Return Values

This function has no return value.

Remarks

This function calls CSocket::OnAccept by default.

See Also

CCeSocket Overview, CCeSocket Member Functions, Windows Sockets Classes, CCeSocket::OnConnect, CSocket::OnAccept


CCeSocket::OnConnect

This member function is called by the framework to notify the socket that its connection attempt has completed, whether it succeeded or failed. Override this member function if you want to do some special processing.

Syntax

virtual void OnConnect ( int nErrorCode );

At a Glance

Header file: | Wcesock.h
Platforms: |
Versions: | 2.0 and later

Parameters

nErrorCode
The most recent error on a socket. Zero indicates the function executed successfully. The error code may be any of the following:
WSAEADDRINUSE
The specified address is already in use.
WSAEADDRNOTAVAIL
The specified address is not available from the local machine.
WSAEAFNOSUPPORT
Addresses in the specified family cannot be used with this socket.
WSAECONNREFUSED
The attempt to connect was forcefully rejected.
WSAEDESTADDRREQ
A destination address is required.
WSAEFAULT
The lpSockAddrLen argument to the CSocket::Accept function is incorrect.
WSAEINVAL
The socket is already bound to an address.
WSAEISCONN
The socket is already connected.
WSAEMFILE
No more file descriptors are available.
WSAENETUNREACH
The network cannot be reached from this host at this time.
WSAENOBUFS
No buffer space is available. The socket cannot be connected.
WSAENOTCONN
The socket is not connected.
WSAENOTSOCK
The descriptor is a file, not a socket.
WSAETIMEDOUT
The attempt to connect timed out without establishing a connection.

Return Values

This function has no return value.

Remarks

This function calls CSocket::OnConnect by default.

See Also

CCeSocket Overview, CCeSocket Member Functions, Windows Sockets Classes, CSocket::Accept, CSocket::OnConnect, CCeSocket::OnAccept


CClientDC

The CClientDC class is derived from CDC and takes care of calling the Windows functions GetDC at construction time and ReleaseDC at destruction time. This means that the device context associated with a CClientDC object is the client area of a window.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CClientDC Member Functions, CClientDC Data Members, Graphical Drawing Classes, CDC


CClientDC Member Functions

Construction |
CClientDC | Constructs a CClientDC object connected to the CWnd.

See Also

CClientDC Overview, CClientDC Data Members, Graphical Drawing Classes


CClientDC::CClientDC

Use this constructor to construct a CClientDC object that accesses the client area of the CWnd pointed to by pWnd. The constructor calls the Windows function GetDC.

Syntax

CClientDC( CWnd* pWnd );
throw( CResourceException );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CClientDC Overview, CClientDC Member Functions, Graphical Drawing Classes, CWnd


CClientDC Data Members

Data Members |
m_hWnd | The HWND of the window for which this CClientDC is valid.

See Also

CClientDC Overview, Graphical Drawing Classes


CClientDC::m_hWnd

This data member contains the window handle to the CWnd pointer used to construct the CClientDC object. m_hWnd is a protected variable.

HWND m_hWnd;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CClientDC Overview, CClientDC Data Members, Graphical Drawing Classes


CCmdTarget

CCmdTarget is the base class for the Microsoft Foundation Class library message-map architecture. All classes that handle messages are derived, directly or indirectly, from this class.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Member Functions, Application Architecture Classes, CCmdUI, CDocument, CDocTemplate, CWinApp, CWnd, CView, CFrameWnd


CCmdTarget Member Functions

Construction |
CCmdTarget | Constructs a CCmdTarget object.
Attributes |
FromIDispatch | Returns a pointer to the CCmdTarget object associated with the IDispatch pointer.
GetIDispatch | Returns a pointer to the IDispatch object associated with the CCmdTarget object.
IsResultExpected | Returns nonzero if an Automation function should return a value.
Operations |  |
BeginWaitCursor |  | Displays the cursor as an hourglass cursor.
EnableAutomation |  | Enables Automation for the CCmdTarget object.
EndWaitCursor |  | Returns to the previous cursor.
RestoreWaitCursor |  | Restores the hourglass cursor.
Overridables |  |
OnCmdMsg |  | Routes and dispatches command messages.
OnFinalRelease |  | Cleans up after the last ActiveX reference is released.

See Also

CCmdTarget Overview, Application Architecture Classes


CCmdTarget::BeginWaitCursor

This member function displays the cursor as an hourglass when you expect a command to take a noticeable time interval to execute. The framework calls this member function to show the user that it is busy, such as when a CDocument object loads or saves itself to a file.

Syntax

void BeginWaitCursor( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes, CWaitCursor, CCmdTarget::EndWaitCursor, CCmdTarget::RestoreWaitCursor, CWinApp::DoWaitCursor


CCmdTarget::EnableAutomation

This member function enables Automation for an object. This function is typically called from the constructor of your object and should only be called if a dispatch map has been declared for the class.

Syntax

void EnableAutomation( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes


CCmdTarget::CCmdTarget

This member function constructs a CCmdUI object.

Syntax

void CCmdTarget( );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes


CCmdTarget::EndWaitCursor

This member function should be called after you have called the BeginWaitCursor member function to return from the hourglass cursor to the previous cursor. The framework also calls this member function after it has called the hourglass cursor.

Syntax

void EndWaitCursor( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes, CWaitCursor, CCmdTarget::BeginWaitCursor, CCmdTarget::RestoreWaitCursor, CWinApp::DoWaitCursor


CCmdTarget::FromIDispatch

This member function maps an IDispatch pointer, received from automation member functions of a class, into the CCmdTarget object that implements the interfaces of the IDispatch object.

Syntax

static CCmdTarget* FromIDispatch( LPDISPATCH lpDispatch );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes, CCmdTarget::GetIDispatch, COleDispatchDriver


CCmdTarget::GetIDispatch

This member function retrieves the IDispatch pointer from an automation method that either returns an IDispatch pointer or takes an IDispatch pointer by reference.

Syntax

LPDISPATCH GetIDispatch( BOOL bAddRef );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes, CCmdTarget::EnableAutomation, COleDispatchDriver, IUnknown::Release


CCmdTarget::IsResultExpected

This member function determines whether a client expects a return value from its call to an automation function. The COM interface supplies information to MFC about whether the client is using or ignoring the result of a function call, and MFC in turn uses this information to determine the result of a call to IsResultExpected. If production of a return value is time- or resource-intensive, you can increase efficiency by calling this function before computing the return value.

Syntax

BOOL IsResultExpected( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes, CCmdTarget::EnableAutomation, CCmdTarget::GetIDispatch


CCmdTarget::OnCmdMsg

This member function is called by the framework to route and dispatch command messages and to handle the update of command user-interface objects. This is the main implementation routine of the framework command architecture.

Syntax

virtual BOOL OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes, CCmdUI


CCmdTarget::OnFinalRelease

This member function is called by the framework when the last COM reference to or from the object is released. Override this function to provide special handling for this situation. The default implementation deletes the object.

Syntax

virtual void OnFinalRelease( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes


CCmdTarget::RestoreWaitCursor

This member function restores the appropriate hourglass cursor after the system cursor has changed (for example, after a message box has opened and then closed while in the middle of a lengthy operation).

Syntax

void RestoreWaitCursor( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCmdTarget Overview, CCmdTarget Member Functions, Application Architecture Classes, CWaitCursor, CCmdTarget::EndWaitCursor, CCmdTarget::BeginWaitCursor, CWinApp::DoWaitCursor


CCmdUI

The CCmdUI class is used only within an ON_UPDATE_COMMAND_UI handler in a CCmdTarget-derived class.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Member Functions, CCmdUI Data Members, Support Classes, CCmdTarget


CCmdUI Member Functions

Construction |
CCmdUI | Constructs a CCmdUI object.
Operations |
Enable | Enables or disables the user-interface item for this command.
SetCheck | Sets the check state of the user-interface item for this command.
SetRadio | Like the SetCheck member function, but operates on radio groups.
SetText | Sets the text for the user-interface item for this command.
ContinueRouting | Tells the command-routing mechanism to continue routing the current message down the chain of handlers.

See Also

CCmdUI Overview, CCmdUI Data Members, Support Classes


CCmdUI::CCmdUI

Use this constructor to construct a CCmdUI object and zero out all its data members.

Syntax

void CCmdUI( );

At a Glance

Header file: | Afxwin.h
Platforms: |
Versions: | 1.0 and later

See Also

CCmdUI Overview, CCmdUI Member Functions, Support Classes


CCmdUI::ContinueRouting

This member function tells the command-routing mechanism to continue routing the current message down the chain of handlers.

Syntax

void ContinueRouting( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Member Functions, Support Classes


CCmdUI::Enable

This member function enables or disables the user-interface item for this command.

Syntax

virtual void Enable( BOOL bOn = TRUE );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Member Functions, Support Classes, CCmdUI::SetCheck


CCmdUI::SetCheck

This member function sets the user-interface item for this command to the appropriate check state. This member function works for menu items and toolbar buttons. The indeterminate state applies only to toolbar buttons.

Syntax

virtual void SetCheck( int nCheck = 1 );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Member Functions, Support Classes, CCmdUI::SetRadio


CCmdUI::SetRadio

This member function sets the user-interface item for this command to the appropriate check state.

Syntax

virtual void SetRadio( BOOL bOn = TRUE );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Member Functions, Support Classes, CCmdUI::SetCheck


CCmdUI::SetText

This member function sets the text of the user-interface item for this command.

Syntax

virtual void SetText( LPCTSTR lpszText );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Member Functions, Support Classes, CCmdUI::Enable


CCmdUI Data Members

Data Members |
m_nID | The identifier of the user-interface object.
m_nIndex | The index of the user-interface object.
m_pMenu | Points to the menu represented by the CCmdUI object.
m_pSubMenu | Points to the contained sub-menu represented by the CCmdUI object.
m_pOther | Points to the window object that sent the notification.

See Also

CCmdUI Overview, CCmdUI Member Functions, Support Classes


CCmdUI::m_nID

This data member contains the identifier of the menu item, toolbar button, or other user-interface object represented by the CCmdUI object.

UINT m_nID;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Data Members, Support Classes


CCmdUI::m_nIndex

This data member contains the index of the menu item, toolbar button, or other user-interface object represented by the CCmdUI object.

UINT m_nIndex;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Data Members, Support Classes


CCmdUI::m_pMenu

This data member contains a pointer to the menu (a CMenu object) represented by the CCmdUI object. Its value is NULL if the item is not a menu.

CMenu* m_pMenu;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Data Members, Support Classes


CCmdUI::m_pSubMenu

This data member contains a pointer to the contained sub-menu (a CMenu object) represented by the CCmdUI object. Its value is NULL if the item is not a menu. If the sub menu is a pop-up, m_nID contains the identifier of the first item in the pop-up menu.

CMenu* m_pSubMenu;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Data Members, Support Classes, CMenu, CCmdUI::m_nID


CCmdUI::m_pOther

This data member contains a pointer to the CWnd object, such as a tool or status bar, that sent the notification. Its value is NULL if the item is a menu or a non-CWnd object.

CWnd* m_pOther;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCmdUI Overview, CCmdUI Data Members, Support Classes, CWnd


CComboBox

The CComboBox class encapsulates the functionality of a Windows combo box., which is a control that combines a list box with either an edit control or static control.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Because Windows CE doesn't support owner-drawn combo boxes, you can't specify ODS_COMBOBOXEDIT in the itemState field of a DRAWITEMSTRUCT structure, or specify ODT_COMBOBOX in the CtlType field of a DRAWITEMSTRUCT or a MEASUREITEMSTRUCT structure.

You can use the following FrameWnd member functions to manipulate combo boxes in a Windows CE application's command bar.

Use CFrameWnd::AddComboBoxString to add a string to a combo box in the command bar.

Use CFrameWnd::GetComboCount to retrieve the number of items in the list-box part of a combo box in the command bar.

Use CFrameWnd::GetComboCurSel to determine which item is selected in a command bar combo box.

Use CFrameWnd::InsertComboBox to insert a combo box into the command bar.

Use CFrameWnd::SetComboCurSel to select a string in the list box part of a combo box in the command bar.

See Also

CComboBox Member Functions, Control Classes, CWnd, CButton, CEdit, CListBox, CScrollBar, CStatic, CDialog CFrameWnd::AddComboBoxString CFrameWnd::GetComboCount , CFrameWnd::GetComboCurSel, CFrameWnd::InsertComboBox, CFrameWnd::SetComboCurSel, DRAWITEMSTRUCT, MEASUREITEMSTRUCT


CComboBox Member Functions

Construction |
CComboBox | Constructs a CComboBox object.
Initialization |
Create | Creates the combo box and attaches it to the CComboBox object.
InitStorage | Preallocates blocks of memory for items and strings in the list-box portion of the combo box.
General Operations |
GetCount | Retrieves the number of items in the list box of a combo box.
GetCurSel | Retrieves the index of the currently selected item, if any, in the list box of a combo box.
SetCurSel | Selects a string in the list box of a combo box.
GetEditSel | Gets the starting and ending character positions of the current selection in the edit control of a combo box.
SetEditSel | Selects characters in the edit control of a combo box.
SetItemData | Sets the 32-bit value associated with the specified item in a combo box.
SetItemDataPtr | Sets the 32-bit value associated with the specified item in a combo box to the specified pointer (void*).
GetItemData | Retrieves the application-supplied 32-bit value associated with the specified combo-box item.
GetItemDataPtr | Retrieves the application-supplied 32-bit value associated with the specified combo-box item as a pointer (void*).
GetTopIndex | Returns the index of the first visible item in the list-box portion of the combo box.
SetTopIndex | Tells the list-box portion of the combo box to display the item with the specified index at the top.
SetHorizontalExtent | Sets the width in pixels that the list-box portion of the combo box can be scrolled horizontally.
GetHorizontalExtent | Returns the width in pixels that the list-box portion of the combo box can be scrolled horizontally.
SetDroppedWidth | Sets the minimum allowable width for the drop-down list-box portion of a combo box.
GetDroppedWidth | Retrieves the minimum allowable width for the drop-down list-box portion of a combo box.
Clear | Deletes (clears) the current selection (if any) in the edit control.
Copy | Copies the current selection (if any) onto the Clipboard in CF_TEXT format.
Cut | Deletes (cuts) the current selection, if any, in the edit control and copies the deleted text onto the Clipboard in CF_TEXT format.
Paste | Inserts the data from the Clipboard into the edit control at the current cursor position. Data is inserted only if the Clipboard contains data in CF_TEXT format.
LimitText | Limits the length of the text that the user can enter into the edit control of a combo box.
SetItemHeight | Sets the height of list items in a combo box or the height of the edit-control (or static-text) portion of a combo box.
GetItemHeight | Retrieves the height of list items in a combo box.
GetLBText | Gets a string from the list box of a combo box.
GetLBTextLen | Gets the length of a string in the list box of a combo box.
ShowDropDown | Shows or hides the list box of a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
GetDroppedControlRect | Retrieves the screen coordinates of the visible (dropped-down) list box of a drop-down combo box.
GetDroppedState | Determines whether the list box of a drop-down combo box is visible (dropped down).
SetExtendedUI | Selects either the default user interface or the extended user interface for a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
GetExtendedUI | Determines whether a combo box has the default user interface or the extended user interface.
GetLocale | Retrieves the locale identifier for a combo box.
SetLocale | Sets the locale identifier for a combo box.
String Operations |
AddString | Adds a string to the end of the list in the list box of a combo box or at the sorted position for list boxes with the CBS_SORT style.
DeleteString | Deletes a string from the list box of a combo box.
InsertString | Inserts a string into the list box of a combo box.
ResetContent | Removes all items from the list box and edit control of a combo box.
FindString | Finds the first string that contains the specified prefix in the list box of a combo box.
FindStringExact | Finds the first list-box string (in a combo box) that matches the specified string.
SelectString | Searches for a string in the list box of a combo box and, if the string is found, selects the string in the list box and copies the string to the edit control.
Overridables |
DrawItem | Called by the framework when a visual aspect of an owner-draw combo box changes.
MeasureItem | Called by the framework to determine combo box dimensions when an owner-draw combo box is created.
CompareItem | Called by the framework to determine the relative position of a new list item in a sorted owner-draw combo box.
DeleteItem | Called by the framework when a list item is deleted from an owner-draw combo box.

See Also

CComboBox Overview, Control Classes


CComboBox::AddString

This member function adds a string to the list box of a combo box. If the list box was not created with the CBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list, and the list is sorted.

To insert a string into a specific location within the list, use the InsertString member function.

Syntax

int AddString( LPCTSTR lpszString );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::InsertString, CComboBox::DeleteString


CComboBox::CComboBox

Use this constructor to construct a CComboBox object.

Syntax

CComboBox( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::Create


CComboBox::Clear

This member function deletes (clears) the current selection, if any, in the edit control of the combo box.

To delete the current selection and place the deleted contents onto the Clipboard, use the Cut member function.

Syntax

void Clear( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::Copy, CComboBox::Cut, CComboBox::Paste


CComboBox::CompareItem

This member function is called by the framework to determine the relative position of a new item in the list-box portion of a sorted owner-draw combo box. By default, this member function does nothing. If you create an owner-draw combo box with the LBS_SORT style, you must override this member function to assist the framework in sorting new items added to the list box.

Syntax

virtual int CompareItem( LPCOMPAREITEMSTRUCT lpCompareItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::DrawItem, CComboBox::MeasureItem, CComboBox::DeleteItem


CComboBox::Copy

This member function copies the current selection in the edit control of the combo box onto the Clipboard in CF_TEXT format.

Syntax

void Copy( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::Clear, CComboBox::Cut, CComboBox::Paste


CComboBox::Create

This member function creates the Windows combo box and attaches it to the CComboBox object.

You construct a CComboBox object in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE supports a new extended style for combo boxes, called CBS_EX_CONSTSTRINGDATA. When an application inserts a string into the list part of a combo box that has this style, the combo box stores the pointer passed to it by the application rather than copying the string. This saves RAM resources when you have a large table of strings in ROM that you want to insert into a combo box.. All combo boxes in Windows CE have the LBS_HASSTRINGS style by default. Windows CE doesn't support the CBS_SIMPLE style, the CBS_OWNERDRAWFIXED, or the CBS_OWNERDRAWVARIABLE styles. For more information on supprted combo box, see Combo Box Styles.

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::CComboBox


CComboBox::Cut

This member function deletes (cuts) the current selection in the combo-box edit control and copies the deleted text onto the Clipboard in CF_TEXT format.

To delete the current selection without placing the deleted text onto the Clipboard, call the Clear member function.

Syntax

void Cut( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::Clear, CComboBox::Copy, CComboBox::Paste


CComboBox::DeleteItem

This member function is called by the framework when the user deletes an item from an owner-draw CComboBox object or destroys the combo box. The default implementation of this function does nothing. Override this function to redraw the combo box as needed.

Syntax

virtual void DeleteItem( LPDELETEITEMSTRUCT lpDeleteItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::CompareItem, CComboBox::DrawItem, CComboBox::MeasureItem


CComboBox::DeleteString

This member function deletes a string in the list box of a combo box.

Syntax

int DeleteString( UINT nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::InsertString, CComboBox::AddString


CComboBox::DrawItem

This member function is called by the framework when a visual aspect of an owner-draw combo box changes. The itemAction member of the DRAWITEMSTRUCT structure defines the drawing action that is to be performed.

By default, this member function does nothing. Override this member function to implement drawing for an owner-draw CComboBox object. Before this member function terminates, the application should restore all graphics device interface (GDI) objects selected for the display context supplied in lpDrawItemStruct.

Syntax

virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::CompareItem, CComboBox::MeasureItem, CComboBox::DeleteItem, CWnd::OnDrawItem


CComboBox::FindString

This member function finds the first string that contains the specified prefix in the list box of a combo box, but does not select the item.

Syntax

int FindString( int nStartAfter, LPCTSTR lpszString ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SelectString, CComboBox::SetCurSel


CComboBox::FindStringExact

This member function finds the first string in the list-box portion of a combo box that matches the string specified in lpszFind.

If the combo box was created with an owner-draw style but without the CBS_HASSTRINGS style, FindStringExact attempts to match the doubleword value against the value of lpszFind.

Syntax

int FindStringExact( int nIndexStart, LPCTSTR lpszFind ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::FindString


CComboBox::GetCount

This member function retrieves the number of items in the list-box portion of a combo box.

Syntax

int GetCount( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes


CComboBox::GetCurSel

This member function determines which item in the combo box is selected, and returns an index into the list.

Syntax

int GetCurSel( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetCurSel


CComboBox::GetDroppedControlRect

This member function retrieves the screen coordinates of the visible (dropped-down) list box of a drop-down combo box.

Syntax

void GetDroppedControlRect( LPRECT lprect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes


CComboBox::GetDroppedState

This member function determines whether the list box of a drop-down combo box is visible (dropped down).

Syntax

BOOL GetDroppedState( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes


CComboBox::GetDroppedWidth

This member function retrieves the minimum allowable width, in pixels, of the list box of a combo box. This function only applies to combo boxes with the CBS_DROPDOWN or CBS_DROPDOWNLIST.

By default, the minimum allowable width of the drop-down list box is 0. The minimum allowable width can be set by calling SetDroppedWidth. When the list-box portion of the combo box is displayed, its width is the larger of the minimum allowable width or the combo box width.

Syntax

int GetDroppedWidth( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetDroppedWidth


CComboBox::GetEditSel

This member function retrieves the starting and ending character positions of the current selection in the edit control of a combo box.

Syntax

DWORD GetEditSel( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetEditSel


CComboBox::GetExtendedUI

This member function determines whether a combo box has the default user interface or the extended user interface. The extended user interface can be identified in the following ways:

  • Clicking the static control displays the list box only for combo boxes with the CBS_DROPDOWNLIST style.
  • Pressing the DOWN ARROW key displays the list box (F4 is disabled).

Scrolling in the static control is disabled when the item list is not visible (arrow keys are disabled).

Syntax

BOOL GetExtendedUI( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetExtendedUI


CComboBox::GetHorizontalExtent

This member function retrieves the width, in pixels, by which the list-box portion of the combo box can be scrolled horizontally. This is applicable only if the list-box portion of the combo box has a horizontal scroll bar.

Syntax

UINT GetHorizontalExtent( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CListBox::SetHorizontalExtent


CComboBox::GetItemData

This member function retrieves the application-supplied 32-bit value associated with the specified combo-box item. The 32-bit value can be set with the dwItemData parameter of a SetItemData member function call. Use the GetItemDataPtr member function if the 32-bit value to be retrieved is a pointer (void*).

Syntax

DWORD GetItemData( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetItemData, CComboBox::GetItemDataPtr, CComboBox::SetItemDataPtr


CComboBox::GetItemDataPtr

This member function retrieves the application-supplied 32-bit value associated with the specified combo-box item as a pointer (void*).

Syntax

void* GetItemDataPtr( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetItemDataPtr, CComboBox::SetItemData


CComboBox::GetItemHeight

This member function retrieves the height of list items in a combo box.

Syntax

int GetItemHeight( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetItemHeight


CComboBox::GetLBText

This member function retrieves a string from the list box of a combo box. The second form of this member function fills a CString object with the item's text.

Syntax

int GetLBText( int nIndex, LPTSTR lpszText ) const;

void GetLBText( int nIndex, CString& rString ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetLBTextLen


CComboBox::GetLBTextLen

This member function retrieves the length of a string in the list box of a combo box.

Syntax

int GetLBTextLen( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetLBText


CComboBox::GetLocale

This member function retrieves the locale used by the combo box. The locale is used, for example, to determine the sort order of the strings in a sorted combo box.

Syntax

LCID GetLocale( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetLocale


CComboBox::GetTopIndex

This member function retrieves the zero-based index of the first visible item in the list-box portion of the combo box. Initially, item zero is at the top of the list box, but if the list box is scrolled, another item may be at the top.

Syntax

int GetTopIndex( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::SetTopIndex


CComboBox::InitStorage

This member function allocates memory for storing list box items in the list-box portion of the combo box. Call this function before adding a large number of items to the list-box portion of the CComboBox.

Syntax

int InitStorage( int nItems, UINT nBytes );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::CComboBox, CComboBox::Create, CComboBox::ResetContent


CComboBox::InsertString

This member function inserts a string into the list box of a combo box. Unlike the AddString member function, the InsertString member function does not cause a list with the CBS_SORT style to be sorted.

Syntax

int InsertString( int nIndex, LPCTSTR lpszString );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::AddString, CComboBox::DeleteString, CComboBox::ResetContent


CComboBox::LimitText

This member function limits the length, in bytes, of the text that the user can enter into the edit control of a combo box.

If the combo box does not have the style CBS_AUTOHSCROLL, setting the text limit to be larger than the size of the edit control will have no effect.

LimitText only limits the text the user can enter. It has no effect on any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control when a string in the list box is selected.

Syntax

BOOL LimitText( int nMaxChars );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes


CComboBox::MeasureItem

This member function is called by the framework when a combo box with an owner-draw style is created.

By default, this member function does nothing. Override this member function and fill in the MEASUREITEMSTRUCT structure to inform Windows of the dimensions of the list box in the combo box. If the combo box is created with the CBS_OWNERDRAWVARIABLE style, the framework calls this member function for each item in the list box. Otherwise, this member is called only once.

Using the CBS_OWNERDRAWFIXED style in an owner-draw combo box created with the SubclassDlgItem member function of CWnd involves further programming considerations.

Syntax

virtual void MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::CompareItem, CComboBox::DrawItem, CComboBox::DeleteItem, CWnd::SubclassDlgItem


CComboBox::Paste

This member function inserts the data from the Clipboard into the edit control of the combo box at the current cursor position. Data is inserted only if the Clipboard contains data in CF_TEXT format.

Syntax

void Paste( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::Clear, CComboBox::Copy, CComboBox::Cut


CComboBox::ResetContent

This member function removes all items from the list box and edit control of a combo box.

Syntax

void ResetContent( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes


CComboBox::SelectString

This member function searches for a string in the list box of a combo box. If the string is found, this function selects the string in the list box and copies it to the edit control.

Syntax

int SelectString( int nStartAfter, LPCTSTR lpszString );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::FindString


CComboBox::SetCurSel

This member function selects a string in the list box of a combo box. If necessary, the list box scrolls the string into view (if the list box is visible). The text in the edit control of the combo box is changed to reflect the new selection. Any previous selection in the list box is removed.

Syntax

int SetCurSel( int nSelect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetCurSel


CComboBox::SetDroppedWidth

This member function sets the minimum allowable width, in pixels, of the list box of a combo box. This function only applies to combo boxes with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.

By default, the minimum allowable width of the drop-down list box is 0. When the list-box portion of the combo box is displayed, its width is the larger of the minimum allowable width or the combo box width.

Syntax

int SetDroppedWidth( UINT nWidth );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetDroppedWidth


CComboBox::SetEditSel

This member function selects characters in the edit control of a combo box.

Syntax

BOOL SetEditSel( int nStartChar, int nEndChar );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetEditSel


CComboBox::SetExtendedUI

This member function selects either the default user interface or the extended user interface for a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.

Syntax

int SetExtendedUI( BOOL bExtended = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetExtendedUI


CComboBox::SetHorizontalExtent

This member function sets the width, in pixels, by which the list-box portion of the combo box can be scrolled horizontally. If the width of the list box is smaller than this value, the horizontal scroll bar will horizontally scroll items in the list box. If the width of the list box is equal to or greater than this value, the horizontal scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled.

Syntax

void SetHorizontalExtent( UINT nExtent );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetHorizontalExtent


CComboBox::SetItemData

This member function sets the 32-bit value associated with the specified item in a combo box. Use the SetItemDataPtr member function if the 32-bit item is to be a pointer.

Syntax

int SetItemData( int nIndex, DWORD dwItemData );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetItemData, CComboBox::GetItemDataPtr, CComboBox::SetItemDataPtr, CComboBox::AddString, CComboBox::InsertString


CComboBox::SetItemDataPtr

This member function sets the 32-bit value associated with the specified item in a combo box to be the specified pointer (void*). This pointer remains valid for the life of the combo box, even though the item's relative position within the combo box might change as items are added or removed. Hence, the item's index within the box can change, but the pointer remains reliable.

Syntax

int SetItemDataPtr( int nIndex, void* pData );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetItemData, CComboBox::GetItemDataPtr, CComboBox::SetItemData, CComboBox::AddString, CComboBox::InsertString


CComboBox::SetItemHeight

This member function sets the height of list items in a combo box or the height of the edit-control (or static-text) portion of a combo box.

Syntax

int SetItemHeight( int nIndex, UINT cyItemHeight );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetItemHeight


CComboBox::SetLocale

This member function sets the locale identifier for this combo box. If SetLocale is not called, the default locale is obtained from the system. This system default locale can be modified by using Control Panel's Regional (or International) application.

Syntax

LCID SetLocale( LCID nNewLocale );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetLocale


CComboBox::SetTopIndex

This member function ensures that a particular item is visible in the list-box portion of the combo box. The system scrolls the list box until either the item specified by nIndex appears at the top of the list box or the maximum scroll range has been reached.

Syntax

int SetTopIndex( int nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes, CComboBox::GetTopIndex


CComboBox::ShowDropDown

This member function shows or hides the list box of a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style. By default, a combo box of this style will show the list box.

Syntax

void ShowDropDown( BOOL bShowIt = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CComboBox Overview, CComboBox Member Functions, Control Classes


CCommandLineInfo

The CCommandLineInfo class aids in parsing the command line when an application starts.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE supports the CCommandLineInfo::ParseParam member function differently than the standard MFC library does.

MFC for Windows CE doesn't support the following data members in the CCommandLineInfo class.

m_bRunAutomated

m_bRunEmbedded

m_strDriverName

m_strPortName

m_strPrinterName

See Also

CCommandLineInfo Member Functions, CCommandLineInfo Data Members, Structures, CCommandLineInfo::ParseParam, CWinApp::ParseCommandLine, CWinApp::ProcessShellCommand


CCommandLineInfo Member Functions

Construction |
CommandLineInfo | Constructs a default CCommandLineInfo object.
Operations |
ParseParam | Override this callback to parse individual parameters.

See Also

CCommandLineInfo Overview, CCommandLineInfo Data Members, Structures


CCommandLineInfo::CCommandLineInfo

This constructor creates a CCommandLineInfo object with default values.

Syntax

CCommandLineInfo( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCommandLineInfo Overview, CCommandLineInfo Member Functions, Structures, CCommandLineInfo::ParseParam


CCommandLineInfo::ParseParam

The framework calls this member function to parse/interpret individual parameters from the command line.

Syntax

virtual void ParseParam (LPCTSTR lpszParam,BOOL bFlag,BOOL bLast );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In the current version of MFC for Windows CE, this function does not support the following command-line flags.

/p

/pt

/dde

/Automation

/Embedding

See Also

CCommandLineInfo Overview, CCommandLineInfo Member Functions, Structures, CWinApp::ParseCommandLine


CCommandLineInfo Data Members

Data Members |
m_bShowSplash | Indicates if a splash screen should be shown.
m_nShellCommand | Indicates the shell command to be processed.
m_strFileName | Indicates the filename to be opened or printed; empty if the shell command is New or DDE.

See Also

CCommandLineInfo Overview, CCommandLineInfo Member Functions, Structures


CCommandLineInfo::m_bShowSplash

This data member contains a Boolean value that indicates whether the splash screen should be displayed.

BOOL m_bShowSplash;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCommandLineInfo Overview, CCommandLineInfo Data Members, Structures, CCommandLineInfo::m_nShellCommand, CCommandLineInfo::ParseParam, CWinApp::ProcessShellCommand


CCommandLineInfo::m_nShellCommand

This data member is an enumeration constant that indicates the shell command for this instance of the application.

enum { FileNew, FileOpen, FilePrint, FilePrintTo, FileDDE, AppUnregister, FileNothing = -1 } m_nShellCommand;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCommandLineInfo Overview, CCommandLineInfo Data Members, Structures, CCommandLineInfo::m_strFileName, CWinApp::ProcessShellCommand


CCommandLineInfo::m_strFileName

This data member contains a CString object that stores the value of the first non-flag parameter on the command line. This parameter is typically the name of the file to open.

CString m_strFileName;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCommandLineInfo Overview, CCommandLineInfo Data Members, Structures, CWinApp::ProcessShellCommand, CString


CCommonDialog

CCommonDialog is the base class for CFileDialog and CFindReplaceDialog .

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, common dialog boxes aren't movable (they're always centered vertically and horizontally on the screen) and they don't support hooks.

Windows CE supports the following common dialog box classes, derived from CCommonDialog.

CFileDialog

CFindReplaceDialog

Windows CE doesn't currently support the CFontDialog or CPageSetupDialog classes. It also doesn't support COleDialog or any of its descendants, COleBusyDialog, COleChangeIconDialog, COleChangeSourceDialog, COleConvertDialog, COleInsertDialog, COleLinksDialog, COlePasteSpecialDialog, COlePropertiesDialog, COleUpdateDialog.

See Also

CCommonDialog Member Functions, Dialog Box Classes, CFileDialog,

CFindReplaceDialog,


CCommonDialog Member Functions

Construction |
CCommonDialog | Constructs a CCommonDialog object.

See Also

CCommonDialog Overview, Dialog Box Classes


CCommonDialog::CCommonDialog

This member function constructs a CCommonDialog object.

Syntax

CCommonDialog( CWnd* pParentWnd );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CCommonDialog Overview, CCommonDialog Member Functions, Dialog Box Classes, CDialog::CDialog


CConnectionPoint

The CConnectionPoint class defines a special type of interface used to communicate with other OLE objects, called a "connection point." Unlike normal OLE interfaces, which are used to implement and expose the functionality of an OLE control, a connection point implements an outgoing interface that is able to initiate actions on other objects, such as firing events and change notifications.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Member Functions, CConnectionPoint Macros, Application Architecture Classes


CConnectionPoint Member Functions

Operations |
GetConnections | Retrieves all connection points in a connection map.
Overridables |
GetContainer | Retrieves the container of the control that owns the connection map.
GetIID | Retrieves the interface ID of a connection point.
GetMaxConnections | Retrieves the maximum number of connection points supported by a control.
OnAdvise | Called by the framework when establishing or breaking connections.

See Also

CConnectionPoint Overview, CConnectionPoint Macros, Application Architecture Classes


CConnectionPoint::GetConnections

This member function retrieves all active connections for a connection point.

Syntax

const CPtrArray* GetConnections( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Overview, CConnectionPoint Member Functions, Application Architecture Classes, CConnectionPoint::GetMaxConnections


CConnectionPoint::GetContainer

This member function is called by the framework to retrieve the IConnectionPointContainer interface for the connection point. This function is typically implemented by the BEGIN_CONNECTION_PART macro.

Syntax

virtual LPCONNECTIONPOINTCONTAINER GetContainer( ) = 0;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Overview, CConnectionPoint Member Functions, Application Architecture Classes, BEGIN_CONNECTION_PART


CConnectionPoint::GetIID

This member function is called by the framework to retrieve a connection point's the interface ID. Override this function to return the interface ID for this connection point.

Syntax

virtual REFIID GetIID( ) = 0;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Overview, CConnectionPoint Member Functions, Application Architecture Classes, CONNECTION_IID


CConnectionPoint::GetMaxConnections

This member function is called by the framework to retrieve the maximum number of connections supported by the connection point. Override this function if you want to limit the number of sinks that can connect to your control. The default implementation returns -1, indicating no limit.

Syntax

virtual int GetMaxConnections( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Overview, Application Architecture Classes, CConnectionPoint::GetConnections


CConnectionPoint::OnAdvise

This member function is called by the framework when a connection is being established or broken. Override this function if you want notification when sinks connect to or disconnect from your connection point. The default implementation does nothing.

Syntax

virtual void OnAdvise( BOOL bAdvise );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Overview, CConnectionPoint Member Functions, Application Architecture Classes


CConnectionPoint Macros

Macros |
BEGIN_CONNECTION_MAP | Begins the definition of a connection map.
BEGIN_CONNECTION_PART | Begins the definition of additional connection points beyond the event and property notification connection points.
CONNECTION_IID | Defines an interface ID for a connection point.
CONNECTION_PART | Maps a connection point for your ActiveX control to a specific interface ID.
DECLARE_CONNECTION_MAP | Declares that an ActiveX control supports connection points.
END_CONNECTION_MAP | Ends the definition of a connection map.
END_CONNECTION_PART | Ends the definition of a connection point.


BEGIN_CONNECTION_MAP

Use the BEGIN_CONNECTION_MAP macro in the implementation (.CPP) file that defines the member functions for your class to start the connection map. Add macro entries for each of your connection points using the CONNECTION_PART macro. Complete the connection map with the END_CONNECTION_MAP macro.

Syntax

BEGIN_CONNECTION_MAP( theClass, theBase )

At a Glance

Header file: Add this macro to your class's header file.
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CONNECTION_PART, DECLARE_CONNECTION_MAP, END_CONNECTION_MAP


BEGIN_CONNECTION_PART

Use the BEGIN_CONNECTION_PART macro to begin the definition of additional connection points beyond the event and property notification connection points.

Syntax

BEGIN_CONNECTION_PART( theClass, localClass )

At a Glance

Header file: Add this macro to your class's header file.
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Macros, END_CONNECTION_PART, DECLARE_CONNECTION_MAP


CONNECTION_IID

Use the CONNECTION_IID macro between the BEGIN_CONNECTION_PART and END_CONNECTION_PART macros to define an interface ID for a connection point supported by your control.

Syntax

CONNECTION_IID( iid )

At a Glance

Header file: Add this macro to your class's header file.
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Macros, BEGIN_CONNECTION_MAP, CONNECTION_PART, DECLARE_CONNECTION_MAP, END_CONNECTION_MAP


CONNECTION_PART

Use the CONNECTION_PART macro to map a connection point for your ActiveX control to a specific interface ID.

Syntax

CONNECTION_PART( theClass, iid, localClass )

At a Glance

Header file: Add this macro to your class's header file.
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Macros, BEGIN_CONNECTION_MAP, DECLARE_CONNECTION_MAP, END_CONNECTION_MAP


DECLARE_CONNECTION_MAP

Use the DECLARE_CONNECTION_MAP macro at the end of your class declaration, if your control supports connection points. In the .CPP file that defines the member functions for the class, use the BEGIN_CONNECTION_MAP macro, CONNECTION_PART macros for each of the control's connection points, and the END_CONNECTION_MAP macro to declare the end of the connection map.

Syntax

DECLARE_CONNECTION_MAP( )

At a Glance

Header file: Add this macro to your class's header file.
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Macros, BEGIN_CONNECTION_PART, DECLARE_CONNECTION_MAP


END_CONNECTION_MAP

Use the END_CONNECTION_MAP macro to end the definition of your connection map.

Syntax

END_CONNECTION_MAP( )

At a Glance

Header file: Add this macro to your class's header file.
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Macros, BEGIN_CONNECTION_MAP, CONNECTION_PART, DECLARE_CONNECTION_MAP


END_CONNECTION_PART

Use the END_CONNECTION_PART macro to end the declaration of your connection point.

Syntax

END_CONNECTION_PART( localClass )

At a Glance

Header file: Add this macro to your class's header file.
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CConnectionPoint Macros, BEGIN_CONNECTION_PART, DECLARE_CONNECTION_MAP


CCreateContext

The framework uses the CCreateContext structure when it creates the frame windows and views associated with a document.

Syntax

struct CCreateContext

{

CRuntimeClass* m_pNewViewClass;
CDocument* m_pCurrentDoc;
CDocTemplate* m_pNewDocTemplate;
CView* m_pLastView;
CFrameWnd* m_pCurrentFrame;
CCreateContext();

};

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Structures CFrameWnd::Create, CFrameWnd::LoadFrame, CFrameWnd::OnCreateClient, CSplitterWnd::Create, CSplitterWnd::CreateView, CWnd::Create


CCriticalSection

An object of class, CCriticalSection represents a "critical section" - a synchronization object that allows one thread at a time to access a resource or section of code. Critical sections are useful when only one thread at a time can be allowed to modify data or some other controlled resource.

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCriticalSection Member Functions, Synchronization Classes


CCriticalSection Member Functions

Construction |
CCriticalSection | Constructs a CCriticalSection object.
Methods |
Unlock | Releases the CCriticalSection object.
Lock | Use to gain access to the CCriticalSection object.

See Also

CCriticalSection Overview, Synchronization Classes


CCriticalSection::CCriticalSection

This constructor creates a CCriticalSection object.

Syntax

CCriticalSection( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCriticalSection Overview, CCriticalSection Member Functions, Synchronization Classes


CCriticalSection::Lock

This member function gains access to the critical section object.

Syntax

BOOL Lock( );

BOOL Lock( DWORD dwTimeout );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCriticalSection Overview, CCriticalSection Member Functions, Synchronization Classes, CSingleLock::Lock


CCriticalSection::Unlock

This member function releases the CCriticalSection object for use by another thread.

Syntax

virtual BOOL Unlock( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCriticalSection Overview, CCriticalSection Member Functions, Synchronization Classes


CCtrlView

The class CCtrlView and its derivatives, CEditView, CListView, and CTreeView adapt the document-view architecture to the common controls supported by Windows CE.

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

CCtrlView Member Functions, CCtrlView Data Members, View Classes, CTreeView, CListView, CEditView


CCtrlView Member Functions

Construction |
CCtrlView | Constructs a CCtrlView object.

See Also

CCtrlView Overview, CCtrlView Data Members, View Classes


CCtrlView::CCtrlView

This member function constructs a CCtrlView object. The framework calls the constructor when a new frame window is created or a window is split.

Syntax

CCtrlView( LPCTSTR lpszClass, DWORD dwStyle )

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCtrlView Overview, CCtrlView Member Functions, View Classes, CWnd::PreCreateWindow


CCtrlView Data Members

Data Members |
m_strClass | Contains the Windows class name for the view class.
m_dwDefaultStyle | Contains the default style for the view class.

See Also

CCtrlView Overview, CCtrlView Member Functions, View Classes


CCtrlView::m_dwDefaultStyle

This data member contains the default window style for the view class.

DWORD m_dwDefaultStyle;

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCtrlView Overview, CCtrlView Data Members, View Classes, CCtrlView::m_strClass


CCtrlView::m_strClass

This data member contains a CString object that contains the Windows class name for the view class.

CString m_strClass;

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CCtrlView Overview, CCtrlView Data Members, View Classes, CCtrlView::m_dwDefaultStyle, CString


CDataExchange

The CDataExchange class supports the dialog data exchange (DDX) and dialog data validation (DDV) routines used by the MFC for Windows CE.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDataExchange Member Functions, CDataExchange Data Members, Support Classes, CWnd::DoDataExchange, CWnd::UpdateData


CDataExchange Member Functions

Operations |
PrepareCtrl | Prepares the specified control for data exchange or validation. Use for nonedit controls.
PrepareEditCtrl | Prepares the specified edit control for data exchange or validation.
Fail | Called when validation fails. Resets focus to the previous control and throws an exception.

See Also

CDataExchange Overview, CDataExchange Data Members, Support Classes


CDataExchange::Fail

The framework calls this member function when a dialog data validation (DDV) operation fails.

Syntax

void Fail( );
throw( CUserException );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDataExchange Overview, CDataExchange Member Functions, Support Classes, CDataExchange::PrepareCtrl, CDataExchange::PrepareEditCtrl


CDataExchange::PrepareCtrl

The framework calls this member function to prepare the specified control for dialog data exchange (DDX) and validation (DDV).

Syntax

HWND PrepareCtrl( int nIDC );
throw( CNotSupportedException );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDataExchange Overview, CDataExchange Member Functions, Support Classes, CDataExchange::Fail


CDataExchange::PrepareEditCtrl

The framework calls this member function to prepare the specified edit control for dialog data exchange (DDX) and validation (DDV).

Syntax

HWND PrepareEditCtrl( int nIDC );
throw( CNotSupportedException );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDataExchange Overview, CDataExchange Member Functions, Support Classes, CDataExchange::Fail


CDataExchange Data Members

Data Members |
m_bSaveAndValidate | Flag for the direction of DDX and DDV.
m_pDlgWnd | The dialog box or window where the data exchange takes place.

See Also

CDataExchange Overview, CDataExchange Member Functions, Support Classes


CDataExchange::m_bSaveAndValidate

This data member contains a flag that indicates the direction of a dialog data exchange (DDX) operation.

BOOL m_bSaveAndValidate;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDataExchange Overview, CDataExchange Data Members, Support Classes


CDataExchange::m_pDlgWnd

This data member contains a pointer to the CWnd object for which dialog data exchange (DDX) or validation (DDV) is taking place.

CWnd* m_pDlgWnd;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDataExchange Overview, CDataExchange Data Members, Support Classes, CWnd


CDC

The CDC class encapsulates the functionality of a Windows device-context, which is a GDI-managed structure containing information about the operating modes and current selections of a device, such as a display or printer.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE supports the following member functions of the CDC class differently than the standard MFC library.

CDC::BitBlt

CDC::DrawEdge

CDC::DrawText

CDC::ExtTextOut

CDC::GetDeviceCaps

CDC::GetHalftoneBrush

CDC::GetMapMode

CDC::MaskBlt

CDC::Polygon

CDC::PolyPolygon

CDC::SelectStockObject

CDC::StretchBlt

The following member functions do not do anything in Windows CE. They are included for compatibility with existing MFC code.

CDC::DPtoLP

CDC::GetViewportExt

CDC::GetViewportOrg

CDC::GetWindowExt

CDC::GetWindowOrg

CDC::LPtoDP

MFC for Windows CE does not support the following member functions of the CDC class.

AbortDoc | HIMETRICtoDP
AbortPath | HIMETRICtoLP
AddMetaFileComment | InvertRgn
AngleArc | IsPrinting
Arc | LPtoHIMETRIC
ArcTo | OffsetViewportOrg
BeginPath | OffsetWindowOrg
Chord | PaintRgn
CloseFigure | Pie
CreateDC | PlayMetaFile
CreateIC | PlgBlt
DrawEscape | PolyBezier
DrawFrameControl | PolyBezierTo
DrawState | PolyDraw
DPtoHIMETRIC | PtVisible
EndDoc | QueryAbort
EndPage | RealizePalette
EndPath | RectVisible
EnumObjects | ResetDC
Escape | ScaleViewportExt
ExtFloodFill | ScaleWindowExt
FillPath | SelectClipPath
FillRgn | SelectPalette
FlattenPath | SetAbortProc
FloodFill | SetArcDirection
FrameRgn | SetBoundsRect
GetArcDirection | SetColorAdjustment
GetAspectRatioFilter | SetMapMode
GetBoundsRect | SetMapperFlags
GetCharABCWidths | SetMiterLimit
GetCharWidth | SetPixelV
GetColorAdjustment | SetPolyFillMode
GetCurrentPalette | SetROP2
GetFontData | SetStretchBltMode
GetGlyphOutline | SetTextAlign
GetKerningPairs | SetTextCharacterExtra
GetMiterLimit | SetTextJustification
GetOutlineTextMetrics | SetViewportOrg
GetOutputTabbedTextExtent | SetViewportExt
GetOutputCharWidth | SetWindowOrg
GetPath | SetWindowExt
GetPolyFillMode | StartDoc
GetTabbedTextExtent | StartPage
GetTextAlign | StrokeAndFillPath
GetTextCharacterExtra | StrokePath
GetROP2 | TabbedTextOut
GetStretchBltMode | TextOut
GetWindow | UpdateColors
GrayString | WidenPath

See Also

CDC Member Functions, CDC Data Members, Graphical Drawing Classes, CPaintDC, CWindowDC, CClientDC


CDC Member Functions

Construction |
CDC | Constructs a CDC object.
Initialization |
CreateCompatibleDC | Creates a memory-device context that is compatible with another device context. You can use it to prepare images in memory.
DeleteDC | Deletes the Windows device context associated with this CDC object.
FromHandle | Returns a pointer to a CDC object when given a handle to a device context. If a CDC object is not attached to the handle, a temporary CDC object is created and attached.
DeleteTempMap | Called by the CWinApp idle-time handler to delete any temporary CDC object created by FromHandle. Also detaches the device context.
Attach | Attaches a Windows device context to this CDC object.
Detach | Detaches the Windows device context from this CDC object.
SetAttribDC | Sets m_hAttribDC, the attribute device context.
SetOutputDC | Sets m_hDC, the output device context.
ReleaseAttribDC | Releases m_hAttribDC, the attribute device context.
ReleaseOutputDC | Releases m_hDC, the output device context.
GetCurrentBitmap | Returns a pointer to the currently selected CBitmap object.
GetCurrentBrush | Returns a pointer to the currently selected CBrush object.
GetCurrentFont | Returns a pointer to the currently selected CFont object.
GetCurrentPen | Returns a pointer to the currently selected CPen object.
Device-Context Functions |
GetSafeHdc | Returns m_hDC, the output device context.
SaveDC | Saves the current state of the device context.
RestoreDC | Restores the device context to a previous state saved with SaveDC.
GetDeviceCaps | Retrieves a specified kind of device-specific information about a given display device's capabilities.
Drawing-Tool Functions |
GetBrushOrg | Retrieves the origin of the current brush.
SetBrushOrg | Specifies the origin for the next brush selected into a device context.
Type-Safe Selection Helpers |
SelectObject | Selects a GDI drawing object such as a pen.
SelectStockObject | Selects one of the predefined stock pens, brushes, or fonts provided by Windows.
Color and Color Palette Functions |
GetNearestColor | Retrieves the closest logical color to a specified logical color that the given device can represent.
GetHalftoneBrush | Retrieves a halftone brush.
Drawing-Attribute Functions |
GetBkColor | Retrieves the current background color.
SetBkColor | Sets the current background color.
GetBkMode | Retrieves the background mode.
SetBkMode | Sets the background mode.
GetTextColor | Retrieves the current text color.
SetTextColor | Sets the text color.
Mapping Functions |
GetMapMode | Retrieves the current mapping mode.
GetViewportOrg | In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
GetViewportExt | In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
GetWindowOrg | In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
GetWindowExt | In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
Coordinate Functions |
DPtoLP | In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
LPtoDP | In Windows CE, this function doesn't do anything. It's included for compatibility with existing code.
Clipping Functions |
GetClipBox | Retrieves the dimensions of the tightest bounding rectangle around the current clipping boundary.
SelectClipRgn | Combines the given region with the current clipping region by using the specified mode.
ExcludeClipRect | Creates a new clipping region that consists of the existing clipping region minus the specified rectangle.
ExcludeUpdateRgn | Prevents drawing within invalid areas of a window by excluding an updated region in the window from a clipping region.
IntersectClipRect | Creates a new clipping region by forming the intersection of the current region and a rectangle.
OffsetClipRgn | Moves the clipping region of the given device.
Line-Output Functions |
GetCurrentPosition | Retrieves the current position of the pen (in logical coordinates).
MoveTo | Moves the current position.
LineTo | Draws a line from the current position up to, but not including, a point.
Polyline | Draws a set of line segments connecting the specified points.
PolyPolyline | Draws multiple series of connected line segments. The current position is neither used nor updated by this function.
PolylineTo | Draws one or more straight lines and moves the current position to the ending point of the last line.
Simple Drawing Functions |
FillRect | Fills a given rectangle by using a specific brush.
FrameRect | Draws a border around a rectangle.
InvertRect | Inverts the contents of a rectangle.
DrawIcon | Draws an icon.
DrawDragRect | Erases and redraws a rectangle as it is dragged.
FillSolidRect | Fills a rectangle with a solid color.
Draw3dRect | Draws a three-dimensional rectangle.
DrawEdge | Draws the edges of a rectangle.
Ellipse and Polygon Functions |
DrawFocusRect | Draws a rectangle in the style used to indicate focus.
Ellipse | Draws an ellipse.
Polygon | Draws a polygon consisting of two or more points (vertices) connected by lines.
PolyPolygon | Creates two or more polygons that are filled using the current polygon-filling mode. The polygons may be disjoint or they may overlap.
Polyline | Draws a polygon consisting of a set of line segments connecting specified points.
Rectangle | Draws a rectangle using the current pen and fills it using the current brush.
RoundRect | Draws a rectangle with rounded corners using the current pen and filled using the current brush.
Bitmap Functions |
PatBlt | Creates a bit pattern.
BitBlt | Copies a bitmap from a specified device context.
StretchBlt | Moves a bitmap from a source rectangle and device into a destination rectangle, stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
GetPixel | Retrieves the RGB color value of the pixel at the specified point.
SetPixel | Sets the pixel at the specified point to the closest approximation of the specified color.
MaskBlt | Combines the color data for the source and destination bitmaps using the given mask and raster operation.
Text Functions |
ExtTextOut | Writes a character string within a rectangular region using the currently selected font.
DrawText | Draws formatted text in the specified rectangle.
GetTextExtent | Computes the width and height of a line of text on the attribute device context using the current font to determine the dimensions.
GetOutputTextExtent | Computes the width and height of a line of text on the output device context using the current font to determine the dimensions.
GetTextFace | Copies the typeface name of the current font into a buffer as a null-terminated string.
GetTextMetrics | Retrieves the metrics for the current font from the attribute device context.
GetOutputTextMetrics | Retrieves the metrics for the current font from the output device context.
Scrolling Functions |
ScrollDC | Scrolls a rectangle of bits horizontally and vertically.

See Also

CDC Overview, CDC Data Members, Graphical Drawing Classes


CDC::Attach

This member function attaches an hDC to the CDC object.

Syntax

BOOL Attach( HDC hDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::Detach, CDC::m_hDC, CDC::m_hAttribDC


CDC::BitBlt

This member function copies a bitmap from the source device context to the current device context.

Syntax

BOOL BitBlt ( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE only supports the following raster operations in the dwRop parameter.

SRCAND

SRCCOPY

SRCINVERT

SRCPAINT

Windows CE 1.0 only supports two bit per pixel (maximum) gray scale graphics. When performing a bit-block transfer that converts two bit-per-pixel (2bpp) to one bit-per-pixel (1bpp), Windows CE 1.0 maps the background color to white, and all other colors to black. When converting from 1bpp to 2bpp, it maps white to white and black to black, as expected.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetDeviceCaps, CDC::PatBlt, CDC::SetTextColor, CDC::StretchBlt


CDC::CDC

This constructor creates a CDC object.

Syntax

CDC( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::CreateCompatibleDC


CDC::CreateCompatibleDC

This member function creates a memory device context that is compatible with the device specified by pDC.

Syntax

virtual BOOL CreateCompatibleDC( CDC* pDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::CDC, CDC::GetDeviceCaps, CDC::BitBlt, CDC::DeleteDC


CDC::DeleteDC

In general, do not call this function; the destructor will do it for you. The DeleteDC member function deletes the Windows device contexts that are associated with m_hDC in the current CDC object. If this CDC object is the last active device context for a given device, the device is notified and all storage and system resources used by the device are released.

Syntax

virtual BOOL DeleteDC( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::CDC, CDC::CreateCompatibleDC, CWnd::GetDC, CWnd::ReleaseDC


CDC::DeleteTempMap

This member function is called automatically by the CWinApp idle-time handler, DeleteTempMap deletes any temporary CDC objects created by FromHandle, but does not destroy the device context handles (hDCs) temporarily associated with the CDC objects.

Syntax

static void PASCAL DeleteTempMap( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::Detach, CDC::FromHandle, CWinApp::OnIdle


CDC::Detach

This member function detaches m_hDC (the output device context) from the CDC object and set both m_hDC and m_hAttribDC to NULL.

Syntax

HDC Detach( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::Attach, CDC::m_hDC, CDC::m_hAttribDC


CDC::DPtoLP

This member function of the CDC class does not do anything in Windows CE. It is included for compatibility with existing code.

Syntax

void DPtoLP ( LPPOINT lpPoints, int nCount = 1 ) const;

void DPtoLP ( LPRECT lpRect ) const;

void DPtoLP ( LPSIZE lpSize ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you cannot change the window and viewport origins or extents, which means that device coordinates are always the same as logical coordinates. Because of this, the CDC::DPtoLP member function does not do anything with the values you pass it. It is only included in Windows CE for compatibility with existing MFC code.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::LPtoDP, CDC::GetWindowExt, CDC::GetWindowOrg


CDC::Draw3dRect

This member function draws a three-dimensional rectangle.

Syntax

void Draw3dRect( LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight );

void Draw3dRect( int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CRect


CDC::DrawDragRect

Call this member function repeatedly to redraw a drag rectangle. Call it in a loop as you sample mouse position, in order to give visual feedback.

Syntax

void DrawDragRect( LPCRECT lpRect, SIZE size, LPCRECT lpRectLast, SIZE sizeLast, CBrush* pBrush = NULL, CBrush* pBrushLast = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CRect, CDC::GetHalftoneBrush


CDC::DrawEdge

This member function draws the edges of a rectangle in the specified style.

Syntax

BOOL DrawEdge ( LPRECT lpRect, UINT nEdge, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the EDGE_BUMP flag in the nEdge parameter.

You also cannot specify the BF_BOTTOMLEFT, BF_TOPLEFT, or BF_TOPRIGHT flags in the nFlags parameter.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes


CDC::DrawFocusRect

This member function draws a rectangle in the style used to indicate that the rectangle has the focus.

Syntax

void DrawFocusRect( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::FrameRect


CDC::DrawIcon

This member function draws an icon on the device represented by the current CDC object.

Syntax

BOOL DrawIcon( int x, int y, HICON hIcon );

BOOL DrawIcon( POINT point, HICON hIcon );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CWinApp::LoadIcon, CWinApp::LoadStandardIcon, CWinApp::LoadOEMIcon, CDC::GetMapMode


CDC::DrawText

This member function formats text inside the specified rectangle.

Syntax

virtual int DrawText ( LPCTSTR lpszString, int nCount, LPRECT lpRect, UINT nFormat );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 does not support the DT_EXTERNALLEADING flag in the nFormat parameter.

In Windows CE 1.0, when you specify DT_CALCRECT in the nFormat parameter, CDC::DrawText automatically calculates both the right and bottom fields of the RECT structure you pass in the lpRect parameter.

Note In Windows 95 and Windows NT, you can cause CDC::DrawText to update the current text position by first calling CDC::SetTextAlign with the TA_UPDATECP flag set, but Windows CE does not support the CDC::SetTextAlign member function. In Windows CE, this function never updates the current text position.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SetTextColor, CDC::ExtTextOut


CDC::Ellipse

This member function draws an ellipse.

Syntax

BOOL Ellipse( int x1, int y1, int x2, int y2 );

BOOL Ellipse( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes


CDC::ExcludeClipRect

This member function creates a new clipping region that consists of the existing clipping region minus the specified rectangle.

Syntax

virtual int ExcludeClipRect( int x1, int y1, int x2, int y2 );

virtual int ExcludeClipRect( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::ExcludeUpdateRgn


CDC::ExcludeUpdateRgn

This member function prevents drawing within invalid areas of a window by excluding an updated region in the window from the clipping region associated with the CDC object.

int ExcludeUpdateRgn( CWnd* pWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::ExcludeClipRect


CDC::ExtTextOut

This member function writes a character string inside the specified rectangular region.

Syntax

virtual BOOL ExtTextOut ( int x, int y, UINT nOptions, LPCRECT lpRect, LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths );

BOOL ExtTextOut ( int x, int y, UINT nOptions, LPCRECT lpRect, const CString& str, LPINT lpDxWidths );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 does not support the ETO_GLYPH_INDEX or ETO_RTLREADING flags in the nOptions parameter.

Note In Windows 95 and Windows NT, you can cause CDC::DrawText to update the current text position by first calling CDC::SetTextAlign with the TA_UPDATECP flag set, but Windows CE does not support the CDC::SetTextAlign member function. In Windows CE, this function never updates the current text position.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetBkColor, CDC::SetBkColor, CDC::SetTextColor


CDC::FillRect

This member function fills a given rectangle using the specified brush.

Syntax

void FillRect( LPCRECT lpRect, CBrush* pBrush );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CBrush::CreateSolidBrush, CBrush, CDC::FillSolidRect


CDC::FillSolidRect

This member function fills the given rectangle with the specified solid color.

Syntax

void FillSolidRect( LPCRECT lpRect, COLORREF clr );

void FillSolidRect( int x, int y, int cx, int cy, COLORREF clr );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CRect, CDC::FillRect


CDC::FrameRect

This member function draws a border around the rectangle specified by lpRect.

Syntax

void FrameRect( LPCRECT lpRect, CBrush* pBrush );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CBrush, CDC::Rectangle


CDC::FromHandle

This member function obtains a pointer to a CDC object when you have a handle to a device context. If a CDC object is not attached to the handle, a temporary CDC object is created and attached.

Syntax

static CDC* PASCAL FromHandle( HDC hDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::DeleteTempMap


CDC::GetBkColor

This member function retrieves the current background color.

Syntax

COLORREF GetBkColor( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetBkMode, CDC::SetBkColor, CDC::SetBkMode


CDC::GetBkMode

This member function retrieves the background mode. The background mode defines whether the system removes existing background colors on the drawing surface before drawing text, hatched brushes, or any pen style that is not a solid line.

Syntax

int GetBkMode( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetBkColor, CDC::SetBkColor, CDC::SetBkMode


CDC::GetBrushOrg

This member function retrieves the origin (in device units) of the brush currently selected for the device context.

Syntax

CPoint GetBrushOrg( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SetBrushOrg, CPoint


CDC::GetClipBox

This member function retrieves the dimensions of the tightest bounding rectangle around the current clipping boundary. The dimensions are copied to the buffer pointed to by lpRect.

Syntax

virtual int GetClipBox( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SelectClipRgn


CDC::GetCurrentBitmap

This member function retrieves a pointer to the currently selected CBitmap object. This member function may return temporary objects.

Syntax

CBitmap* GetCurrentBitmap( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SelectObject


CDC::GetCurrentBrush

This member function retrieves a pointer to the currently selected CBrush object. This member function may return temporary objects.

Syntax

CBrush* GetCurrentBrush( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SelectObject


CDC::GetCurrentFont

This member function retrieves a pointer to the currently selected CFont object. This member function may return temporary objects.

Syntax

CFont* GetCurrentFont( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SelectObject


CDC::GetCurrentPen

This member function retrieves a pointer to the currently selected CPen object. This member function may return temporary objects.

Syntax

CPen* GetCurrentPen( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SelectObject


CDC::GetCurrentPosition

This member function retrieves the current position (in logical coordinates). The current position can be set with the MoveTo member function.

Syntax

CPoint GetCurrentPosition( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::MoveTo, CPoint


CDC::GetDeviceCaps

This member function retrieves a wide range of device-specific information about the display device.

Syntax

int GetDeviceCaps ( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 does not support the following values for the nIndex parameter:

BLTALIGNMENT

DESKTOPHORZRES

DESKTOPVERTRES

PHYSICALHEIGHT

PHYSICALOFFSETX

PHYSICALOFFSETY

PHYSICALWIDTH

VREFRESH

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes


CDC::GetHalftoneBrush

This member function retrieves a halftone brush. A halftone brush is a brush that shows foreground pixels alternately with background pixels to create a dithered pattern.

Syntax

static CBrush* PASCAL GetHalftoneBrush ( CDC* pDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Parameters

pDC
A pointer to a device context.

Remarks

In Windows CE, this member function requires a pointer to a device context as an argument. (The CDC::GetHalftoneBrush in standard MFC does not take any arguments.) You have to call the CDC::GetHalftoneBrush member function separately for each device context you use. Also, if the foreground or background colors of the device context change, call CDC::GetHalftoneBrush again, because a previously created halftone brush may no longer be displayed properly.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CBrush


CDC::GetMapMode

This member function retrieves the current mapping mode.

Syntax

int GetMapMode ( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The only mapping mode Windows CE supports is MM_TEXT, so the CDC::GetMapMode member function always returns MM_TEXT unless an error occurs, in which case it returns 0.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes


CDC::GetNearestColor

This member function retrieves the solid color that best matches a specified logical color. The given device must be able to represent this color.

Syntax

COLORREF GetNearestColor( COLORREF crColor ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes


CDC::GetOutputTextExtent

This member function uses the output device context, m_hDC, and computes the width and height of a line of text, using the current font.

Syntax

CSize GetOutputTextExtent( LPCTSTR lpszString, int nCount ) const;

CSize GetOutputTextExtent( const CString& str ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::m_hAttribDC, CDC::m_hDC, CDC::GetTextExtent, CSize


CDC::GetOutputTextMetrics

This member function retrieves the metrics for the current font using m_hDC, the output device context.

Syntax

BOOL GetOutputTextMetrics( LPTEXTMETRIC lpMetrics ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::m_hAttribDC, CDC::m_hDC, CDC::GetTextMetrics, CDC::GetTextExtent, CDC::GetTextFace


CDC::GetPixel

This member function retrieves the RGB color value of the pixel at the point specified by x and y.

Syntax

COLORREF GetPixel( int x, int y ) const;

COLORREF GetPixel( POINT point ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetDeviceCaps, CDC::SetPixel, CPoint


CDC::GetSafeHdc

This member function retrieves the m_hDC data member, which contains the output device context.

Syntax

HDC GetSafeHdc( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::m_hDC


CDC::GetTextColor

This member function retrieves the current text color.

Syntax

COLORREF GetTextColor( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetBkColor, CDC::GetBkMode, CDC::SetBkMode, CDC::SetTextColor


CDC::GetTextExtent

This member function computes the width and height of a line of text using the current font to determine the dimensions.

Syntax

CSize GetTextExtent( LPCTSTR lpszString, int nCount ) const;

CSize GetTextExtent( const CString& str ) const;

object.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::m_hAttribDC, CDC::m_hDC, CDC::GetOutputTextExtent, CSize


CDC::GetTextFace

This member function copies the typeface name of the current font into a buffer. The typeface name is copied as a null-terminated string.

Syntax

int GetTextFace( int nCount, LPTSTR lpszFacename ) const;

int GetTextFace( CString& rString ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetTextMetrics


CDC::GetTextMetrics

This member function retrieves the metrics for the current font using the attribute device context.

Syntax

BOOL GetTextMetrics( LPTEXTMETRIC lpMetrics ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::m_hAttribDC, CDC::m_hDC, CDC::GetOutputTextMetrics, CDC::GetTextExtent, CDC::GetTextFace


CDC::GetViewportExt

This member function of the CDC class does not do anything in Windows CE. It is included for compatibility with existing code.

Syntax

CSize GetViewportExt ( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you cannot change the viewport extent, so this member function does not actually do anything. It always returns (1,1). It is only included in Windows CE for compatibility with existing MFC code.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CSize


CDC::GetViewportOrg

This member function of the CDC class does not do anything in Windows CE. It is included for compatibility with existing code.

Syntax

CSize GetViewportOrg ( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you cannot change the viewport origin so this member function does not actually do anything. It always returns (0,0). It is only included in Windows CE for compatibility with existing MFC code.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetWindowOrg, CPoint


CDC::GetWindowExt

This member function of the CDC class does not do anything in Windows CE. It is included for compatibility with existing code.

Syntax

CSize GetWindowExt ( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you cannot change the viewport extent so this member function does not actually do anything. It always returns (1,1). It is only included in Windows CE for compatibility with existing MFC code.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CSize, CDC::GetViewportExt


CDC::GetWindowOrg

This member function of the CDC class does not do anything in Windows CE. It is included for compatibility with existing code.

Syntax

CSize GetWindowOrg ( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you cannot change the window origin so this member function does not actually do anything. It always returns (0,0). It is only included in Windows CE for compatibility with existing MFC code.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetViewportOrg, CPoint


CDC::IntersectClipRect

This member function creates a new clipping region by forming the intersection of the current region and the rectangle specified by x1, y1, x2, and y2. GDI clips all subsequent output to fit within the new boundary. The width and height must not exceed 32,767.

Syntax

virtual int IntersectClipRect( int x1, int y1, int x2, int y2 );

virtual int IntersectClipRect( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes


CDC::InvertRect

This member function inverts the contents of the given rectangle. Inversion is a logical NOT operation and flips the bits of each pixel.

Syntax

void InvertRect( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::FillRect, CRect


CDC::LineTo

This member function draws a line from the current position up to, but not including, the point specified by x and y (or point).

Syntax

BOOL LineTo( int x, int y );

BOOL LineTo( POINT point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::MoveTo, CDC::GetCurrentPosition, CPoint


CDC::LPtoDP

This member function of the CDC class does not do anything in Windows CE. It is included for compatibility with existing code.

Syntax

void LPtoDP ( LPPOINT lpPoints, int nCount = 1 ) const;

void LPtoDP ( LPRECT lpRect ) const;

void LPtoDP ( LPSIZE lpSize ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you cannot change the window and viewport origins or extents, which means that device coordinates are always the same as logical coordinates. Because of this, the CDC::LPtoDP member function does not do anything with the values you pass it. It is only included in Windows CE for compatibility with existing MFC code.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::DPtoLP, CDC::GetWindowOrg, CDC::GetWindowExt


CDC::MaskBlt

This member function combines the color data for the source and destination bitmaps using the given mask and raster operation.

Syntax

BOOL MaskBlt ( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, CBitmap& maskBitmap, int xMask, int yMask, DWORD dwRop );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The only raster operations Windows CE supports in the dwRop parameter are SRCCOPY and SRCINVERT (without a mask) and 0xCCAA0000 (with a mask).

Windows CE 1.0 only supports two bit per pixel (maximum) gray scale graphics. When performing a bit-block transfer that converts two bit-per-pixel (2bpp) to one bit-per-pixel (1bpp), Windows CE 1.0 maps the background color to white, and all other colors to black. When converting from 1bpp to 2bpp, it maps white to white and black to black, as expected.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::BitBlt, CDC::GetDeviceCaps, CDC::StretchBlt


CDC::MoveTo

This member function moves the current position to the point specified by x and y (or by point).

Syntax

CPoint MoveTo( int x, int y );

CPoint MoveTo( POINT point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetCurrentPosition, CDC::LineTo, CPoint


CDC::OffsetClipRgn

This member function moves the clipping region of the device context by the specified offsets.

Syntax

virtual int OffsetClipRgn( int x, int y );

virtual int OffsetClipRgn( SIZE size );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SelectClipRgn


CDC::PatBlt

This member function creates a bit pattern on the device. The pattern is a combination of the selected brush and the pattern already on the device. The raster-operation code specified by dwRop defines how the patterns are to be combined.

Syntax

BOOL PatBlt( int x, int y, int nWidth, int nHeight, DWORD dwRop );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetDeviceCaps


CDC::Polygon

This member function draws a polygon consisting of two or more points connected by lines. The system closes the polygon automatically, if necessary, by drawing a line from the last vertex to the first.

Syntax

BOOL Polygon ( LPPOINT lpPoints, int nCount );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 only supports convex polygons.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::Polyline, CDC::PolyPolygon, CPoint


CDC::Polyline

This member function draws a set of line segments connecting the points specified by lpPoints. The lines are drawn from the first point through subsequent points using the current pen. Unlike the LineTo member function, the Polyline function neither uses nor updates the current position.

Syntax

BOOL Polyline( LPPOINT lpPoints, int nCount );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::LineTo, CDC::Polygon, CPoint


CDC::PolylineTo

This member function draws one or more straight lines.

Syntax

BOOL PolylineTo( const POINT* lpPoints, int nCount );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::LineTo, CDC::Polyline, CDC::MoveTo


CDC::PolyPolygon

This member function creates two or more polygons that are filled using the current polygon-filling mode. The polygons may be disjointed or overlapping.

Syntax

BOOL PolyPolygon ( LPPOINT lpPoints, LPINT lpPolyCounts, int nCount );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 only supports convex polygons.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::Polygon, CDC::Polyline


CDC::PolyPolyline

This member function draws multiple series of connected line segments.

Syntax

BOOL PolyPolyline( const POINT* lpPoints, const DWORD* lpPolyPoints, int nCount );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::Polyline, CDC::PolylineTo


CDC::Rectangle

This member function draws a rectangle using the current pen. The interior of the rectangle is filled using the current brush.

Syntax

BOOL Rectangle( int x1, int y1, int x2, int y2 );

BOOL Rectangle( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::PolyLine, CDC::RoundRect, CRect


CDC::ReleaseAttribDC

This member function sets the m_hAttribDC data member to NULL.

Syntax

virtual void ReleaseAttribDC( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SetOutputDC, CDC::SetAttribDC, CDC::ReleaseOutputDC, CDC::m_hAttribDC


CDC::ReleaseOutputDC

This member function sets the m_hDC member to NULL.

Syntax

virtual void ReleaseOutputDC( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SetAttribDC, CDC::SetOutputDC, CDC::ReleaseAttribDC, CDC::m_hDC


CDC::RestoreDC

This member function restores the device context to the previous state identified by nSavedDC.

Syntax

virtual BOOL RestoreDC( int nSavedDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SaveDC


CDC::RoundRect

This member function draws a rectangle with rounded corners using the current pen. The interior of the rectangle is filled using the current brush.

Syntax

BOOL RoundRect( int x1, int y1, int x2, int y2, int x3, int y3 )

BOOL RoundRect( LPCRECT lpRect, POINT point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::Rectangle, CRect, CPoint


CDC::SaveDC

This member function saves the current state of the device context by copying state information (such as clipping region, selected objects, and mapping mode) to a context stack maintained by Windows.

Syntax

virtual int SaveDC( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::RestoreDC


CDC::ScrollDC

This member function scrolls a rectangle of bits horizontally and vertically.

Syntax

BOOL ScrollDC( int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, CRgn* pRgnUpdate, LPRECT lpRectUpdate );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CWnd::ScrollWindow


CDC::SelectClipRgn

This member function selects the given region as the current clipping region for the device context.

Syntax

virtual int SelectClipRgn( CRgn* pRgn );

int SelectClipRgn( CRgn* pRgn, int nMode );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetClipBox, CRgn


CDC::SelectObject

This member function selects an object into the device context. Class CDC provides five versions specialized for particular kinds of GDI objects, including pens, brushes, fonts, bitmaps, and regions. The newly selected object replaces the previous object of the same type.

Syntax

CPen* SelectObject( CPen* pPen );

CBrush* SelectObject( CBrush* pBrush );

virtual CFont* SelectObject( CFont* pFont );

CBitmap* SelectObject( CBitmap* pBitmap );

int SelectObject( CRgn* pRgn );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CGdiObject::DeleteObject, CGdiObject::FromHandle, CDC::SelectClipRgn


CDC::SelectStockObject

This member function selects a CGdiObject object that corresponds to one of the predefined stock pens, brushes, or fonts.

Syntax

virtual CGdiObject* SelectStockObject ( int nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the following stock object values in the nIndex parameter.

ANSI_FIXED_FONT

ANSI_VAR_FONT

DEFAULT_PALETTE

OEM_FIXED_FONT

SYSTEM_FIXED_FONT

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CGdiObject


CDC::SetAttribDC

This member function sets the attribute device context, m_hAttribDC.

Syntax

virtual void SetAttribDC( HDC hDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SetOutputDC, CDC::ReleaseAttribDC, CDC::ReleaseOutputDC


CDC::SetBkColor

This member function sets the current background color to the specified color.

Syntax

virtual COLORREF SetBkColor( COLORREF crColor );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::BitBlt, CDC::GetBkColor, CDC::GetBkMode, CDC::SetBkMode, CDC::StretchBlt


CDC::SetBkMode

This member function sets the background mode. The background mode defines whether the system removes existing background colors on the drawing surface before drawing text, hatched brushes, or any pen style that is not a solid line.

Syntax

int SetBkMode( int nBkMode );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetBkColor, CDC::GetBkMode, CDC::SetBkColor


CDC::SetBrushOrg

This member function specifies the origin that GDI will assign to the next brush that the application selects into the device context.

Syntax

CPoint SetBrushOrg( int x, int y );

CPoint SetBrushOrg( POINT point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CBrush, CDC::GetBrushOrg, CDC::SelectObject


CDC::SetOutputDC

This member function sets the output device context, m_hDC.

Syntax

virtual void SetOutputDC( HDC hDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::SetAttribDC, CDC::ReleaseAttribDC, CDC::ReleaseOutputDC, CDC::m_hDC


CDC::SetPixel

This member function sets the pixel at the point specified to the closest approximation of the color specified by crColor.

Syntax

COLORREF SetPixel( int x, int y, COLORREF crColor );

COLORREF SetPixel( POINT point, COLORREF crColor );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetDeviceCaps, CDC::GetPixel


CDC::SetTextColor

This member function sets the text color to the specified color. The system will use this text color when writing text to this device context, and also when converting bitmaps between color and monochrome device contexts.

Syntax

virtual COLORREF SetTextColor( COLORREF crColor );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::GetTextColor, CDC::BitBlt, CDC::SetBkColor, CDC::SetBkMode


CDC::StretchBlt

This member function copies a bitmap from a source rectangle into a destination rectangle, and stretches or compresses the bitmap if necessary to fit the dimensions of the destination rectangle.

Syntax

BOOL StretchBlt ( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The only raster operations Windows CE supports in the dwRop parameter are SRCCOPY and SRCINVERT. Windows CE does not support mirroring.

Windows CE 1.0 only supports two bit per pixel (maximum) gray scale graphics. When performing a bit-block transfer that converts two bit-per-pixel (2bpp) to one bit-per-pixel (1bpp), Windows CE 1.0 maps the background color to white, and all other colors to black. When converting from 1bpp to 2bpp, it maps white to white and black to black, as expected.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes, CDC::BitBlt, CDC::GetDeviceCaps


CDC Data Members

Data Members |
m_hDC | The output-device context used by this CDC object.
m_hAttribDC | The attribute-device context used by this CDC object.

See Also

CDC Overview, CDC Member Functions, Graphical Drawing Classes


CDC::m_hAttribDC

This data member contains the attribute device context for this CDC object. By default, this device context is equal to m_hDC.

HDC m_hAttribDC;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Data Members, Graphical Drawing Classes, CDC::m_hDC, CDC::SetAttribDC, CDC::ReleaseAttribDC


CDC::m_hDC

This data member contains the output device context handle for this CDC object.

HDC m_hDC;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDC Overview, CDC Data Members, Graphical Drawing Classes, CDC::m_hAttribDC, CDC::SetOutputDC, CDC::ReleaseOutputDC


CDialog

The CDialog class encapsulates the functionality of a Windows dialog box.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, all dialog boxes are control parents, and are also recursive. This means that if a dialog box has a child dialog box, when a user tabs through the parent dialog box, the dialog manager always tabs into the child dialog box as well.

If a dialog box is outside the visible area of the screen, Windows CE does not automatically reposition it. Windows CE does not support the DM_REPOSITION message.

If a user presses alt+h while the dialog box has the input focus, the system posts a WM_HELP message to the dialog procedure. An application should respond to this message by displaying context-sensitive help for the dialog box.

See Also

CDialog Member Functions, Dialog Box Classes, Application-Defined Dialog Boxes


CDialog Member Functions

Construction
CDialog Constructs a CDialog object.

Initialization
Create | Initializes the CDialog object. Creates a modeless dialog box and attaches it to the CDialog object.
CreateIndirect | Creates a modeless dialog box from a dialog-box template in memory (not resource-based).
InitModalIndirect | Creates a modal dialog box from a dialog-box template in memory (not resource-based). The parameters are stored until the function DoModal is called.

Operations
DoModal | Calls a modal dialog box and returns when done.
MapDialogRect | Converts the dialog-box units of a rectangle to screen units.
NextDlgCtrl | Moves the focus to the next dialog-box control in the dialog box.
PrevDlgCtrl | Moves the focus to the previous dialog-box control in the dialog box.
GotoDlgCtrl | Moves the focus to a specified dialog-box control in the dialog box.
SetDefID | Changes the default pushbutton control for a dialog box to a specified pushbutton.
GetDefID | Gets the ID of the default pushbutton control for a dialog box.
SetHelpID | Sets a context-sensitive help ID for the dialog box.
EndDialog | Closes a modal dialog box.

Overridables
OnInitDialog | Override to augment dialog-box initialization.
OnSetFont | Override to specify the font that a dialog-box control is to use when it draws text.
OnOK | Override to perform the OK button action in a modal dialog box. The default closes the dialog box and DoModal returns IDOK.
OnCancel | Override to perform the Cancel button or ESC key action. The default closes the dialog box and DoModal returns IDCANCEL.

See Also

CDialog Overview, Dialog Box Classes


CDialog::CDialog

Use either one of these constructors to construct a resource-based modal dialog box. One form of the constructor provides access to the dialog resource by template name. The other constructor provides access by template ID number, usually with an IDD_ prefix (for example, IDD_DIALOG1).

Syntax

CDialog( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL );

CDialog( UINT nIDTemplate, CWnd* pParentWnd = NULL );

CDialog( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::Create, CWnd::DestroyWindow, CDialog::InitModalIndirect, CDialog::DoModal


CDialog::Create

Call this member function to create a modeless dialog box using a dialog-box template from a resource.

Syntax

BOOL Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL );

BOOL Create( UINT nIDTemplate, CWnd* pParentWnd = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

All Windows CE dialog boxes are control parents, and are recursive, so you don't need to specify the DS_CONTROL, DS_RECURSE, or WS_EX_CONTROLPARENT styles for your dialogs. All dialogs in Windows CE also have the DS_3DLOOK style. Dialog boxes in Windows CE have the WS_POPUP style by default, unless you specify the WS_CHILD style. Windows CE doesn't support the DS_CENTERMOUSE, DS_CONTEXTHELP, DS_CONTROL, DS_FIXEDSYS, or DS_NOFAILCREATE dialog box styles. For more information on supported dialog box styles, see Dialog Box Styles.

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::CDialog, CWnd::DestroyWindow, CDialog::InitModalIndirect, CDialog::DoModal


CDialog::CreateIndirect

Call this member function to create a modeless dialog box from a dialog-box template in memory.

Syntax

BOOL CreateIndirect( LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL );

BOOL CreateIndirect( HGLOBAL hDialogTemplate, CWnd* pParentWnd = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::CDialog, CWnd::DestroyWindow, CDialog::Create


CDialog::DoModal

Call this member function to invoke the modal dialog box and return the dialog-box result when done.

Syntax

virtual int DoModal( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CWnd::IsDialogMessage


CDialog::EndDialog

Call this member function to terminate a modal dialog box. This member function returns nResult as the return value of DoModal. You must use the EndDialog function to complete processing whenever a modal dialog box is created.

Syntax

void EndDialog( int nResult );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::DoModal, CDialog::OnOK, CDialog::OnCancel


CDialog::GetDefID

Call this member function to to get the ID of the default pushbutton control for a dialog box. This is usually an OK button.

Syntax

DWORD GetDefID( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::SetDefID


CDialog::GotoDlgCtrl

Call this member function to move the focus to the specified control in the dialog box.

Syntax

void GotoDlgCtrl( CWnd* pWndCtrl );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CWnd::GetDlgItem, CDialog::PrevDlgCtrl, CDialog::NextDlgCtrl


CDialog::InitModalIndirect

Call this member function to initialize a modal dialog object using a dialog-box template that you construct in memory.

Syntax

BOOL InitModalIndirect( LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL );

BOOL InitModalIndirect( HGLOBAL hDialogTemplate, CWnd* pParentWnd = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::DoModal, CWnd::DestroyWindow, CDialog::CDialog


CDialog::MapDialogRect

Call this member function to convert the dialog-box units of a rectangle to screen units. Dialog-box units are stated in terms of the current dialog-box base unit derived from the average width and height of characters in the font used for dialog-box text. One horizontal unit is one-fourth of the dialog-box base-width unit, and one vertical unit is one-eighth of the dialog-box base height unit.

Syntax

void MapDialogRect( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes


CDialog::NextDlgCtrl

Call this member function to move the focus to the next control in the dialog box. If the focus is at the last control in the dialog box, it moves to the first control.

Syntax

void NextDlgCtrl( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::PrevDlgCtrl, CDialog::GotoDlgCtrl


CDialog::OnCancel

The framework calls this member function when the user clicks the Cancel button or presses the ESC key in a modal or modeless dialog box.

Syntax

virtual void OnCancel( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::OnOK, CDialog::EndDialog


CDialog::OnInitDialog

The framework calls this member function in response to the WM_INITDIALOG message. This message is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed.

Syntax

virtual BOOL OnInitDialog( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::Create, CDialog::CreateIndirect


CDialog::OnOK

The framework calls this member function when the user clicks the OK button (the button with an identifier of IDOK).

Syntax

virtual void OnOK( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::OnCancel, CDialog::EndDialog


CDialog::OnSetFont

Call this member function to specify the font a dialog-box control will use when drawing text.

Syntax

virtual void OnSetFont( CFont* pFont );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CWnd::SetFont


CDialog::PrevDlgCtrl

Call this member function to set the focus to the previous control in the dialog box. If the focus is at the first control in the dialog box, it moves to the last control in the box.

Syntax

void PrevDlgCtrl( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::NextDlgCtrl, CDialog::GotoDlgCtrl


CDialog::SetDefID

Call this member function to change the default pushbutton control for a dialog box.

Syntax

void SetDefID( UINT nID );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes, CDialog::GetDefID


CDialog::SetHelpID

Call this member function to set a context-sensitive help ID for the dialog box.

Syntax

void SetHelpID( UINT nIDR );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDialog Overview, CDialog Member Functions, Dialog Box Classes


CDocTemplate

CDocTemplate is an abstract base class that defines the basic functionality for document templates.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE does not support the following member functions of the CDocTemplate class.

CreateOleFrame

SetContainerInfo

SetDefaultTitle

SetServerInfo

See Also

CDocTemplate Member Functions, Application Architecture Classes, CSingleDocTemplate, CDocument, CView, CScrollView, CEditView, CFormView, CFrameWnd


CDocTemplate Member Functions

Constructors
CDocTemplate Constructs a CDocTemplate object.

Attributes
GetFirstDocPosition | Retrieves the position of the first document associated with this template.
GetNextDoc | Retrieves a document and the position of the next one.
LoadTemplate | Loads the resources for a given CDocTemplate or derived class.

Operations
AddDocument | Adds a document to a template.
RemoveDocument | Removes a document from a template.
GetDocString | Retrieves a string associated with the document type.

Overridables
MatchDocType | Determines the degree of confidence in the match between a document type and this template.
CreateNewDocument | Creates a new document.
CreateNewFrame | Creates a new frame window containing a document and view.
InitialUpdateFrame | Initializes the frame window, and optionally makes it visible.
SaveAllModified | Saves all documents associated with this template which have been modified.
CloseAllDocuments | Closes all documents associated with this template.
OpenDocumentFile | Opens a file specified by a pathname.

See Also

CDocTemplate Overview, Application Architecture Classes


CDocTemplate::AddDocument

Call this member function to add a document to a template. The derived class CSingleDocTemplate overrides this function. If you derive your own document-template class from CDocTemplate, your derived class must override this function.

Syntax

virtual void AddDocument( CDocument* pDoc );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::RemoveDocument, CSingleDocTemplate


CDocTemplate::CDocTemplate

Use this constructor to construct a CDocTemplate object. Dynamically allocate a CDocTemplate object and pass it to CWinApp::AddDocTemplate from the InitInstance member function of your application class.

Syntax

CDocTemplate ( UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::GetDocString, CWinApp::AddDocTemplate, CWinApp::InitInstance, CRuntimeClass


CDocTemplate::CloseAllDocuments

Call this member function to close all open documents. This member function is typically used as part of the File Exit command. The default implementation of this function calls the CDocument::DeleteContents member function to delete the document's data and then closes the frame windows for all the views attached to the document.

Syntax

virtual void CloseAllDocuments( BOOL bEndSession );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::SaveAllModified, CDocument::DeleteContents


CDocTemplate::CreateNewDocument

Call this member function to create a new document of the type associated with this document template.

Syntax

virtual CDocument* CreateNewDocument( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::CreateNewFrame


CDocTemplate::CreateNewFrame

CreateNewFrame uses the CRuntimeClass objects passed to the constructor to create a new frame window with a view and document attached. If the pDoc parameter is NULL, the framework outputs a TRACE message.

Syntax

virtual CFrameWnd* CreateNewFrame( CDocument* pDoc, CFrameWnd* pOther );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CCreateContext, CFrameWnd::LoadFrame, CDocTemplate::InitialUpdateFrame


CDocTemplate::GetDocString

Call this member function to retrieve a specific substring describing the document type. The string containing these substrings is stored in the document template and is derived from a string in the resource file for the application. The framework calls this member function to get the strings it needs for the application's user interface. If you have specified a filename extension for your application's documents, the framework also calls this member function when adding an entry to the Windows registration database; this allows documents to be opened from the Windows File Manager.

Call this member function only if you are deriving your own class from CDocTemplate.

Syntax

virtual BOOL GetDocString( CString& rString, enum DocStringIndex index ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CSingleDocTemplate::CSingleDocTemplate


CDocTemplate::GetFirstDocPosition

Call this member function to get the position of the first document in the list of documents associated with this template. Use the POSITION value as an argument to CDocTemplate::GetNextDoc to iterate through the list of documents associated with the template.

Syntax

virtual POSITION GetFirstDocPosition( ) const = 0;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

CSingleDocTemplate overrides this pure virtual function. Any class you derive from CDocTemplate must also override this function.

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::GetNextDoc, CSingleDocTemplate


CDocTemplate::GetNextDoc

Call this member function to retrieve the list element identified by rPos, and then set rrPos to the POSITION value of the next entry in the list. If the retrieved element is the last in the list, then the new value of rPos is set to NULL.

Syntax

virtual CDocument* GetNextDoc( POSITION& rPos ) const = 0;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::GetFirstDocPosition


CDocTemplate::InitialUpdateFrame

Call this member function after creating a new frame with CreateNewFrame. Calling this function causes the views in that frame window to receive their OnInitialUpdate calls. Also, if there was not previously an active view, the primary view of the frame window is made active; the primary view is a view with a child ID of AFX_IDW_PANE_FIRST. Finally, the frame window is made visible if bMakeVisible is non-zero. If bMakeVisible is zero, the current focus and visible state of the frame window will remain unchanged.

Syntax

virtual void InitialUpdateFrame( CFrameWnd* pFrame, CDocument* pDoc, BOOL bMakeVisible = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CView::OnInititalUpdate, CFrameWnd::SetActiveView, CDocTemplate::CreateNewFrame


CDocTemplate::LoadTemplate

This member function is called by the framework to load the resources for a given CDocTemplate or derived class. Normally it is called during construction, except when the template is being constructed globally. In that case, the call to LoadTemplate is delayed until CWinApp::AddDocTemplate is called.

Syntax

virtual void LoadTemplate( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CWinApp::AddDocTemplate


CDocTemplate::MatchDocType

Call this member function to determine the type of document template to use for opening a file. If your application supports multiple file types, for example, you can use this function to determine which of the available document templates is appropriate for a given file by calling MatchDocType for each template in turn, and choosing a template according to the confidence value returned.

Syntax

virtual Confidence MatchDocType( LPCTSTR lpszPathName, CDocument*& rpDocMatch );

virtual Confidence MatchDocType( LPCTSTR lpszPathName, DWORD dwFileType, CDocument*& rpDocMatch );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::GetDocString


CDocTemplate::OpenDocumentFile

Call this member function to open the file whose pathname is specified by lpzsPathName. If lpszPathName is NULL, a new file, containing a document of the type associated with this template, is created.

Syntax

virtual CDocument* OpenDocumentFile( LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE ) = 0;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::CloseAllDocuments


CDocTemplate::RemoveDocument

Call this member function to remove the document pointed to by pDoc from the list of documents associated with this template. The derived class CSingleDocTemplate overrides this function. If you derive your own document-template class from CDocTemplate, your derived class must override this function.

Syntax

virtual void RemoveDocument( CDocument* pDoc );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::AddDocument, CSingleDocTemplate


CDocTemplate::SaveAllModified

Call this member function to save all documents that have been modified.

Syntax

virtual BOOL SaveAllModified( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocTemplate Overview, CDocTemplate Member Functions, Application Architecture Classes, CDocTemplate::CloseAllDocuments


CDocument

The CDocument class provides the basic functionality for user-defined document classes. A document represents a unit of data that a user typically opens with the File Open command and saves with the File Save command.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE currently does not support the OnFileSendMail and OnUpdateFileSendMail member functions of the CDocument class.

See Also

CDocument Member Functions, Application Architecture Classes, CCmdTarget, CView, CDocTemplate


CDocument Member Functions

Construction
CDocument Constructs a CDocument object.

Operations
AddView | Attaches a view to the document.
GetDocTemplate | Returns a pointer to the document template that describes the type of the document.
GetFirstViewPosition | Returns the position of the first in the list of views; used to begin iteration.
GetNextView | Iterates through the list of views associated with the document.
GetPathName | Returns the path of the document's data file.
GetTitle | Returns the document's title.
IsModified | Indicates whether the document has been modified since it was last saved.
RemoveView | Detaches a view from the document.
SetModifiedFlag | Sets a flag indicating that you have modified the document since it was last saved.
SetPathName | Sets the path of the data file used by the document.
SetTitle | Sets the document's title.
UpdateAllViews | Notifies all views that document has been modified.

Overridables
CanCloseFrame | Advanced overridable; called before closing a frame window viewing this document.
DeleteContents | Called to perform cleanup of the document.
OnChangedViewList | Called after a view is added to or removed from the document.
OnCloseDocument | Called to close the document.
OnNewDocument | Called to create a new document.
OnOpenDocument | Called to open an existing document.
OnSaveDocument | Called to save the document to disk.
ReportSaveLoadException | Advanced overridable; called when an open or save operation cannot be completed because of an exception.
GetFile | Returns a pointer to the desired CFile object.
ReleaseFile | Releases a file to make it available for use by other applications.
SaveModified | Advanced overridable; called to ask the user whether the document should be saved.
PreCloseFrame | Called before the frame window is closed.

See Also

CDocument Overview, Application Architecture Classes


CDocument::AddView

Call this member function to attach a view to the document. This function adds the specified view to the list of views associated with the document; the function also sets the view's document pointer to this document. The framework calls this member function when attaching a newly created view object to a document.

Syntax

void AddView( CView* pView );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocTemplate, CDocument::GetFirstViewPosition, CDocument::GetNextView, CDocument::RemoveView, CView::GetDocument


CDocument::CanCloseFrame

This member function is called by the framework before a frame window displaying the document is closed. The default implementation checks if there are other frame windows displaying the document. If the specified frame window is the last one that displays the document, the function prompts the user to save the document if it has been modified. Override this function if you want to perform special processing when a frame window is closed. This is an advanced overridable.

Syntax

virtual BOOL CanCloseFrame( CFrameWnd* pFrame );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::SaveModified


CDocument::CDocument

This constructor construct a CDocument object. The framework handles document creation for you. Override the OnNewDocument member function to perform initialization on a per-document basis; this is particularly important in single document interface (SDI) applications.

Syntax

CDocument( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::OnNewDocument, CDocument::OnOpenDocument


CDocument::DeleteContents

This member function is called by the framework to delete the document's data without destroying the document object itself. The default implementation of this function does nothing. Override this function to delete the data in your document.

Syntax

virtual void DeleteContents( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::OnCloseDocument, CDocument::OnNewDocument, CDocument::OnOpenDocument


CDocument::GetDocTemplate

Call this member function to retrieve a pointer to the document template for this document type.

Syntax

CDocTemplate* GetDocTemplate( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocTemplate


CDocument::GetFile

Call this member function to retrieve a pointer to a CFile object.

Syntax

virtual CFile* GetFile( LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocTemplate, CFile


CDocument::GetFirstViewPosition

Call this member function to retrieve the position of the first view in the list of views associated with the document.

Syntax

virtual POSITION GetFirstViewPosition( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::GetNextView


CDocument::GetNextView

Call this member function to iterate through all of the document's views. The function returns the view identified by rPosition and then sets rPosition to the POSITION value of the next view in the list. If the retrieved view is the last in the list, then rPosition is set to NULL.

Syntax

virtual CView* GetNextView( POSITION& rPosition ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::AddView, CDocument::GetFirstViewPosition, CDocument::RemoveView, CDocument::UpdateAllViews


CDocument::GetPathName

Call this member function to retrieve the fully qualified path of the document's disk file.

Syntax

const CString& GetPathName( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::SetPathName


CDocument::GetTitle

Call this member function to retrieve the document's title, which is usually derived from the document's filename.

Syntax

const CString& GetTitle( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::SetTitle


CDocument::IsModified

Call this member function to determine whether the document has been modified since it was last saved.

Syntax

BOOL IsModified( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::SetModifiedFlag, CDocument::SaveModified


CDocument::OnChangedViewList

This member function is called by the framework after a view is added to or removed from the document. The default implementation of this function checks whether the last view is being removed and, if so, deletes the document. Override this function if you want to perform special processing when the framework adds or removes a view. For example, if you want a document to remain open even when there are no views attached to it, override this function.

Syntax

virtual void OnChangedViewList( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::AddView, CDocument::RemoveView


CDocument::OnCloseDocument

This member function is called by the framework when the document is closed, typically as part of the File Close command. The default implementation of this function calls the DeleteContents member function to delete the document's data and then closes the frame windows for all the views attached to the document. Override this function if you want to perform special cleanup processing when the framework closes a document.

Syntax

virtual void OnCloseDocument( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::DeleteContents, CDocument::OnNewDocument, CDocument::OnOpenDocument


CDocument::OnNewDocument

This member function is called by the framework as part of the File New command. The default implementation of this function calls the DeleteContents member function to ensure that the document is empty and then marks the new document as clean. Override this function to initialize the data structure for a new document. You should call the base class version of this function from your override.

Syntax

virtual BOOL OnNewDocument( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::CDocument, CDocument::DeleteContents, CDocument::OnCloseDocument, CDocument::OnOpenDocument, CDocument::OnSaveDocument


CDocument::OnOpenDocument

This member function is called by the framework as part of the File Open command. The default implementation of this function opens the specified file, calls the DeleteContents member function to ensure that the document is empty, calls CObject::Serialize to read the file's contents, and then marks the document as clean. Override this function if you want to use something other than the archive mechanism or the file mechanism. For example, you might write an application where documents represent records in a database rather than separate files.

Syntax

virtual BOOL OnOpenDocument( LPCTSTR lpszPathName );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::DeleteContents, CDocument::OnCloseDocument, CDocument::OnNewDocument, CDocument::OnSaveDocument, CDocument::ReportSaveLoadException, CObject::Serialize


CDocument::OnSaveDocument

This member function is called by the framework as part of the File Save or File Save As command. The default implementation of this function opens the specified file, calls CObject::Serialize to write the document's data to the file, and then marks the document as clean. Override this function if you want to perform special processing when the framework saves a document. For example, you might write an application where documents represent records in a database rather than separate files.

Syntax

virtual BOOL OnSaveDocument( LPCTSTR lpszPathName );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::OnCloseDocument, CDocument::OnNewDocument, CDocument::OnOpenDocument, CDocument::ReportSaveLoadException, CObject::Serialize


CDocument::PreCloseFrame

This member function is called by the framework before the frame window is destroyed. You can override this function to provide custom cleanup, but be sure to call the base class as well.

Syntax

virtual void PreCloseFrame( CFrameWnd* pFrame );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes


CDocument::ReleaseFile

This member function is called by the framework to release a file, making it available for use by other applications. If bAbort is TRUE, ReleaseFile calls CFile::Abort, and the file is released. CFile::Abort will not throw an exception.

Syntax

virtual void ReleaseFile( CFile* pFile, BOOL bAbort );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocTemplate, CFile::Close, CFile::Abort


CDocument::RemoveView

Call this member function to detach a view from a document. This function removes the specified view from the list of views associated with the document; it also sets the view's document pointer to NULL. This member function is called by the framework when a frame window is closed or a pane of a splitter window is closed.

Syntax

void RemoveView( CView* pView );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::AddView, CDocument::GetFirstViewPosition, CDocument::GetNextView


CDocument::ReportSaveLoadException

This member function is called by the framework when an exception is thrown (typically a CFileException or CArchiveException) while saving or loading the document. The default implementation examines the exception object and looks for an error message that specifically describes the cause. If a specific message is not found or if e is NULL, the general message specified by the nIDPDefault parameter is used. The function then displays a message box containing the error message. Override this function if you want to provide additional, customized failure messages. This is an advanced overridable.

Syntax

virtual void ReportSaveLoadException( LPCTSTR lpszPathName, CException* e, BOOL bSaving, UINT nIDPDefault );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::OnOpenDocument, CDocument::OnSaveDocument, CFileException, CArchiveException


CDocument::SaveModified

This member function is called by the framework before a modified document is closed. The default implementation of this function displays a message box asking the user whether to save the changes to the document, if any have been made. Override this function if your program requires a different prompting procedure. This is an advanced overridable.

Syntax

virtual BOOL SaveModified( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::CanCloseFrame, CDocument::IsModified, CDocument::OnNewDocument, CDocument::OnOpenDocument, CDocument::OnSaveDocument


CDocument::SetModifiedFlag

Call this member function after you've made any modifications to the document. By calling this function consistently, you ensure that the framework prompts the user to save changes before closing a document.

Syntax

void SetModifiedFlag( BOOL bModified = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::IsModified, CDocument::SaveModified


CDocument::SetPathName

Call this member function to specify the fully qualified path to the document's disk file. Depending on the value of bAddToMRU the path is added, or not added, to the MRU list maintained by the application. Note that some documents are not associated with a disk file. Call this member function only if you are overriding the default implementation for opening and saving files used by the framework.

Syntax

virtual void SetPathName( LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::GetPathName, CWinApp::AddToRecentFileList


CDocument::SetTitle

Call this member function to specify the document's title (the string displayed in the title bar of a frame window). Calling this function updates the titles of all frame windows that display the document.

Syntax

virtual void SetTitle( LPCTSTR lpszTitle );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::GetTitle


CDocument::UpdateAllViews

Call this member function after the document has been modified. You should call this function after you call the SetModifiedFlag member function. This function informs each view attached to the document, except for the view specified by pSender, that the document has been modified. You typically call this function from your view class after the user has changed the document through a view.

Syntax

void UpdateAllViews( CView* pSender, LPARAM lHint = 0L, CObject* pHint = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CDocument Overview, CDocument Member Functions, Application Architecture Classes, CDocument::SetModifiedFlag, CDocument::GetFirstViewPosition, CDocument::GetNextView, CView::OnUpdate


CDumpContext

The CDumpContext class supports stream-oriented diagnostic output in the form of human-readable text.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDumpContext Member Functions, CDumpContext Operators, Run-Time Object Model Support, CFile, CObject


CDumpContext Member Functions

Construction
CDumpContext Constructs a CDumpContext object.

Basic Input/Output
Flush | Flushes any data in the dump context buffer.
HexDump | Dumps bytes in hexadecimal format.

Status
GetDepth | Gets an integer corresponding to the depth of the dump.
SetDepth | Sets the depth of the dump.

See Also

CDumpContext Overview, CDumpContext Operators, Run-Time Object Model Support


CDumpContext::CDumpContext

Use this constructor to construct a CDumpContext object. The afxDump object is constructed automatically.

Syntax

CDumpContext( CFile* pFile );
throw( CMemoryException, CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDumpContext Overview, CDumpContext Member Functions, Run-Time Object Model Support


CDumpContext::Flush

Call this member function to force any data remaining in buffers to be written to the file attached to the dump context.

Syntax

void Flush( );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDumpContext Overview, CDumpContext Member Functions, Run-Time Object Model Support


CDumpContext::GetDepth

Call this member function to determine whether a deep or shallow dump is in process.

Syntax

int GetDepth( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDumpContext Overview, CDumpContext Member Functions, Run-Time Object Model Support, CDumpContext::SetDepth


CDumpContext::HexDump

Call this member function to dump an array of bytes formatted as hexadecimal numbers.

Syntax

void HexDump( LPCTSTR lpszLine, BYTE* pby, int nBytes, int nWidth );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDumpContext Overview, CDumpContext Member Functions, Run-Time Object Model Support


CDumpContext::SetDepth

Call this member function to set the depth for the dump.

Syntax

void SetDepth( int nNewDepth );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDumpContext Overview, CDumpContext Member Functions, Run-Time Object Model Support, CObject::Dump


CDumpContext Operators

Basic Input/Output
operator << Inserts variables and objects into the dump context.

See Also

CDumpContext Overview, CDumpContext Member Functions, Run-Time Object Model Support


CDumpContext::operator <<

Use this operator to output the specified data to the dump context.

CDumpContext& operator <<( const CObject* pOb );
throw( CFileException );

CDumpContext& operator <<( const CObject& ob );
throw( CFileException );

CDumpContext& operator <<( LPCTSTR lpsz );
throw( CFileException );

CDumpContext& operator <<( const void* lp );
throw( CFileException );

CDumpContext& operator <<( BYTE by );
throw( CFileException );

CDumpContext& operator <<( WORD w );
throw( CFileException );

CDumpContext& operator <<( DWORD dw );
throw( CFileException );

CDumpContext& operator <<( int n );
throw( CFileException );

CDumpContext& operator <<( double d );
throw( CFileException );

CDumpContext& operator <<( float f );
throw( CFileException );

CDumpContext& operator <<( LONG l );
throw( CFileException );

CDumpContext& operator <<( UINT u );
throw( CFileException );

CDumpContext& operator <<( LPCWSTR lpsz );
throw( CFileException );

CDumpContext& operator <<( LPCSTR lpsz );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CDumpContext Overview, CDumpContext Operators, Run-Time Object Model Support


CDWordArray

The CDWordArray class supports arrays of 32-bit doublewords.

The member functions of CDWordArray are similar to the member functions of class CObArray. Because of this similarity, you can use the CObArray reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Array Classes, CObArray


CDWordArray Class Members

Construction
CDWordArray Constructs an empty array for doublewords.

Bounds
GetSize | Gets the number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.

Operations
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.

Element Access
GetAt | Returns the value at a given index.
SetAt | Sets the value for a given index; array not allowed to grow.
ElementAt | Returns a temporary reference to the doubleword within the array.
GetData | Allows access to elements in the array. Can be NULL.

Growing the Array
SetAtGrow | Sets the value for a given index; grows the array if necessary.
Add | Adds an element to the end of the array; grows the array if necessary.
Append | Appends another array to the array; grows the array if necessary.
Copy | Copies another array to the array; grows the array if necessary.

Insertion/Removal
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.

Operators
operator [] Sets or gets the element at the specified index.

See Also

CDWordArray Overview, Array Classes


CEdit

The CEdit class encapsulates the functionality of a Windows edit control, which is a rectangular child window in which a user can enter text.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Member Functions, Control Classes, CWnd, CButton, CComboBox, CListBox, CScrollBar, CStatic, CDialog


CEdit Member Functions

Construction
CEdit | Constructs a CEdit control object.
Create | Creates the Windows edit control and attaches it to the CEdit object.

General Operations
GetSel | Gets the starting and ending character positions of the current selection in an edit control.
ReplaceSel | Replaces the current selection in an edit control with the specified text.
SetSel | Selects a range of characters in an edit control.
Clear | Deletes (clears) the current selection (if any) in the edit control.
Copy | Copies the current selection (if any) in the edit control to the Clipboard in CF_TEXT format.
Cut | Deletes (cuts) the current selection (if any) in the edit control and copies the deleted text to the Clipboard in CF_TEXT format.
Paste | Inserts the data from the Clipboard into the edit control at the current cursor position. Data is inserted only if the Clipboard contains data in CF_TEXT format.
Undo | Reverses the last edit-control operation.
CanUndo | Determines whether an edit-control operation can be undone.
EmptyUndoBuffer | Resets (clears) the undo flag of an edit control.
GetModify | Determines whether the contents of an edit control have been modified.
SetModify | Sets or clears the modification flag for an edit control.
SetReadOnly | Sets the read-only state of an edit control.
GetPasswordChar | Retrieves the password character displayed in an edit control when the user enters text.
SetPasswordChar | Sets or removes a password character displayed in an edit control when the user enters text.
GetFirstVisibleLine | Determines the topmost visible line in an edit control.
LineLength | Retrieves the length of a line in an edit control.
LineScroll | Scrolls the text of a multiple-line edit control.
LineFromChar | Retrieves the line number of the line that contains the specified character index.
GetRect | Gets the formatting rectangle of an edit control.
LimitText | Limits the length of the text that the user may enter into an edit control.
GetMargins | Gets the left and right margins for this CEdit.
SetMargins | Sets the left and right margins for this CEdit.
GetLimitText | Gets the maximum amount of text this CEdit can contain.
SetLimitText | Sets the maximum amount of text this CEdit can contain.
CharFromPos | Retrieves the line and character indices for the character closest to a specified position.
PosFromChar | Retrieves the coordinates of the upper-left corner of a specified character index.

Multiple-Line Operations
GetLineCount | Retrieves the number of lines in a multiple-line edit control.
GetLine | Retrieves a line of text from an edit control.
LineIndex | Retrieves the character index of a line within a multiple-line edit control.
FmtLines | Sets the inclusion of soft line-break characters on or off within a multiple-line edit control.
SetTabStops | Sets the tab stops in a multiple-line edit control.
SetRect | Sets the formatting rectangle of a multiple-line edit control and updates the control.
SetRectNP | Sets the formatting rectangle of a multiple-line edit control without redrawing the control window.
GetHandle | Retrieves a handle to the memory currently allocated for a multiple-line edit control.
SetHandle | Sets the handle to the local memory that will be used by a multiple-line edit control.

See Also

CEdit Overview, Control Classes


CEdit::CanUndo

Call this member function to determine whether the last edit operation can be undone.

Syntax

BOOL CanUndo( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::Undo, CEdit::EmptyUndoBuffer


CEdit::CEdit

Use this constructor to construct a CEdit object. Use Create to construct the Windows edit control.

Syntax

CEdit( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::Create


CEdit::CharFromPos

Call this member function to retrieve the zero-based line and character indexes of the character nearest the specified point in this CEdit control.

Syntax

int CharFromPos( CPoint pt ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::PosFromChar


CEdit::Clear

Call this member function to delete (clear) the current selection in the edit control.

Syntax

void Clear( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::Undo, CEdit::Copy, CEdit::Cut, CEdit::Paste


CEdit::Copy

Call this member function to copy the current selection in the edit control to the Clipboard in CF_TEXT format.

Syntax

void Copy( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::Clear, CEdit::Cut, CEdit::Paste


CEdit::Create

Call this member function to create the Windows edit control and attach it to the CEdit object.

You construct a CEdit object in two steps. First, call the CEdit constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

For information on the edit control styles supported by Windows CE, see Edit Control Styles.

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::CEdit


CEdit::Cut

Call this member function to delete (cut) the current selection in the edit control and copy the deleted text to the Clipboard in CF_TEXT format.

Syntax

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::Undo, CEdit::Clear, CEdit::Copy, CEdit::Paste


CEdit::EmptyUndoBuffer

Call this member function to reset (clear) the undo flag of an edit control. The edit control will now be unable to undo the last operation. The undo flag is set whenever an operation within the edit control can be undone.

Syntax

void EmptyUndoBuffer( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::CanUndo, CEdit::SetHandle, CEdit::Undo, CWnd::SetWindowText


CEdit::FmtLines

Call this member function to set the inclusion of soft line-break characters in a multiple-line edit control to on or off. A soft line break consists of two carriage returns and a linefeed inserted at the end of a line that is broken because of word wrapping. A hard line break consists of one carriage return and a linefeed. Lines that end with a hard line break are not affected by FmtLines.

Syntax

BOOL FmtLines( BOOL bAddEOL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::GetHandle, CWnd::GetWindowText


CEdit::GetFirstVisibleLine

Call this member function to determine the topmost visible line in an edit control.

Syntax

int GetFirstVisibleLine( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::GetLine


CEdit::GetHandle

Call this member function to retrieve a handle to the memory currently allocated for a multiple-line edit control. The handle is a local memory handle and may be used by any of the Local Windows memory functions that take a local memory handle as a parameter.

Syntax

HLOCAL GetHandle( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::SetHandle


CEdit::GetLimitText

Call this member function to retrieve the text limit for this CEdit object. The text limit is the maximum amount of text, in bytes, that the edit control can accept.

Syntax

UINT GetLimitText( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::SetLimitText, CEdit::LimitText


CEdit::GetLine

Call this member function to retrieve a line of text from an edit control and place it in lpszBuffer. This call is not processed for a single-line edit control.

The copied line does not contain a null-termination character.

Syntax

int GetLine( int nIndex, LPTSTR lpszBuffer ) const;

int GetLine( int nIndex, LPTSTR lpszBuffer, int nMaxLength ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::LineLength, CWnd::GetWindowText


CEdit::GetLineCount

Call this member function to retrieve the number of lines in a multiple-line edit control.

Syntax

int GetLineCount( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes


CEdit::GetMargins

Call this member function to retrieve the left and right margins of this edit control.

Syntax

DWORD GetMargins( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::SetMargins


CEdit::GetModify

Call this member function to determine whether the contents of an edit control have been modified.

Syntax

BOOL GetModify( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::SetModify


CEdit::GetPasswordChar

Call this member function to retrieve the password character displayed in an edit control when the user enters text.

If the edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*).

Syntax

TCHAR GetPasswordChar( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::SetPasswordChar


CEdit::GetRect

Call this member function to retrieve the formatting rectangle of an edit control. The formatting rectangle is the limiting rectangle of the text, which is independent of the size of the edit-control window.

Syntax

void GetRect( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::SetRect, CEdit::SetRectNP


CEdit::GetSel

Call this member function to retrieve the starting and ending character positions of the current selection in an edit control, using either the return value or the parameters.

Syntax

DWORD GetSel( ) const;

void GetSel( int& nStartChar, int& nEndChar ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::SetSel


CEdit::LimitText

Call this member function to limit the length of the text that the user may enter into an edit control.

Syntax

void LimitText( int nChars = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CWnd::SetWindowText, CEdit::GetLimitText, CEdit::SetLimitText


CEdit::LineFromChar

Call this member function to retrieve the line number of the line that contains the specified character index. A character index is the number of characters from the beginning of the edit control.

This member function is only used by multiple-line edit controls.

Syntax

int LineFromChar( int nIndex = –1 ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::LineIndex


CEdit::LineIndex

Call this member function to retrieve the character index of a line within a multiple-line edit control. The character index is the number of characters from the beginning of the edit control to the specified line.

This member function is only processed by multiple-line edit controls.

Syntax

int LineIndex( int nLine = –1 ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::LineFromChar


CEdit::LineLength

Call this member function to retrieve the length of a line in an edit control.

Syntax

int LineLength( int nLine = –1 ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::LineIndex


CEdit::LineScroll

Call this member function to scroll the text of a multiple-line edit control.

Syntax

void LineScroll( int nLines, int nChars = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::LineIndex


CEdit::Paste

Call this member function to insert the data from the Clipboard into the CEdit at the insertion point. Data is inserted only if the Clipboard contains data in CF_TEXT format.

Syntax

void Paste( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::Clear, CEdit::Copy, CEdit::Cut


CEdit::PosFromChar

Call this member function to retrieve the position of the top-left corner of a given character within this CEdit object. The character is specified by giving its zero-based index value. If nChar is greater than the index of the last character in this CEdit object, the return value specifies the coordinates of the character position just past the last character in this CEdit object.

Syntax

CPoint PosFromChar( UINT nChar ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::CharFromPos


CEdit::ReplaceSel

Call this member function to replace the current selection in an edit control with the text specified by lpszNewText.

Syntax

void ReplaceSel( LPCTSTR lpszNewText );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CWnd::SetWindowText


CEdit::SetHandle

Call this member function to set the handle to the local memory that will be used by a multiple-line edit control. The edit control will then use this buffer to store the currently displayed text instead of allocating its own buffer.

Syntax

void SetHandle( HLOCAL hBuffer );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::CanUndo, CEdit::GetHandle, CEdit::GetModify


CEdit::SetLimitText

Call this member function to set the text limit for this CEdit object. The text limit is the maximum amount of text, in bytes, that the edit control can accept.

Syntax

void SetLimitText( UINT nMax );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::GetLimitText, CEdit::LimitText


CEdit::SetMargins

Call this member function to set the left and right margins of this edit control.

Syntax

void SetMargins( UINT nLeft, UINT nRight );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::GetMargins


CEdit::SetModify

Call this member function to set or clear the modified flag for an edit control. The modified flag indicates whether or not the text within the edit control has been modified. It is automatically set whenever the user changes the text. Its value may be retrieved with the GetModify member function.

Syntax

void SetModify( BOOL bModified = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::GetModify


CEdit::SetPasswordChar

Call this member function to set or remove a password character displayed in an edit control when the user types text. When a password character is set, that character is displayed for each character the user types.

Syntax

void SetPasswordChar( TCHAR ch );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::GetPasswordChar


CEdit::SetReadOnly

Call this member function to set the read-only state of an edit control.

Syntax

BOOL SetReadOnly( BOOL bReadOnly = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CWnd::GetStyle


CEdit::SetRect

Call this member function to set the dimensions of a rectangle using the specified coordinates. This member is processed only by multiple-line edit controls.

Syntax

void SetRect( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CRect::CRect, CRect::CopyRect, CRect::operator =, CRect::SetRectEmpty, CEdit::GetRect, CEdit::SetRectNP


CEdit::SetRectNP

Call this member function to set the formatting rectangle of a multiple-line edit control. The formatting rectangle is the limiting rectangle of the text, which is independent of the size of the edit-control window.

Syntax

void SetRectNP( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CRect::CRect, CRect::CopyRect, CRect::operator =, CRect::SetRectEmpty, CEdit::GetRect, CEdit::SetRect


CEdit::SetSel

Call this member function to select a range of characters in an edit control.

Syntax

void SetSel( DWORD dwSelection, BOOL bNoScroll = FALSE );

void SetSel( int nStartChar, int nEndChar, BOOL bNoScroll = FALSE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CEdit::GetSel, CEdit::ReplaceSel


CEdit::SetTabStops

Call this member function to set the tab stops in a multiple-line edit control. When text is copied to a multiple-line edit control, any tab character in the text will cause space to be generated up to the next tab stop.

Syntax

void SetTabStops( );

BOOL SetTabStops( const int& cxEachStop );

BOOL SetTabStops( int nTabStops, LPINT rgTabStops );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes, CWnd::InvalidateRect


CEdit::Undo

Call this member function to undo the last edit-control operation.

Syntax

BOOL Undo( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEdit Overview, CEdit Member Functions, Control Classes CEdit::CanUndo


CEditView

The CEditView class, like the CEdit class, encapsulates the functionality of a Windows edit control but, because CEditView is also derived from the CView class, objects of class CEditView can be used with documents and document templates. You can use this class to implement simple text-editor functionality.

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE does not support the following member functions of the CEditView class.

FindText

GetPrinterFont

OnFindNext

OnReplaceAll

OnReplaceSel

OnTextNotFound

PrintInsideRect

SetPrinterFont

See Also

CEditView Member Functions, CEditView Data Members, View Classes, CEdit, CDocument, CDocTemplate, CCtrlView


CEditView Member Functions

Construction
CEditView Constructs an object of type CEditView.

Attributes
GetEditCtrl | Provides access to the CEdit portion of a CEditView object (the Windows edit control).
GetSelectedText | Retrieves the current text selection.
LockBuffer | Locks the buffer.
UnlockBuffer | Unlocks the buffer.
GetBufferLength | Obtains the length of the character buffer.
SetTabStops | Sets tab stops for both screen display and printing.

Operations
SerializeRaw Serializes a CEditView object to disk as raw text.

See Also

CEditView Overview, CEditView Data Members, View Classes


CEditView::CEditView

Use this constructor to construct an object of type CEditView. After constructing the object, you must call the CWnd::Create function before the edit control is used. If you derive a class from CEditView and add it to the template using CWinApp::AddDocTemplate, the framework calls both this constructor and the Create function.

Syntax

CEditView( );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes, CWnd::Create, CWinApp::AddDocTemplate


CEditView::GetBufferLength

Call this member function to retrieve the number of characters currently in the edit control's buffer, not including the null terminator.

Syntax

UINT GetBufferLength( ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes, CEditView::LockBuffer, CEditView::UnlockBuffer


CEditView::GetEditCtrl

Call this member function to obtain a reference to the edit control used by the edit view. This control is of type CEdit, so you can manipulate the Windows edit control directly using the CEdit member functions.

Warning Using the CEdit object can change the state of the underlying Windows edit control. For example, you should not change the tab settings using the CEdit::SetTabStops function because CEditView caches these settings for use both in the edit control and in printing. Instead, use CEditView::SetTabStops.

Syntax

CEdit& GetEditCtrl( ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes, CEdit, CEditView::SetTabStops


CEditView::GetSelectedText

Call this member function to copy the selected text into a CString object. This function copies up to the end of the selection, or to the character preceding the first carriage-return character in the selection.

Syntax

void GetSelectedText( CString& strResult ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes


CEditView::LockBuffer

Call this member function to obtain a pointer to the buffer. The buffer should not be modified.

Syntax

LPCTSTR LockBuffer( ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes, CEditView::UnlockBuffer, CEditView::GetBufferLength


CEditView::SerializeRaw

Call this member function to read or write the text in the CEditView object to a text file. SerializeRaw differs from CEditView's internal implementation of Serialize in that it reads and writes only the text, without preceding object-description data.

Syntax

void SerializeRaw( CArchive& ar );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes, CArchive, CObject::Serialize


CEditView::SetTabStops

Call this member function to set the tab stops used for display and printing. Only a single tab-stop width is supported. (CEdit objects support multiple tab widths.) Widths are in dialog units, which equal one-fourth of the average character width (based on uppercase and lowercase alphabetic characters only) of the font used at the time of printing or displaying. You should not use CEdit::SetTabStops because CEditView must cache the tab-stop value.

Syntax

void SetTabStops( int nTabStops );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes, CWnd::SetFont


CEditView::UnlockBuffer

Call this member function to unlock the buffer. Call UnlockBuffer after you have finished using the pointer returned by LockBuffer.

Syntax

void UnlockBuffer( ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Member Functions, View Classes, CEditView::LockBuffer, CEditView::GetBufferLength


CEditView Data Members

Data Members
dwStyleDefault Default style for objects of type CEditView.

See Also

CEditView Overview, CEditView Member Functions, View Classes


CEditView::dwStyleDefault

The dwStyleDefault data member is a static member that you pass in the dwStyle parameter of the Create function to obtain the default style for the CEditView object.

DWORD dwStyleDefault;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CEditView Overview, CEditView Data Members, View Classes


CEvent

An object of class CEvent represents an "event" - a synchronization object that allows one thread to notify another that an event has occurred.

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

Remarks

MFC for Windows CE supports the CEvent::SetEvent and CEvent::ResetEvent member functions differently than the standard MFC library does.

See Also

CEvent Member Functions, Synchronization Classes


CEvent Member Functions

Construction
CEvent Constructs a CEvent object.

Methods
SetEvent | Sets the event to available (signaled) and releases any waiting threads.
PulseEvent | Sets the event to available (signaled), releases waiting threads, and sets the event to unavailable (nonsignaled).
ResetEvent | Sets the event to unavailable (nonsignaled).
Unlock | Releases the event object.

See Also

CEvent Overview, Synchronization Classes


CEvent::CEvent

Use this constructor to construct a named or unnamed CEvent object.

Syntax

CEvent( BOOL bInitiallyOwn = FALSE, BOOL bManualReset = FALSE, LPCTSTR lpszName = NULL, LPSECURITY_ATTRIBUTES lpsaAttribute = NULL );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CEvent Overview, CEvent Member Functions, Synchronization Classes


CEvent::PulseEvent

Call this member function to set the state of the event to signaled (available), releasing any waiting threads, and reset it to nonsignaled (unavailable) automatically.

Syntax

BOOL PulseEvent( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CEvent Overview, CEvent Member Functions, Synchronization Classes


CEvent::ResetEvent

Call this member function to set the state of the event to nonsignaled until explicitly set to signaled by the SetEvent member function.

Syntax

BOOL ResetEvent( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

Remarks

This member function is not used by automatic events.

Windows CE does not support waiting for a process or thread.

See Also

CEvent Overview, CEvent Member Functions, Synchronization Classes, CEvent::SetEvent


CEvent::SetEvent

Call this member function to set the state of the event to signaled, releasing any waiting threads. If the event is manual, the event will remain signaled until ResetEvent is called. If the event is automatic, the event will remain signaled until a single thread is released.

Syntax

BOOL SetEvent( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

Remarks

Windows CE does not support waiting for a process or thread.

See Also

CEvent Overview, CEvent Member Functions, Synchronization Classes


CEvent::Unlock

Call this member function to release the event object. This member function is called by threads that currently own an automatic event to release it after they are done, if their lock object is to be reused. If the lock object is not to be reused, this function will be called by the lock object's destructor.

Syntax

virtual BOOL Unlock( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CEvent Overview, CEvent Member Functions, Synchronization Classes


CException

CException is the base class for all exceptions in the MFC for Windows CE. The derived classes and their descriptions are listed below:

CMemoryException | Out-of-memory exception
CNotSupportedException | Request for an unsupported operation
CArchiveException | Archive-specific exception
CFileException | File-specific exception
CResourceException | Windows resource not found or not createable

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CException Member Functions, Exception Classes


CException Member Functions

Operations
GetErrorMessage | Retrieves the message describing an exception.
ReportError | Reports an error message in a message box to the user.

See Also

CException Overview, Exception Classes


CException::GetErrorMessage

Call this member function to provide text about an error that has occurred.

Syntax

virtual BOOL GetErrorMessage( LPTSTR lpszError, UINT nMaxError, PUINT pnHelpContext = NULL );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CException Overview, CException Member Functions, Exception Classes, CException::ReportError


CException::ReportError

Call this member function to report error text in a message box to the user.

Syntax

virtual int ReportError( UINT nType = MB_OK, UINT nMessageID = 0 );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CException Overview, CException Member Functions, Exception Classes, CException::GetErrorMessage


CFile

CFile is the base class for Microsoft Foundation file classes. It provides unbuffered, binary disk input/output services, and indirectly supports text files and memory files through its derived classes.

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

You can use the CFile class to access files in the Windows CE object store.

MFC for Windows CE doesn't support the following member functions of the CFile class.

Duplicate

LockRange

UnlockRange

See Also

CFile Member Functions, CFile Data Members, CFile Structures, File Service Classes


CFile Member Functions

Construction
CFile | Constructs a CFile object from a path or file handle.
Abort | Closes a file ignoring all warnings and errors.
Open | Safely opens a file with an error-testing option.
Close | Closes a file and deletes the object.

Input/Output
Read | Reads (unbuffered) data from a file at the current file position.
ReadHuge | Can read more than 64K of (unbuffered) data from a file at the current file position. Obsolete in 32-bit programming. See Read.
Write | Writes (unbuffered) data in a file to the current file position.
WriteHuge | Can write more than 64K of (unbuffered) data in a file to the current file position. Obsolete in 32-bit programming. See Write.
Flush | Flushes any data yet to be written.

Position
Seek | Positions the current file pointer.
SeekToBegin | Positions the current file pointer at the beginning of the file.
SeekToEnd | Positions the current file pointer at the end of the file.
GetLength | Retrieves the length of the file.
SetLength | Changes the length of the file.

Status
GetPosition | Retrieves the current file pointer.
GetStatus | Retrieves the status of this open file.
GetFileName | Retrieves the filename of the selected file.
GetFileTitle | Retrieves the title of the selected file.
GetFilePath | Retrieves the full file path of the selected file.
SetFilePath | Sets the full file path of the selected file.

Static
Rename | Renames the specified file (static function).
Remove | Deletes the specified file (static function).
GetStatus | Retrieves the status of the specified file (static, virtual function).
SetStatus | Sets the status of the specified file (static, virtual function).

See Also

CFile Overview, CFile Data Members, CFile Structures, File Service Classes


CFile::Abort

Call this member function to close the file associated with this object and make the file unavailable for reading or writing.

The Abort function does not throw an exception on failures. Abort will not ASSERT if the file has not been opened or was closed previously.

Syntax

virtual void Abort( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::Close, CFile::Open


CFile::CFile

Use this constructor to construct a CFile object. The default constructor does not open a file but rather sets m_hFile to CFile::hFileNull. Because this constructor does not throw an exception, it does not make sense to use TRY/CATCH logic. Use the Open member function, then test directly for exception conditions.

Syntax

CFile( );

CFile( int hFile );

CFile( LPCTSTR lpszFileName, UINT nOpenFlags );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::Close

Call this member function to close the file associated with this object and make the file unavailable for reading or writing. If you have not closed the file before destroying the object, the destructor closes it for you.

Syntax

virtual void Close( );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::Open


CFile::Flush

Call this member function to force any data remaining in the file buffer to be written to the file.

Syntax

virtual void Flush( );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::GetFileName

Call this member function to retrieve the name of a specified file. For example, when you call GetFileName to generate a message to the user about the file C:\Windows\Write\Myfile.wri, the filename, Myfile.wri, is returned. To return the entire path of the file, including the name, call GetFilePath. To return the title of the file (in this example, myfile), call GetFileTitle.

Syntax

virtual CString GetFileName( ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::GetFilePath, CFile::GetFileTitle


CFile::GetFilePath

Call this member function to retrieve the full path of a specified file. For example, when you call GetFilePath to generate a message to the user about the file C:\Windows\Write\Myfile.wri, the file path, C:\Windows\Write\Myfile.wri, is returned. To return just the name of the file (Myfile.wri), call GetFileName. To return the title of the file (myfile), call GetFileTitle.

Syntax

virtual CString GetFilePath( ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::SetFilePath, CFile::GetFileTitle, CFile::GetFileName


CFile::GetFileTitle

Call this member function to retrieve the file title for a specified file. For example, when you call GetFileTitle to generate a message to the user about the file C:\Windows\Write\Myfile.wri, the file title (Myfile) is returned. The file title typically does not include the extention.

Syntax

virtual CString GetFileTitle( ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::GetFileName, CFile::GetFilePath


CFile::GetLength

Call this member function to obtain the current logical length of the file in bytes, not the amount.

Syntax

virtual DWORD GetLength( ) const;
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::SetLength


CFile::GetPosition

Call this member function to obtain the current value of the file pointer, which can be used in subsequent calls to Seek.

Syntax

virtual DWORD GetPosition( ) const;
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::GetStatus

Call this member function to retrieve the status of an open file.

The first version of GetStatus retrieves the status of the open file associated with this CFile object. It does not insert a value into the m_szFullName structure member.

The static version gets the status of the named file and copies the filename to m_szFullName. This function obtains the file status from the directory entry without actually opening the file. It is useful for testing the existence and access rights of a file.

Syntax

BOOL GetStatus( CFileStatus& rStatus ) const;

static BOOL PASCAL GetStatus( LPCTSTR lpszFileName, CFileStatus& rStatus );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::SetStatus, CTime


CFile::Open

Use this member function in conjunction with the default CFile constructor as a "safe" method for opening a file where a failure is a normal, expected condition.

Syntax

virtual BOOL Open( LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

You can use the Cfile::Open member function to open files in the Windows CE object store.

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::CFile, CFile::Close


CFile::Read

Call this member function to read data into a buffer from the file associated with the CFile object.

Syntax

virtual UINT Read( void* lpBuf, UINT nCount );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

You can use the Cfile::Open member function to read files in the Windows CE object store.

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::ReadHuge

Call this member function to read data into a buffer from the file associated with the CFile object.

Syntax

DWORD ReadHuge( void* lpBuffer, DWORD dwCount );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::Write, CFile::WriteHuge, CFile::Read


CFile::Remove

Call this member function to delete the file specified by the path. It will not remove a directory.

Syntax

static void PASCAL Remove( LPCTSTR lpszFileName );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::Rename

Call this member function to rename the specified file. Directories cannot be renamed. This is equivalent to the REN command.

Syntax

static void PASCAL Rename( LPCTSTR lpszOldName, LPCTSTR lpszNewName );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::Seek

Call this member function to reposition the pointer in a previously opened file. The Seek function permits random access to a file's contents by moving the pointer a specified amount, absolutely or relatively. No data is actually read during the seek.

Syntax

virtual LONG Seek( LONG lOff, UINT nFrom );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::SeekToBegin

Call this member function to set the value of the file pointer to the beginning of the file. SeekToBegin is equivalent to Seek( 0L, CFile::begin ).

Syntax

void SeekToBegin( );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::SeekToEnd

Call this member function to set the value of the file pointer to the logical end of the file. SeekToEnd() is equivalent to CFile::Seek( 0L, CFile::end ).

Syntax

DWORD SeekToEnd( );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::GetLength, CFile::Seek, CFile::SeekToBegin


CFile::SetFilePath

Call this member function to specify the path of the file; for example, if the path of a file is not available when a CFile object is constructed, call SetFilePath to provide it.

Syntax

virtual void SetFilePath( LPCTSTR lpszNewName );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile, CFile Member Functions, CFile::GetFilePath, CFile::CFile


CFile::SetLength

Call this member function to change the length of the file.

Syntax

virtual void SetLength( DWORD dwNewLen );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::SetStatus

Call this member function to set the status of the file associated with this file location.

Syntax

static void SetStatus( LPCTSTR lpszFileName, const CFileStatus& status );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::GetStatus


CFile::Write

Call this member function to write data from a buffer to the file associated with the CFile object.

Syntax

virtual void Write( const void* lpBuf, UINT nCount );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

You can use the Cfile::Open member function to write to files in the Windows CE object store.

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::Read


CFile::WriteHuge

Call this member function to write data from a buffer to the file associated with the CFile object. WriteHuge throws an exception in response to several conditions, including the disk-full condition.

Syntax

void WriteHuge( const void* lpBuf, DWORD dwCount );
throw( CFileException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Member Functions, File Service Classes, CFile::Read, CFile::ReadHuge, CFile::Write


CFile Data Members

Data Members
m_hFile Usually contains the operating-system file handle.

See Also

CFile Overview, CFile Member Functions, File Service Classes


CFile::m_hFile

This data member contains the operating-system file handle for an open file. It contains CFile::hFileNull (an operating-system-independent empty file indicator) if the handle has not been assigned.

UINT m_hFile;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFile Overview, CFile Data Members, File Service Classes


CFile Structures

CFileStatus Used by the CFile::GetStatus function to retrieve status information about a file.


CFileStatus

The CFileStatus structure is used by the CFile::GetStatus function to retrieve status information about a file.

Syntax

struct CFileStatus
{
CTime m_ctime;
CTime m_mtime;
CTime m_atime;
LONG m_size;
BYTE m_attribute;
TCHAR m_szFullName[_MAX_PATH];
};

At a Glance

Header File | Afx.h
Platforms |
Versions | 1.0 and later

Parameters

m_ctime
The date and time the file was created.
m_mtime
The date and time the file was last modified.
m_atime
The date and time the file was last accessed.
m_size
The logical size of the file in bytes, as reported by the DIR command.
m_attribute
The attribute byte of the file. This is the logical OR of the following enumerated values.

enum Attribute {

normal,
readOnly,
hidden,
system,
volume,
directory,
archive
};

m_szFullName
The absolute path name.

See Also

Structures, CFile::GetStatus


CFileDialog

The CFileDialog class encapsulates the Windows common file dialog box, which provides an easy way to implement the standard File Open and File Save As dialog boxes.

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, the file dialogs cannot set or check a file's read-only status, a user cannot select multiple files simultaneously, and the maximum length file name a user can enter in the text box is 255 characters. Windows CE does not currently support drag-and-drop in the Open and Save As dialog boxes.

Windows CE does not support all the fields of the OPENFILENAME structure.

For more information about the Open and Save As dialog boxes, see The Open and Save As Dialog Boxes.

See Also

CFileDialog Member Functions, CFileDialog Data Members, Dialog Box Classes, OPENFILENAME


CFileDialog Member Functions

Construction
CFileDialog Constructs a CFileDialog object.

Operations
DoModal | Displays the dialog box and allows the user to make a selection.
GetPathName | Returns the full path of the selected file.
GetFileName | Returns the filename of the selected file.
GetFileExt | Returns the file extension of the selected file.
GetFileTitle | Returns the title of the selected file.
GetNextPathName | Returns the full path of the next selected file.
GetReadOnlyPref | Returns the read-only status of the selected file.
GetStartPosition | Returns the position of the first element of the filename list.

Overridables
OnShareViolation | Called when a share violation occurs.
OnFileNameOK | Called to validate the filename entered in the dialog box.
OnLBSelChangedNotify | Called when the list box selection changes.
OnFileNameChange | Called to handle the CDN_SELCHANGE notification message.
OnFolderChange | Called to handle the CDN_FOLDERCHANGE notification message.
OnInitDone | Called to handle the CDN_INITDONE notification message.
OnTypeChange | Called to handle the CDN_INITDONE notification message.

See Also

CFileDialog Overview, CFileDialog Data Members, Dialog Box Classes


CFileDialog::CFileDialog

Call this member function to construct a standard Windows file dialog box-object. Either a Open or Save As dialog box is constructed, depending on the value of bOpenFileDialog.

Syntax

CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::DoModal


CFileDialog::DoModal

Call this member function to display the Windows common file dialog box and allow the user to browse files and directories and enter a filename.

Syntax

virtual int DoModal( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CDialog::DoModal, CFileDialog::CFileDialog


CFileDialog::GetFileExt

Call this member function to retrieve the extension of the filename entered into the dialog box. For example, if the name of the file entered is DATA.TXT, GetFileExt returns "TXT".

Syntax

CString GetFileExt( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::GetPathName, CFileDialog::GetFileName, CFileDialog::GetFileTitle


CFileDialog::GetFileName

Call this member function to retrieve the name of the file entered in the dialog box. The name of the file includes only its prefix, without the path or the extension.

Syntax

CString GetFileName( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::GetPathName, GetStartPosition, CFileDialog::GetFileTitle


CFileDialog::GetFileTitle

Call this member function to retrieve the title of the filename entered in the dialog box. The title of the filename includes both the name and the extension.

Syntax

CString GetFileTitle( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::GetPathName, CFileDialog::GetFileName, CFileDialog::GetFileExt


CFileDialog::GetNextPathName

Call this member function to retrieve the next filename from the group selected in the dialog box. The path of the filename includes the file's title plus the entire directory path.

Syntax

CString GetNextPathName( POSITION& pos ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::GetFileName, CFileDialog::GetStartPosition


CFileDialog::GetPathName

Call this member function to retrieve the full path of the file entered in the dialog box. The path of the filename includes the file's title plus the entire directory path.

Syntax

CString GetPathName( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::GetFileName, CFileDialog::GetFileExt, CFileDialog::GetFileTitle


CFileDialog::GetReadOnlyPref

Call this member function to determine whether the Read Only check box has been selected in the Windows standard File Open and File Save As dialog boxes. The Read Only check box can be hidden by setting the OFN_HIDEREADONLY style in the CFileDialog constructor.

Syntax

BOOL GetReadOnlyPref( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::CFileDialog, CFileDialog::GetPathName, CFileDialog::GetFileExt


CFileDialog::GetStartPosition

Call this member function to retrieve the position of the first file path name in the list, if m_ofn.Flags has the OFN_ALLOWMULTISELECT flag set.

Syntax

POSITION GetStartPosition( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::GetFileName, CFileDialog::GetNextPathName, CFileDialog::GetStartPosition


CFileDialog::OnFileNameChange

Override this function to handle the CDN_SELCHANGE notification message. The notification message is sent when the user selects a new file or folder in the file list of the Open or Save As dialog box.

Syntax

virtual void OnFileNameChange( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::OnFolderChange, CDN_SELCHANGE


CFileDialog::OnFileNameOK

Override this function only if you want to provide custom validation of filenames that are entered into a common file dialog box. Normally, you do not need to use this function because the framework provides default validation of filenames and displays a message box if an invalid filename is entered.

Syntax

virtual BOOL OnFileNameOK( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes


CFileDialog::OnFolderChange

Override this function to handle the CDN_FOLDERCHANGE notification message. The notification message is sent when a new folder is opened in the Open or Save As dialog box.

Syntax

virtual void OnFolderChange( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CDN_FOLDERCHANGE


CFileDialog::OnInitDone

Override this function to handle the CDN_INITDONE notification message. The notification message is sent when the system has finished arranging controls in the Open or Save As dialog box to make room for the controls of the child dialog box.

Syntax

virtual void OnInitDone( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CDN_INITDONE


CFileDialog::OnLBSelChangedNotify

This member function is called by the framework whenever the current selection in a list box is about to change. Override this function to provide custom handling of selection changes in the list box.

Syntax

virtual void OnLBSelChangedNotify( UINT nIDBox, UINT iCurSel, UINT nCode);

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes


CFileDialog::OnShareViolation

Override this function to provide custom handling of share violations. Normally, you do not need to use this function because the framework provides default checking of share violations and displays a message box if a share violation occurs.

Syntax

virtual UINT OnShareViolation( LPCTSTR lpszPathName );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CFileDialog::OnFileNameOK


CFileDialog::OnTypeChange

Override this function to handle the CDN_TYPECHANGE notification message. The notification message is sent when the user selects a new file type from the list of file types in the Open or Save As dialog box.

Syntax

virtual void OnTypeChange( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes, CDN_TYPECHANGE


CFileDialog Data Members

Data Members
m_ofn The Windows OPENFILENAME structure. Provides access to basic file dialog box parameters.

CFileDialog Overview, CFileDialog Member Functions, Dialog Box Classes


CFileDialog::m_ofn

The m_ofn data member is an OPENFILENAME structure. Use this structure to initialize the appearance of a File Open or File Save As dialog box after it is constructed but before it is displayed with the DoModal member function.

OPENFILENAME m_ofn;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFileDialog Overview, CFileDialog Data Members, Dialog Box Classes, OPENFILENAME!


CFileException

A CFileException object represents a file-related exception condition.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Member Functions, CFileException Data Members, Exception Classes


CFileException Member Functions

Construction
CFileException Constructs a CFileException object.

Code Conversion
OsErrorToException | Returns a cause code corresponding to an operating system error code.
ErrnoToException | Returns cause code corresponding to a run-time error number.

Helper Functions
ThrowOsError | Throws a file exception based on an operating-system error number.
ThrowErrno | Throws a file exception based on a run-time error number.

See Also

CFileException Overview, CFileException Data Members, Exception Classes


CFileException::CFileException

Use this member function to construct a CFileException object that stores the cause code and the operating-system code in the object.

Syntax

CFileException( int cause = CFileException::none, LONG lOsError = –1 );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, CFileException Member Functions, Exception Classes


CFileException::ErrnoToException

Call this member function to convert a given run-time library error value to a CFileException enumerated error value.

Syntax

static int PASCAL ErrnoToException( int nErrno );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, CFileException Member Functions, Exception Classes, CFileException::OsErrorToException


CFileException::OsErrorToException

Call this member function to retrieve an enumerator that corresponds to a given lOsError value. If the error code is unknown, then the function returns CFileException::generic.

Syntax

static int PASCAL OsErrorToException( LONG lOsError );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, CFileException Member Functions, Exception Classes, CFileException::ErrnoToException


CFileException::ThrowErrno

Call this member function to construct a CFileException object corresponding to a given nErrno value and throw the exception.

Syntax

static void PASCAL ThrowErrno( int nErrno );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, CFileException Member Functions, Exception Classes, CFileException::ThrowOsError


CFileException::ThrowOsError

Call this member function to throw a CFileException corresponding to a given lOsError value.

Syntax

static void PASCAL ThrowOsError( LONG lOsError LPCTSTR lpszFileName = NULL );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, CFileException Member Functions, Exception Classes, CFileException::ThrowErrno


CFileException Data Members

Data Members
m_cause | Contains portable code corresponding to the exception cause.
m_lOsError | Contains the related operating-system error number.
m_strFileName | Contains the name of the file for this exception.

See Also

CFileException Overview, CFileException Member Functions, Exception Classes


CFileException::m_cause

The m_cause data member contains an integer whose values are defined by a CFileException enumerated type. See the Visual C++ documentation for possible values.

int m_cause;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, CFileException Data Members, Exception Classes


CFileException::m_lOsError

The m_lOsError data member contains the operating-system error code for this exception. See your operating-system technical manual for a listing of error codes.

LONG m_lOsError;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, Exception Classes


CFileException::m_strFileName

The m_strFileName data member contains a CString objects that contains the name of the file for this exception condition.

CString m_strFileName;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFileException Overview, CFileException Data Members, Exception Classes, CString


CFindReplaceDialog

The CFindReplaceDialog class allows you to implement standard string Find/Replace dialog boxes in your application.

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Member Functions, CFindReplaceDialog Data Members, CFindReplaceDialog Structures, Dialog Box Classes


CFindReplaceDialog Member Functions

Construction
CFindReplaceDialog | Call this member function to construct a CFindReplaceDialog object.
Create | Creates and displays a CFindReplaceDialog dialog box.

Operations
FindNext | Call this member function to determine whether the user wants to find the next occurrence of the find string.
GetNotifier | Call this member function to retrieve the FINDREPLACE structure in your registered message handler.
GetFindString | Call this member function to retrieve the current find string.
GetReplaceString | Call this member function to retrieve the current replace string.
IsTerminating | Call this member function to determine whether the dialog box is terminating.
MatchCase | Call this member function to determine whether the user wants to match the case of the find string exactly.
MatchWholeWord | Call this member function to determine whether the user wants to match entire words only.
ReplaceAll | Call this member function to determine whether the user wants all occurrences of the string to be replaced.
ReplaceCurrent | Call this member function to determine whether the user wants the current word to be replaced.
SearchDown | Call this member function to determine whether the user wants the search to proceed in a downward direction.

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Data Members, CFindReplaceDialog Structures, Dialog Box Classes


CFindReplaceDialog::CFindReplaceDialog

Call this member function to construct a CFindReplaceDialog object.

Syntax

CFindReplaceDialog( );

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::Create


CFindReplaceDialog::Create

Call this member function to create and display either a Find or Find/Replace dialog box object, depending on the value of bFindDialogOnly.

Syntax

BOOL Create( BOOL bFindDialogOnly, LPCTSTR lpszFindWhat, LPCTSTR lpszReplaceWith = NULL, DWORD dwFlags = FR_DOWN, CWnd* pParentWnd = NULL );

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::CFindReplaceDialog


CFindReplaceDialog::FindNext

Call this member function from your callback function to determine whether the user wants to find the next occurrence of the search string.

Syntax

BOOL FindNext( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::SearchDown


CFindReplaceDialog::GetFindString

Call this member function from your callback function to retrieve the default string to find.

Syntax

CString GetFindString( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::FindNext, CFindReplaceDialog::GetReplaceString


CFindReplaceDialog::GetNotifier

Call this member function to retrieve a pointer to the current Find Replace dialog box. It should be used within your callback function to access the current dialog box, call its member functions, and access the m_fr structure.

Syntax

static CFindReplaceDialog* PASCAL GetNotifier( LPARAM lParam );

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes


CFindReplaceDialog::GetReplaceString

Call this member function to retrieve the current replace string.

Syntax

CString GetReplaceString( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::GetFindString


CFindReplaceDialog::IsTerminating

Call this member function within your callback function to determine whether the user has decided to terminate the dialog box.

Syntax

BOOL IsTerminating( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes


CFindReplaceDialog::MatchCase

Call this member function to determine whether the user wants to match the case of the find string exactly.

Syntax

BOOL MatchCase( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::MatchWholeWord


CFindReplaceDialog::MatchWholeWord

Call this member function to determine whether the user wants to match entire words only.

Syntax

BOOL MatchWholeWord( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::MatchCase


CFindReplaceDialog::ReplaceAll

Call this member function to determine whether the user wants all occurrences of the string to be replaced.

Syntax

BOOL ReplaceAll( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::ReplaceCurrent


CFindReplaceDialog::ReplaceCurrent

Call this member function to determine whether the user wants the current word to be replaced.

Syntax

BOOL ReplaceCurrent( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes, CFindReplaceDialog::ReplaceAll


CFindReplaceDialog::SearchDown

Call this member function to determine whether the user wants the search to proceed in a downward direction.

Syntax

BOOL SearchDown( ) const;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, Dialog Box Classes


CFindReplaceDialog Data Members

Data Members
m_fr A structure used to customize a CFindReplaceDialog object.

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Member Functions, CFindReplaceDialog Structures, Dialog Box Classes


CFindReplaceDialog::m_fr

The m_fr data member is a FINDREPLACE structure. Its members store the characteristics of the dialog-box object. After constructing a CFindReplaceDialog object, you can use m_fr to modify various values in the dialog box.

FINDREPLACE m_fr;

At a Glance

Header file: Afxdlgs.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview, CFindReplaceDialog Data Members, Dialog Box Classes, FINDREPLACE


CFindReplaceDialog Structures

FINDREPLACE Contains information used to initialize the Find and Replace common dialog boxes.


FINDREPLACE

The FINDREPLACE structure contains information used to initialize the Find and Replace common dialog boxes.

Syntax

typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
DWORD Flags;
LPTSTR lpstrFindWhat;
LPTSTR lpstrReplaceWith;
WORD wFindWhatLen;
WORD wReplaceWithLen;
LPARAM lCustData;
LPFRHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
} FINDREPLACE;

At a Glance

Header file: Commdlg.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFindReplaceDialog Overview


CFont

The CFont class encapsulates a Windows graphics device interface (GDI) font and provides member functions for manipulating the font.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE only supports raster fonts; it does not support TrueType fonts. There are seven rasterized system fonts, available in several sizes, built into the Windows CE operating system.

Windows CE does not support all the values for the lfClipPrecision and lfQuality fields in the LOGFONT structure.

See Also

CFont Member Functions, CFont Operators, Graphical Drawing Object Classes, LOGFONT


CFont Member Functions

Construction
CFont Constructs a CFont object.

Initialization
CreateFontIndirect | Initializes a CFont object with the characteristics given in a LOGFONT structure.
CreateFont | Initializes a CFont with the specified characteristics.
CreatePointFont | Initializes a CFont with the specified height, measured in tenths of a point, and typeface.
CreatePointFontIndirect | Same as CreateFontIndirect except that the font height is measured in tenths of a point rather than logical units.

Operations
FromHandle Returns a pointer to a CFont object when given a Windows HFONT.

Attributes
GetLogFont Fills a LOGFONT with information about the logical font attached to the CFont object.

See Also

CFont Overview, CFont Operators, Graphical Drawing Object Classes


CFont::CFont

Use this constructor to construct a CFont object. The resulting object must be initialized with CreateFont, CreateFontIndirect, CreatePointFont, or CreatePointFontIndirect before it can be used.

Syntax

CFont( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes, CFont::CreateFontIndirect, CFont::CreateFont, CFont::CreatePointFont, CFont::CreatePointFontIndirect


CFont::CreateFont

Call this member function to initialize a CFont object with the specified characteristics. The font can subsequently be selected as the font for any device context.

Syntax

BOOL CreateFont( int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes, CFont::CreateFontIndirect, CFont::CreatePointFont


CFont::CreateFontIndirect

Call this member function to initialize a CFont object with the characteristics given in a LOGFONT structure pointed to by lpLogFont. The font can subsequently be selected as the current font for any device.

Syntax

BOOL CreateFontIndirect(const LOGFONT* lpLogFont );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes, CFont::CreateFont, CFont::CreatePointFontIndirect, CDC::SelectObject, CGdiObject::DeleteObject


CFont::CreatePointFont

Call this member function to create a font of a specified typeface and point size. It automatically converts the height in nPointSize to logical units using the CDC object pointed to by pDC.

Syntax

BOOL CreatePointFont( int nPointSize, LPCTSTR lpszFaceName, CDC* pDC = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes, CFont::CreatePointFontIndirect, CFont::CreateFont


CFont::CreatePointFontIndirect

This function is the same as CreateFontIndirect except that the lfHeight member of the LOGFONT is interpreted in tenths of a point rather than device units.

Syntax

BOOL CreatePointFontIndirect( const LOGFONT* lpLogFont, CDC* pDC = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes, CFont::CreatePointFont, CFont::CreateFontIndirect


CFont::FromHandle

Call this member function to obtain a pointer to a CFont object when you have an HFONT handle to a Windows GDI font object.

Syntax

static CFont* PASCAL FromHandle( HFONT hFont );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes


CFont::GetLogFont

Call this member function to retrieve a copy of the LOGFONT structure for CFont.

Syntax

int GetLogFont( LOGFONT * pLogFont );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes


CFont Operators

Attributes
operator HFONT Returns the Windows GDI font handle attached to the CFont object.

See Also

CFont Overview, CFont Member Functions, Graphical Drawing Object Classes


CFont::operator HFONT

Use this operator to get the Windows GDI handle to the font attached to the CFont object.

Syntax

operator HFONT( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFont Overview, CFont Operators, Graphical Drawing Object Classes


CFontHolder

The CFontHolder class encapsulates the functionality of a Windows font object and the IFont interface. It implements the stock Font property. Use this class to implement custom font properties for your control. CFontHolder does not have a base class.

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Member Functions, CFontHolder Data Members, ActiveX Type Wrappers, CPropExchange


CFontHolder Member Functions

Construction
CFontHolder Constructs a CFontHolder object.

Operations
GetFontDispatch | Returns the font's IDispatch interface.
GetDisplayString | Retrieves the string displayed in a container's property browser.
GetFontHandle | Returns a handle to a Windows font.
InitializeFont | Initializes a CFontHolder object.
ReleaseFont | Disconnects the CFontHolder object from the IFont and IFontNotification interfaces.
Select | Selects a font resource into a device context.
SetFont | Connects the CFontHolder object to an IFont interface.

See Also

CFontHolder Overview, CFontHolder Data Members, ActiveX Type Wrappers


CFontHolder::CFontHolder

Use this constructor to construct a CFontHolder object. You must call InitializeFont to initialize the resulting object before using it.

Syntax

CFontHolder( LPPROPERTYNOTIFYSINK pNotify );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers, CFontHolder::InitializeFont


CFontHolder::GetDisplayString

Call this member function to retrieve a string that can be displayed in a container's property browser.

Syntax

BOOL GetDisplayString( CString& strValue );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers


CFontHolder::GetFontDispatch

Call this member function to retrieve a pointer to the font's dispatch interface. Call InitializeFont before calling GetFontDispatch.

Syntax

LPFONTDISP GetFontDispatch( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers, CFontHolder::InitializeFont


CFontHolder::GetFontHandle

Call this member function to retrieve a handle to a Windows font.

The ratio of cyLogical and cyHimetric is used to calculate the proper display size, in logical units, for the font's point size expressed in MM_HIMETRIC units (Display size = (cyLogical / cyHimetric) * font size). The version with no parameters returns a handle to a font sized correctly for the screen.

Syntax

HFONT GetFontHandle( );

HFONT GetFontHandle( long cyLogical, long cyHimetric );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers


CFontHolder::InitializeFont

Call this member function to initialize a CFontHolder object. Call this function after constructing a CFontHolder object.

If pFontDispAmbient is not NULL, the CFontHolder object is connected to a clone of the IFont interface used by the container's ambient Font property.

If pFontDispAmbient is NULL, a new Font object is created either from the font description pointed to by pFontDesc or, if pFontDesc is NULL, from a default description.

Syntax

void InitializeFont( const FONTDESC FAR* pFontDesc = NULL, LPDISPATCH pFontDispAmbient = NULL );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers, CFontHolder::CFontHolder


CFontHolder::ReleaseFont

Call this member function to disconnect the CFontHolder object from its IFont interface.

Syntax

void ReleaseFont( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers, CFontHolder::SetFont


CFontHolder::Select

Call this member function to select a control's font into the specified device context.

Syntax

CFont* Select( CDC* pDC, long cyLogical, long cyHimetric );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers


CFontHolder::SetFont

Call this member function to release any existing font and connect the CFontHolder object to an IFont interface.

Syntax

void SetFont( LPFONT pNewFont );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers, CFontHolder::ReleaseFont


CFontHolder Data Members

Data Members
m_pFont A pointer to the CFontHolder object's IFont interface.

See Also

CFontHolder Overview, CFontHolder Member Functions, ActiveX Type Wrappers


CFontHolder::m_pFont

This data member contains a pointer to the CFontHolder object's IFont interface.

LPFONT m_pFont;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

CFontHolder Overview, CFontHolder Data Members, ActiveX Type Wrappers, CFontHolder::SetFont


CFormView

The CFormView class is the base class used for views containing controls.

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFormView Member Functions, View Classes, CDialog, CScrollView, CView::OnUpdate, CView::OnInitialUpdate, CWnd::UpdateData, CScrollView::ResizeParentToFit


CFormView Member Functions

Construction
CFormView Constructs a CFormView object.

See Also

CFormView Overview, View Classes


CFormView::CFormView

Use these constructors to create a CFormView object and identify the dialog resource on which the view is based. You can identify the resource either by name (pass a string as the argument to the constructor) or by its identifier (pass an unsigned integer as the argument).

Syntax

CFormView( LPCTSTR lpszTemplateName );

CFormView( UINT nIDTemplate );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CFormView Overview, CFormView Member Functions, View Classes, CWnd::Create


CFrameWnd

The CFrameWnd class encapsulates the functionality of a Windows single document interface (SDI) frame window. A frame window is a window that frames an application. In Windows CE, it usually contains a view window and a command bar.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

One of the most interesting new features in Windows CE is command bars, which combines the functionality of a menu bar and a tool bar. MFC for Windows CE supports command bars with the following new member functions, which have been added to the CFrameWnd class.

CFrameWnd::AddAdornments

CFrameWnd::AddBitmap

CFrameWnd::AddComboBoxString

CFrameWnd::GetComboCount

CFrameWnd::GetComboCurSel

CFrameWnd::InsertButtons

CFrameWnd::InsertComboBox

CFrameWnd::InsertMenu

CFrameWnd::SetComboCurSel

MFC for Windows CE also supports a new data member of the CFrameWnd class. The m_hCommandBar member is the window handle to the frame window's command bar.

For more information on command bars and command bar buttons, see the following topics.

Command Bars

Command Bar Buttons

Command Bar Button Styles

Command Bar Button States

MFC for Windows CE does not support the following member functions of the CFrameWnd class.

DockControlBar

EnableDocking

FloatControlBar

GetControlBar

GetDockState

GetMessageBar

GetMessageString

LoadAccelTable

LoadBarState

NegotiateBorderSpace

OnContextHelp

OnSetPreviewMode

RecalcLayout

SaveBarState

SetDockState

SetMessageText

ShowControlBar

See Also

CFrameWnd Member Functions, CFrameWnd Data Members, Frame Windows and Splitter Windows, CWnd, CView, CDocTemplate, CRuntimeClass


CFrameWnd Member Functions

Construction
CFrameWnd Constructs a CFrameWnd object.

Command Bar |
AddAdornments | Adds a Close (X) button to the command bar. You can also use this function to add the OK and Help (?) buttons.
AddBitmap | Adds images to the list of button images available to be used in a command bar.
AddComboBoxString | Adds an element to the list box of the combo box on a command bar.
GetComboCount | Retrieves the number of items in the list-box portion of a combo box on the command bar.
GetComboCurSel | Retrieves the current selection in a command bar's combo box.
InsertButtons | Inserts command bar buttons into the command bar. You can also use this function to insert a bitmap that contains button images.
InsertComboBox | Inserts a combo box into the command bar.
InsertMenu | Inserts a menu bar into the command bar.
SetComboCurSel | Selects an element in the list box of the combo box on a command bar.

Initialization
Create | Call to create and initialize the Windows frame window associated with the CFrameWnd object.
LoadFrame | Call to dynamically create a frame window from resource information.

Operations
ActivateFrame | Makes the frame visible and available to the user.
InitialUpdateFrame | Causes the OnInitialUpdate member function belonging to all views in the frame window to be called.
GetActiveFrame | Returns the active CFrameWnd object.
SetActiveView | Sets the active CView object.
GetActiveView | Returns the active CView object.
CreateView | Creates a view within a frame that is not derived from CView.
GetActiveDocument | Returns the active CDocument object.
IsTracking | Determines if splitter bar is currently being moved.
BeginModalState | Sets the frame window to modal.
EndModalState | Ends the frame window's modal state. Enables all of the windows disabled by BeginModalState.
InModalState | Returns a value indicating whether or not a frame window is in a modal state.
ShowOwnedWindows | Shows all windows that are descendants of the CFrameWnd object.

Overridables
OnCreateClient Creates a client window for the frame.

See Also

CFrameWnd Overview, CFrameWnd Data Members, Frame Windows and Splitter Windows


CFrameWnd::ActivateFrame

Call this member function to activate and restore the frame window so that it is visible and available to the user. This member function is usually called after a non-user interface event such as a DDE, OLE, or other event that may show the frame window or its contents to the user.

Syntax

virtual void ActivateFrame( int nCmdShow = – 1 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::AddAdornments

Call this member function to add the Close button (X) to the command bar. You can also use it to add the Help button (?) and the OK button.

Syntax

BOOL AddAdornments( DWORD dwflags );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Parameters

dwFlags
Optional buttons to be added to the command bar. This parameter can be a combination of the following values, or zero if no additional buttons are needed.
Value | Meaning | Message
CMDBAR_HELP | Help button | WM_HELP
CMDBAR_OK | OK button | WM_COMMAND (with IDOK as the message identifier)

Return Values

TRUE if the function succeeds. FALSE if it fails.

Remarks

When a user selects the Close (X), OK, or Help (?) button, the message associated with that button is placed in the application's message queue.

Every command bar has to have a Close button. The OK button and the Help button are optional.

Don't call the CFrameWnd::AddAdornments member function until after you've added all the other elements (menus, buttons, combo boxes) to the command bar.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::AddBitmap

Call this member function to add one or more images to the list of button images available for use in the command bar.

Syntax

BOOL AddBitmap( int nToolbarBitmapID, int nNImages );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Parameters

nToolbarBitmapID
Identifier of the bitmap resource that contains the button images. You may also use system-defined button bitmaps by specifying:
IDB_STD_SMALL_COLOR
Adds small, color standard bitmaps.
IDB_VIEW_SMALL_COLOR
Adds small, color view bitmaps.
nNImages
Number of button images in the bitmap.

Return Value

TRUE if the function succeeds. FALSE if it fails.

Remarks

Each button image should be 16×16 pixels in size.

If you specify the IDB_STD_SMALL_COLOR in the nToolbarBitmapID parameter, you can use the following values as indexes to the system-defined bitmaps.

STD_COPY | STD_PROPERTIES
STD_CUT | STD_REDOW
STD_DELETE | STD_REPLACE
STD_FIND | STD_PASTE
STD_FILENEW | STD_PRINT
STD_FILEOPEN | STD_PRINTPRE
STD_FILESAVE | STD_UNDO
STD_HELP |

If you specify the IDB_VIEW_SMALL_COLOR in the nToolbarBitmapID parameter, you can use the following values as indexes to the system-defined bitmaps.

VIEW_DETAILS | VIEW_SORTDATE
VIEW_LARGEICONS | VIEW_SORTNAME
VIEW_LIST | VIEW_SORTSIZE
VIEW_SMALLICONS | VIEW_SORTTYPE

Windows CE 1.0 only supports 2 bits per pixel (2bp) gray scale, so the bitmaps won't be displayed in color on Windows CE 1.0 platforms.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::AddComboBoxString

Call this member function to add a string to a combo box on the command bar, and associate it with a data element. This function adds the string at the end of the list of strings in the combo box's list box.

Syntax

BOOL AddComboBoxString ( UINT wStringResourceID, long lItemData=0 );

BOOL AddComboBoxString ( LPCTSTR lpszString, long lItemData=0 );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Parameters

wStringResourceID
Resource identifier of a resource that contains the null-terminated string to be added to the combo box.
lpszString
A pointer to the null-terminated string to be added to the combo box.
lItemData
Specifies a new value to be associated with the item. You could use this parameter to pass a pointer to a data structure containing additional information about the selection.

Return Value

A non-zero value if the function succeeds. Zero if it fails.

Remarks

Use the CB_GETITEMDATA message to retrieve the data you pass to this function in the lItemData parameter.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::BeginModalState

Call this member function to make a frame window modal.

Syntax

virtual void BeginModalState( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::CFrameWnd

Call this member function to construct a CFrameWnd object without creating the visible frame window. Call Create to create the visible window.

Syntax

CFrameWnd( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::Create, CFrameWnd::LoadFrame


CFrameWnd::Create

Call this member function to initialize the frame window's class name and window name and register default values for its style, parent, and associated menu.

You construct a CFrameWnd object in two steps. First, you invoke the constructor, which constructs the CFrameWnd object, then you call Create, which creates the Windows frame window and attaches it to the CFrameWnd object.

Syntax

BOOL Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle = WS_OVERLAPPEDWINDOW, const RECT& rect = rectDefault, CWnd* pParentWnd = NULL, LPCTSTR lpszMenuName = NULL, DWORD dwExStyle = 0, CCreateContext* pContext = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::CFrameWnd, CFrameWnd::LoadFrame, CCreateContext, CWnd::Create, CWnd::PreCreateWindow


CFrameWnd::CreateView

Call this member function to create a view, that is not derived from CView, within a frame.

Syntax

CWnd* CreateView( CCreateContext* pContext, UINT nID = AFX_IDW_PANE_FIRST );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::EndModalState

Call this member function to change a frame window from modal to modeless.

Syntax

virtual void EndModalState( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::GetActiveDocument

Call this member function to obtain a pointer to the current CDocument attached to the current active view.

Syntax

virtual CDocument* GetActiveDocument( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::GetActiveView, CDocument


CFrameWnd::GetActiveFrame

In MFC for Windows CE, this function returns the this pointer.

Syntax

virtual CFrameWnd* GetActiveFrame( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE doesn't support multiple document interface (MDI). This function behaves the same way under Windows CE as it does for single document interface (SDI) applications on the desktop Windows platforms.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::GetActiveView, CFrameWnd::GetActiveDocument, CMDIFrameWnd


CFrameWnd::GetActiveView

Call this member function to obtain a pointer to the active view.

Syntax

CView* GetActiveView( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::SetActiveView, CFrameWnd::GetActiveDocument


CFrameWnd::GetComboCount

Call this member function to retrieve the number of items in the list box part of a combo box on the command bar.

Syntax

int GetComboCount ( ) const;

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Return Value

The number of items in the combo box's list box. The number returned is one greater than the index value of the last item in the list box (the index is zero-based). This function returns CB_ERR if an error occurs.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::GetComboCurSel

Call this member function to retrieve the index number of the currently selected item in a combo box on the command bar.

Syntax

int GetComboCurSel ( ) const;

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Return Value

The zero-based index of the currently selected item in the list box of a combo box on the command bar. This function returns CB_ERR if no item is selected.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::SetComboCurSel


CFrameWnd::InitialUpdateFrame

Call this member function after creating a new frame with Create. This causes all views in that frame window to receive their OnInitialUpdate calls.

Syntax

void InitialUpdateFrame( CDocument* pDoc, BOOL bMakeVisible );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CView::OnInitialUpdate, CFrameWnd::SetActiveView, CDocTemplate::CreateNewFrame


CFrameWnd::InModalState

Call this member function to determine whether a frame window is modal or modeless.

Syntax

BOOL InModalState( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::InsertButtons

Call this member function to add one or more button images to a command bar's button list and insert the buttons into the command bar.

Syntax

BOOL InsertButtons ( LPTBUTTON lpButtons, UINT wNButtons, int nToolbarBitmapID=-1, int nNImages=0 );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Parameters

lpButtons
A pointer to an array of TBBUTTON structures that contains information about the buttons to add to the command bar. There must be the same number of elements in the array as specified by wNButtons.
wNButtons
Number of buttons to add to the command bar.
nToolbarBitmapID
Identifier of the bitmap resource that contains the button images. You can also use the system-defined button bitmaps by specifying one of the following values.
IDB_STD_SMALL_COLOR
Adds small, color standard bitmaps.
IDB_VIEW_SMALL_COLOR
Adds small, color view bitmaps.
nNImages
Number of button images in the bitmap.

Return Value

TRUE if the function succeeds. FALSE if it fails.

Remarks

If the buttons have already been added to the command bar's button list, you can omit the nToolbarBitmapID and nNImages parameters.

Each button image should be 16×16 pixels in size.

If you specify the IDB_STD_SMALL_COLOR in the nToolbarBitmapID parameter, you can use the following values as indexes to the system-defined bitmaps.

STD_COPY | STD_PROPERTIES
STD_CUT | STD_REDOW
STD_DELETE | STD_REPLACE
STD_FIND | STD_PASTE
STD_FILENEW | STD_PRINT
STD_FILEOPEN | STD_PRINTPRE
STD_FILESAVE | STD_UNDO
STD_HELP |

If you specify the IDB_VIEW_SMALL_COLOR in the nToolbarBitmapID parameter, you can use the following values as indexes to the system-defined bitmaps.

VIEW_DETAILS | VIEW_SORTDATE
VIEW_LARGEICONS | VIEW_SORTNAME
VIEW_LIST | VIEW_SORTSIZE
VIEW_SMALLICONS | VIEW_SORTTYPE

Windows CE 1.0 only supports 2 bits per pixel (2bp) gray scale, so the bitmaps won't be displayed in color on Windows CE 1.0 platforms.

CFrameWnd::InsertButtons inserts the specified buttons at the end of the command bar, to the right of any existing elements. If you want to insert a button at a particular index in the command bar, use the global Function, CommandBar_InsertButton. Pass the CFrameWnd::m_hCommandBar data member as the hwndCB parameter to this function.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::AddBitmap, CommandBar_InsertButton


CFrameWnd::InsertComboBox

Call this member function to insert a combo box into the command bar.

Syntax

HWND InsertComboBox ( int nWidth );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Parameters

nWidth
Width, in pixels, of the combo box.

Return Value

The window handle to the combo box. If this function fails, it returns a value of NULL.

Remarks

This member function creates a combo box that has the CBS_DROPDOWNLIST and WS_VSCROLL styles. If you want to use different styles, or if you want to insert more than one combo box in your command bar, use the global Function, CommandBar_InsertComboBox.

CFrameWnd::InsertComboBox inserts the combo box to the right of any existing elements in the command bar. If you want to insert a menu bar at a particular index in the command bar, use the global Function, CommandBar_InsertComboBox. Pass the CFrameWnd::m_hCommandBar data member as the hwndCB parameter to this function.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CommandBar_InsertComboBox


CFrameWnd::InsertMenu

Call this member function to inserts a menu bar into the command bar.

Syntax

HMENU InsertMenu ( LPCTSTR lpszMenuName );

HMENU InsertMenu ( UINT wResourceID );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Parameters

lpszMenuName
A pointer to the null-terminated string that contains the name of the menu bar to be inserted.
wResourceID
Resource identifier of the menu bar to be inserted in the command bar.

Return Value

The window handle to the menu bar. If this function fails, it returns a value of NULL.

Remarks

CFrameWnd::InsertMenu inserts a menu bar, of the same type you use for the main menu in a Windows 95 or Windows NT application, into a command bar. It inserts the menu bar to the right of any existing elements. If you want to insert a menu bar at a particular index in the command bar, use the global Function, CommandBar_InsertMenubar. Pass the CFrameWnd::m_hCommandBar data member as the hwndCB parameter to this function.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CommandBar_InsertMenubar


CFrameWnd::IsTracking

Call this member function to determine whether the splitter bar in the window is currently being moved.

Syntax

BOOL IsTracking( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::LoadFrame

Call this member function to load the Windows frame window and associated resources and attach the frame window to the CFrameWnd object.

You construct a CFrameWnd object in two steps. First, you invoke the constructor, which constructs the CFrameWnd object, and then you call LoadFrame.

Syntax

virtual BOOL LoadFrame( UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CDocTemplate, CFrameWnd::Create, CFrameWnd::CFrameWnd, CWnd::PreCreateWindow


CFrameWnd::OnCreateClient

This member function is called by the framework during the execution of OnCreate. Never Call this member function.

Syntax

virtual BOOL OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::SetActiveView

Call this member function to set the active view. The framework will Call this member function automatically as the user changes the focus to a view within the frame window. You can explicitly call SetActiveView to change the focus to the specified view.

Syntax

void SetActiveView( CView* pViewNew, BOOL bNotify = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::GetActiveView, CView::OnActivateView, CFrameWnd::GetActiveDocument


CFrameWnd::SetComboCurSel

Call this member function to select an element in the list box of the command bar's combo box. If necessary, the list box scrolls the string into view. The text in the edit control of the combo box is changed to reflect the new selection. Any previous selection in the list box is removed.

Syntax

int SetComboCurSel ( int nSelect );

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Parameters

nSelect
Specifies the zero-based index of the string to select. If -1, any current selection in the list box is removed and the edit control is cleared.

Return Value

The zero-based index of the item selected. The return value is CB_ERR if nSelect is greater than the number of items in the list or if nSelect is set to -1, which clears the selection.

Note This member function of the CFrameWnd class is unique to Windows CE.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows, CFrameWnd::GetComboCurSel


CFrameWnd::ShowOwnedWindows

Call this member function to show all windows that are descendants of the CFrameWnd object.

Syntax

void ShowOwnedWindows( BOOL bShow );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd Data Members

Data Members
m_bAutoMenuEnable | Controls automatic enable and disable functionality for menu items.
m_hCommandBar | The window handle to the frame window's command bar.
rectDefault | Pass this static CRect as a parameter when creating a CFrameWnd object to allow Windows to choose the window's initial size and position.

See Also

CFrameWnd Overview, CFrameWnd Member Functions, Frame Windows and Splitter Windows


CFrameWnd::m_bAutoMenuEnable

This data member contains a boolean value that specifies whether menu items that do not have ON_UPDATE_COMMAND_UI or ON_COMMAND handlers will be automatically disabled when the user pulls down a menu. When this data member is set to TRUE (which is the default), they will be automatically disabled.

BOOL m_bAutoMenuEnable;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Data Members, Frame Windows and Splitter Windows, CCmdUI, CCmdTarget


CFrameWnd::m_hCommandBar

This data member contains the window handle to the frame window's command bar.

HWND m_hCommandBar;

At a Glance

Header File | Afxwin.h
Platforms |
Versions | 1.0 and later

Remarks

Pass this HWND as the hwndCB parameter to any of the global command bar Functions if you need to access them directly. You may want to do this if you're adding more than one combo box, or if you want to insert a command bar element at a particular position in the command bar.

See Also

CFrameWnd Overview, CFrameWnd Data Members, Frame Windows and Splitter Windows, CommandBar_InsertButton, CommandBar_InsertComboBox, CommandBar_InsertMenubar


CFrameWnd::rectDefault

This data member contains a static CRect object. Pass this member as a parameter when creating a window to allow Windows to choose the window's initial size and position.

static AFX_DATA const CRect rectDefault;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CFrameWnd Overview, CFrameWnd Data Members, Frame Windows and Splitter Windows


CGdiObject

CGdiObject is the abstract base class for various kinds of Windows graphics device interface (GDI) objects such as bitmaps, regions, brushes, pens, palettes, and fonts.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE supports the following member functions of the CGdiObject class differently than the standard MFC library does.

CGdiObject::CreateStockObject

CGdiObject::DeleteObject

CGdiObject::GetObjectType

MFC for Windows CE does not support the UnrealizeObject member function of the CGdiObject class.

See Also

CGdiObject Member Functions, CGdiObject Data Members, Graphical Drawing Object Classes, CBitmap, CBrush, CFont


CGdiObject Member Functions

Construction
CGdiObject Constructs a CGdiObject object.

Operations
Attach | Attaches a Windows GDI object to a CGdiObject object.
CreateStockObject | Retrieves a handle to one of the Windows predefined stock pens, brushes, or fonts.
DeleteObject | Deletes the Windows GDI object attached to the CGdiObject object from memory by freeing all system storage associated with the object.
DeleteTempMap | Deletes any temporary CGdiObject objects created by FromHandle.
Detach | Detaches a Windows GDI object from a CGdiObject object and returns a handle to the Windows GDI object.
FromHandle | Returns a pointer to a CGdiObject object given a handle to a Windows GDI object.
GetObject | Fills a buffer with data that describes the Windows GDI object attached to the CGdiObject object.
GetObjectType | Retrieves the type of the GDI object.
GetSafeHandle | Returns m_hObject unless this is NULL, in which case NULL is returned.

See Also

CGdiObject Overview, CGdiObject Data Members, Graphical Drawing Object Classes


CGdiObject::Attach

Use this member function to attach a Windows GDI object to a CGdiObject object.

Syntax

BOOL Attach( HGDIOBJ hObject );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CGdiObject::Detach


CGdiObject::CGdiObject

Use this member function to construct a CGdiObject object. Never create a CGdiObject directly. Rather, you create an object from one of its derived classes, such as CPen or CBrush.

Syntax

CGdiObject( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CPen, CBrush, CFont, CBitmap, CRgn


CGdiObject::CreateStockObject

Use this member function to retrieve a handle to one of the predefined stock pens, brushes or fonts.

Syntax

BOOL CreateStockObject ( int nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE doesn't support the following stock objects in the nIndex parameter.

ANSI_FIXED_FONT

ANSI_VAR_FONT

DEFAULT_PALETTE

OEM_FIXED_FONT

SYSTEM_FIXED_FONT

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CBrush::CBrush, CFont::CFont


CGdiObject::DeleteObject

Use this member function to deletes the GDI object by freeing all system storage associated with it.

Syntax

BOOL DeleteObject ( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, if the GDI object is currently selected into a device context, this function returns FALSE.

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CGdiObject::Detach


CGdiObject::DeleteTempMap

This member function is called automatically by the CWinApp idle-time handler, DeleteTempMap deletes any temporary CGdiObject objects created by FromHandle. DeleteTempMap detaches the Windows GDI object attached to a temporary CGdiObject object before deleting the CGdiObject object.

Syntax

static void PASCAL DeleteTempMap( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CGdiObject::Detach, CGdiObject::FromHandle


CGdiObject::Detach

Call this member function to detach a Windows GDI object from a CGdiObject object and returns a handle to the Windows GDI object.

Syntax

HGDIOBJ Detach( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CGdiObject::Attach


CGdiObject::FromHandle

Use this member function to obtain a pointer to a CGdiObject object given a handle to a Windows GDI object. If a CGdiObject object is not already attached to the Windows GDI object, a temporary CGdiObject object is created and attached.

Syntax

static CGdiObject* PASCAL FromHandle( HGDIOBJ hObject );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CGdiObject::DeleteTempMap


CGdiObject::GetObject

Use this member function to fill a buffer with data that defines a specified object.

Syntax

int GetObject( int nCount, LPVOID lpObject ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes,


CGdiObject::GetObjectType

Use this member function to retrieve the type of the specified object.

Syntax

UINT GetObjectType ( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 doesn't support the following return values.

OBJ_ENHMETADC

OBJ_ENHMETAFILE

OBJ_EXTPEN

OBJ_METADC

OBJ_METAFILE

OBJ_PAL

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CDC::SelectObject


CGdiObject::GetSafeHandle

Use this member function to retrieve the m_hObject data member. If this is NULL, NULL is returned. This is part of the general handle interface paradigm and is useful when NULL is a valid or special value for a handle.

Syntax

HGDIOBJ GetSafeHandle( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes, CGdiObject ::m_hObject


CGdiObject Data Members

Data Members
m_hObject A HANDLE containing the HBITMAP, HPALETTE, HRGN, HBRUSH, HPEN, or HFONT attached to this object.

See Also

CGdiObject Overview, CGdiObject Member Functions, Graphical Drawing Object Classes


CGdiObject::m_hObject

This data member contains a HANDLE to the HBITMAP, HRGN, HBRUSH, HPEN, HPALETTE, or HFONT attached to this object.

HGDIOBJ m_hObject;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CGdiObject Overview, CGdiObject Data Members, Graphical Drawing Object Classes


CHeaderCtrl

The CHeaderCtrl class provides the functionality of the Windows common header control.

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Member Functions, Control Classes, CTabCtrl, CListCtrl


CHeaderCtrl Member Functions

Construction
CHeaderCtrl | Constructs a CHeaderCtrl object.
Create | Creates a header control and attaches it to a CHeaderCtrl object.

Attributes
GetItemCount | Retrieves a count of the items in a header control.
GetItem | Retrieves information about an item in a header control.
SetItem | Sets the attributes of the specified item in a header control.

Operations
InsertItem | Inserts a new item into a header control.
DeleteItem | Deletes an item from a header control.
Layout | Retrieves the size and position of a header control within a given rectangle.

Overridables
DrawItem Draws the specified item of a header control.

See Also

CHeaderCtrl Overview, Control Classes


CHeaderCtrl::CHeaderCtrl

Call this member function to construct a CHeaderCtrl object.

Syntax

CHeaderCtrl( );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes, CHeaderCtrl::Create


CHeaderCtrl::Create

Call this member function to create the header control and attach it to the CHeaderCtrl object.

You construct a CHeaderCtrl object in two steps. First call the contructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

Remarks

Windows CE supports two new styles for header controls. The HDS_DRAGDROP style allows drag-and-drop reordering of header items. The HDS_FULLDRAG style causes the header control to display column contents even while a user resizes a column. For more infromation on supported header control styles, see Header Control Styles.

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes, CHeaderCtrl::CHeaderCtrl


CHeaderCtrl::DeleteItem

Call this member function to delete an item from a header control.

Syntax

BOOL DeleteItem( int nPos );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes, CHeaderCtrl::InsertItem


CHeaderCtrl::DrawItem

This member function is called by the framework when a visual aspect of an owner-draw header control changes. The itemAction member of the DRAWITEMSTRUCT structure defines the drawing action that is to be performed.

Syntax

void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes, CWnd::OnDrawItem


CHeaderCtrl::GetItem

Call this member function to retrieve information about a header control item.

Syntax

BOOL GetItem( int nPos, HD_ITEM* pHeaderItem ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes, CHeaderCtrl::SetItem


CHeaderCtrl::GetItemCount

Call this member function to retrieve a count of the items in a header control.

Syntax

int GetItemCount( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes, CHeaderCtrl::GetItem, CHeaderCtrl::SetItem


CHeaderCtrl::InsertItem

Call this member function to insert a new item into a header control at the specified index.

Syntax

int InsertItem( int nPos, HD_ITEM* phdi );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes, CHeaderCtrl::DeleteItem, CHeaderCtrl::GetItem


CHeaderCtrl::Layout

Call this member function to retrieve the size and position of a header control within a given rectangle. This function is used to determine the appropriate dimensions for a new header control that is to occupy the given rectangle.

Syntax

BOOL Layout( HD_LAYOUT* pHeaderLayout );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes


CHeaderCtrl::SetItem

Call this member function to set the attributes of the specified item in a header control.

Syntax

BOOL SetItem( int nPos, HD_ITEM* pHeaderItem );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CHeaderCtrl Overview, CHeaderCtrl Member Functions, Control Classes CHeaderCtrl::GetItem, CHeaderCtrl::GetItemCount


CImageList

The CImageList class encapsulates the functionality of a Windows image list common control. An image list is a collection of images, all the same size, that can be referenced by their zero-based indexes.

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Note Windows CE does not support cursors, except for the wait cursor (the spinning hourglass), so image lists cannot contain cursors.

See Also

CImageList Member Functions, CImageList Data Members, Control Support Classes, CListCtrl, CTabCtrl


CImageList Member Functions

Construction
CImageList | Constructs a CImageList object.
Create | Initializes an image list and attaches it to a CImageList object.

Attributes
GetSafeHandle | Retrieves m_hImageList.
GetImageCount | Retrieves the number of images in an image list.
SetBkColor | Sets the background color for an image list.
GetBkColor | Retrieves the current background color for an image list.
GetImageInfo | Retrieves information about an image.

Operations
Attach | Attaches an image list to a CImageList object.
Detach | Detaches an image list object from a CImageList object and returns a handle to an image list.
DeleteImageList | Deletes an image list.
Add | Adds an image or images to an image list.
Remove | Removes an image from an image list.
Replace | Replaces an image in an image list with a new image.
ExtractIcon | Creates an icon based on an image and mask in an image list.
Draw | Draws the image that is being dragged during a drag-and-drop operation.
SetOverlayImage | Adds the zero-based index of an image to the list of images to be used as overlay masks.
SetDragCursorImage | Creates a new drag image.
Read | Reads an image list from an archive.
Write | Writes an image list to an archive.
GetDragImage | Gets the temporary image list that is used for dragging.
BeginDrag | Begins dragging an image.
DragEnter | Locks updates during a drag operation and displays the drag image at a specified position.
EndDrag | Ends a drag operation.
DragLeave | Unlocks the window and hides the drag image so that the window can be updated.
DragMove | Moves the image that is being dragged during a drag-and-drop operation.
DragShowNolock | Shows or hides the drag image during a drag operation, without locking the window.

See Also

CImageList Overview, CImageList Data Members, Control Support Classes


CImageList::Add

Call this member function to add one or more images or an icon to an image list.

Syntax

int Add( CBitmap* pbmImage, CBitmap* pbmMask );

int Add( CBitmap* pbmImage, COLORREF crMask );

int Add( HICON hIcon );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Remove, CImageList::Replace


CImageList::Attach

Call this member function to attach an image list to a CImageList object.

Syntax

BOOL Attach( HIMAGELIST hImageList );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Detach, CImageList::GetSafeHandle


CImageList::BeginDrag

Call this member function to begin dragging an image. This function creates a temporary image list that is used for dragging. The image combines the specified image and its mask with the current cursor. In response to subsequent WM_MOUSEMOVE messages, you can move the drag image by using the DragMove member function. To end the drag operation, you can use the EndDrag member function.

Syntax

BOOL BeginDrag( int nImage, CPoint ptHotSpot );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Draw, CImageList::EndDrag, CImageList::DragMove


CImageList::CImageList

Use this constructor to construct a CImageList object.

Syntax

CImageList( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Create


CImageList::Create

Call this member function to create an image list and attach it to the CImageList object.

You construct a CImageList in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( int cx, int cy, BOOL bMask, int nInitial, int nGrow );

BOOL Create( UINT nBitmapID, int cx, int nGrow, COLORREF crMask );

BOOL Create( LPCTSTR lpszBitmapID, int cx, int nGrow, COLORREF crMask );

BOOL Create( CImageList& imagelist1, int nImage1, CImageList& imagelist2, int nImage2, int dx, int dy );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::CImageList


CImageList::DeleteImageList

Call this member function to delete an image list.

Syntax

BOOL DeleteImageList( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Detach


CImageList::Detach

Call this member function to detach an image list object from a CImageList object. This function returns a handle to the image list object.

Syntax

HIMAGELIST Detach( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Attach, CImageList::DeleteImageList


CImageList::DragEnter

Call this member function to lock updates to the window specified by pWndLock, during a drag operation, and display the drag image at the position specified by point.

Syntax

static BOOL DragEnter( CWnd* pWndLock, CPoint point );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::BeginDrag, CImageList::EndDrag, CImageList::DragMove, CImageList::DragLeave


CImageList::DragLeave

Call this member function to unlock the window specified by pWndLock, and hide the drag image, allowing the window to be updated.

Syntax

static BOOL DragLeave( CWnd* pWndLock );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::BeginDrag, CImageList::EndDrag, CImageList::DragMove, CImageList::DragEnter


CImageList::DragMove

Call this member function to move the image that is being dragged during a drag-and-drop operation. This function is typically called in response to a WM_MOUSEMOVE message. To begin a drag operation, use the BeginDrag member function.

Syntax

static BOOL DragMove( CPoint pt );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::BeginDrag, CImageList::EndDrag, CImageList::Draw


CImageList::DragShowNolock

Call this member function to show or hide the drag image during a drag operation, without locking the window.

Syntax

static BOOL DragShowNolock( BOOL bShow );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::BeginDrag, CImageList::EndDrag, CImageList::DragEnter, CImageList::DragLeave, CImageList::Draw


CImageList::Draw

Call this member function to draw the image that is being dragged during a drag-and-drop operation.

Syntax

BOOL Draw( CDC* pdc, int nImage, POINT pt, UINT nStyle );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::BeginDrag, CImageList::EndDrag, CImageList::DragMove


CImageList::EndDrag

Call this member function to end a drag operation. To begin a drag operation, use the BeginDrag member function.

Syntax

static void EndDrag( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::BeginDrag, CImageList::Draw, CImageList::DragMove


CImageList::ExtractIcon

Call this member function to create an icon based on an image and its related mask in an image list.

Syntax

HICON ExtractIcon( int nImage );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Replace


CImageList::GetBkColor

Call this member function to retrieve the current background color for an image list.

Syntax

COLORREF GetBkColor( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::SetBkColor


CImageList::GetDragImage

Call this member function to retrieve the temporary image list that is used for dragging.

Syntax

static CImageList* GetDragImage( LPPOINT lpPoint, LPPOINT lpPointHotSpot );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::SetDragCursorImage


CImageList::GetImageCount

Call this member function to retrieve the number of images in an image list.

Syntax

int GetImageCount( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::GetImageInfo


CImageList::GetImageInfo

Call this member function to retrieve information about an image.

Syntax

BOOL GetImageInfo( int nImage, IMAGEINFO* pImageInfo ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::GetImageCount


CImageList::GetSafeHandle

Call this member function to retrieve the m_hImageList data member.

Syntax

HIMAGELIST GetSafeHandle( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Attach, CImageList::Detach, CImageList::m_hImageList


CImageList::Read

Call this member function to read an image list from an archive.

Syntax

BOOL Read( CArchive* pArchive );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Write


CImageList::Remove

Call this member function to remove an image from an image list object.

Syntax

BOOL Remove( int nImage );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::DeleteImageList


CImageList::Replace

Call this member function to replace an image in an image list with a new image.

Syntax

BOOL Replace( int nImage, CBitmap* pbmImage, CBitmap* pbmMask );

int Replace( int nImage, HICON hIcon );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Remove


CImageList::SetBkColor

Call this member function to set the background color for an image list.

Syntax

COLORREF SetBkColor( COLORREF cr );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::GetBkColor


CImageList::SetDragCursorImage

Call this member function to create a new drag image by combining the given image (typically a mouse cursor image) with the current drag image.

Syntax

BOOL SetDragCursorImage( int nDrag, CPoint ptHotSpot );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::BeginDrag, CImageList::EndDrag, CImageList::GetDragImage


CImageList::SetOverlayImage

Call this member function to add the zero-based index of an image to the list of images to be used as overlay masks. Up to four indices can be added to the list.

Syntax

BOOL SetOverlayImage( int nImage, int nOverlay );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Add


CImageList::Write

Call this member function to write an image list object to an archive.

Syntax

BOOL Write( CArchive* pArchive );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes, CImageList::Read


CImageList Data Members

Data Members
m_hImageList A handle containing the image list attached to this object.

See Also

CImageList Overview, CImageList Member Functions, Control Support Classes


CImageList::m_hImageList

This data member contains the handle to the image list attached to this object.

HIMAGELIST m_hImageList;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CImageList Overview, CImageList Data Members, Control Support Classes, CImageList::Attach, CImageList::Detach, CImageList::Attach


CList

The CList class supports ordered lists of nonunique objects accessible sequentially or by value. CList lists behave like doubly-linked lists.

template< class TYPE, class ARG_TYPE >class CList : public CObject

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Member Functions, List Classes, CMap, CArray


CList Member Functions

Construction
CList Constructs a CList object.

Head/Tail Access
GetHead | Returns the head element of the list (cannot be empty).
GetTail | Returns the tail element of the list (cannot be empty).

Operations
RemoveHead | Removes the element from the head of the list.
RemoveTail | Removes the element from the tail of the list.
AddHead | Adds an element (or all the elements in another list) to the head of the list (makes a new head).
AddTail | Adds an element (or all the elements in another list) to the tail of the list (makes a new tail).
RemoveAll | Removes all the elements from this list.

Iteration
GetHeadPosition | Returns the position of the head element of the list.
GetTailPosition | Returns the position of the tail element of the list.
GetNext | Gets the next element for iterating.
GetPrev | Gets the previous element for iterating.

Retrieval/Modification
GetAt | Gets the element at a given position.
SetAt | Sets the element at a given position.
RemoveAt | Removes an element from this list, specified by position.

Insertion
InsertBefore | Inserts a new element before a given position.
InsertAfter | Inserts a new element after a given position.

Searching
Find | Gets the position of an element specified by pointer value.
FindIndex | Gets the position of an element specified by a zero-based index.

Status
GetCount | Returns the number of elements in this list.
IsEmpty | Tests for the empty list condition (no elements).

See Also

CList Overview, List Classes


CList::AddHead

Call this member function to add a new element or list of elements to the head of this list. The list can be empty before the operation.

Syntax

POSITION AddHead( ARG_TYPE newElement );

void AddHead( CList* pNewList );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetHead, CList::RemoveHead


CList::AddTail

Call this member function to add a new element or list of elements to the tail of this list. The list can be empty before the operation.

Syntax

POSITION AddTail( ARG_TYPE newElement );

void AddTail( CList* pNewList );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CObList::GetTail, CObList::RemoveTail


CList::CList

Use this constructor to construct an empty ordered list. As the list grows, memory is allocated in units of nBlockSize entries.

Syntax

CList( int nBlockSize = 10 );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CObList::GetTail, CObList::RemoveTail


CList::Find

Call this member function to search the list sequentially for the first element matching the specified searchValue. Note that the pointer values are compared, not the contents of the objects.

Syntax

POSITION Find( ARG_TYPE searchValue, POSITION startAfter = NULL) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetNext, CList::GetPrev


CList::FindIndex

Call this member function to start a sequential scan from the head of the list, stopping on the nIndexth element.

Syntax

POSITION FindIndex( int nIndex ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CObList::Find, CObList::GetNext, CObList::GetPrev


CList::GetAt

Call this member function to retrieve the element (or a reference to the element) associated with a given position. The position parameter is a key for the list. It is not the same as an index, and you cannot operate on the position value yourself.

Syntax

TYPE& GetAt( POSITION position );

TYPE GetAt( POSITION position ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::Find, CList::SetAt, CList::GetNext, CList::GetPrev, CList::GetHead


CList::GetCount

Call this member function to retrieve the number of elements in this list.

Syntax

int GetCount() const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::IsEmpty


CList::GetHead

Call this member function to retrieve the head element (or a reference to the head element) of this list.

Syntax

TYPE& GetHead( );

TYPE GetHead( ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetTail, CList::GetTailPosition, CList::AddHead, CList::RemoveHead


CList::GetHeadPosition

Call this member function to retrieve the position of the head element of this list.

Syntax

POSITION GetHeadPosition( ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetTailPosition


CList::GetNext

Call this member function to retrieve the list element identified by rPosition, and then set rPosition to the POSITION value of the next entry in the list. You can use GetNext in a forward iteration loop if you establish the initial position with a call to GetHeadPosition or Find.

Syntax

TYPE& GetNext( POSITION& rPosition );

TYPE GetNext( POSITION& rPosition ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::Find, CList::GetHeadPosition, CList::GetTailPosition, CList::GetPrev, CList::GetHead


CList::GetPrev

Call this member function to retrieve the list element identified by rPosition, and then set rPosition to the POSITION value of the previous entry in the list. You can use GetPrev in a reverse iteration loop if you establish the initial position with a call to GetTailPosition or Find.

Syntax

TYPE& GetPrev( POSITION& rPosition );

TYPE GetPrev( POSITION& rPosition ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::Find, CList::GetTailPosition, CList::GetHeadPosition, CList::GetNext, CList::GetHead


CList::GetTail

Call this member function to retrieve the CObject pointer that represents the tail element of this list.

Syntax

TYPE& GetTail( );

TYPE GetTail() const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::AddTail, CList::AddHead, CList::RemoveHead, CList::GetHead


CList::GetTailPosition

Call this member function to retrieve the position of the tail element of this list; NULL if the list is empty.

Syntax

POSITION GetTailPosition( ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetHeadPosition, CList::GetTail


CList::InsertAfter

Call this member function to add an element to this list after the element at the specified position.

Syntax

POSITION InsertAfter( POSITION position, ARG_TYPE newElement );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::Find, CList::InsertBefore


CList::InsertBefore

Call this member function to add an element to this list before the element at the specified position.

Syntax

POSITION InsertBefore( POSITION position, ARG_TYPE newElement );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::Find, CList::InsertAfter


CList::IsEmpty

Call this member function to determine whether this list is empty.

Syntax

BOOL IsEmpty( ) const;

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetCount


CList::RemoveAll

Call this member function to remove all the elements from this list and free the associated memory. No error is generated if the list is already empty.

Syntax

void RemoveAll( );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::RemoveAt


CList::RemoveAt

Call this member function to remove the specified element from this list.

Syntax

void RemoveAt( POSITION position );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::RemoveAll


CList::RemoveHead

Call this member function to remove the element from the head of the list and returns a pointer to it.

Syntax

TYPE RemoveHead( );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetHead, CList::AddHead


CList::RemoveTail

Call this member function to remove the element from the tail of the list and returns a pointer to it.

Syntax

TYPE RemoveTail( );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::GetTail, CList::AddTail


CList::SetAt

Call this member function to write the element to the specified position in the list. The pos parameter is a key for the list. It is not the same as an index, and you cannot operate on its value yourself.

Syntax

void SetAt( POSITION pos, ARG_TYPE newElement );

At A Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CList Overview, CList Member Functions, List Classes, CList::Find, CList::GetAt, CList::GetNext, CList::GetPrev


CListBox

The CListBox class encapsulates the functionality of a Windows list box., which is a window that displays a list of character strings.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE supports the CListBox::InitStorage and CListBox::SetItemHeight member functions differently than the standard MFC library does.

Windows CE doesn't support owner-drawn list boxes, so you can't specify ODT_LISTBOX in the CtlType field of a DRAWITEMSTRUCT or a MEASUREITEMSTRUCT structure.

See Also

CListBox Member Functions, Control Classes, CListBox::InitStorage, CListBox::SetItemHeight, CWnd, CComboBox


CListBox Member Functions

Construction
CListBox Constructs a CListBox object.

Initialization
Create | Creates the Windows list box and attaches it to the CListBox object.
InitStorage | Preallocates blocks of memory for list box items and strings.

General Operations
GetCount | Returns the number of strings in a list box.
GetHorizontalExtent | Returns the width in pixels that a list box can be scrolled horizontally.
SetHorizontalExtent | Sets the width in pixels that a list box can be scrolled horizontally.
GetTopIndex | Returns the index of the first visible string in a list box.
SetTopIndex | Sets the zero-based index of the first visible string in a list box.
GetItemData | Returns the 32-bit value associated with the list-box item.
GetItemDataPtr | Returns a pointer to a list-box item.
SetItemData | Sets the 32-bit value associated with the list-box item.
SetItemDataPtr | Sets a pointer to the list-box item.
GetItemRect | Returns the bounding rectangle of the list-box item as it is currently displayed.
ItemFromPoint | Returns the index of the list-box item nearest a point.
SetItemHeight | Sets the height of items in a list box.
GetItemHeight | Determines the height of items in a list box.
GetSel | Returns the selection state of a list-box item.
GetText | Copies a list-box item into a buffer.
GetTextLen | Returns the length in bytes of a list-box item.
SetColumnWidth | Sets the column width of a multicolumn list box.
SetTabStops | Sets the tab-stop positions in a list box.
GetLocale | Retrieves the locale identifier for a list box.
SetLocale | Sets the locale identifier for a list box.

Single-Selection Operations
GetCurSel | Returns the zero-based index of the currently selected string in a list box.
SetCurSel | Selects a list-box string.

Multiple-Selection Operations
SetSel | Selects or deselects a list-box item in a multiple-selection list box.
GetCaretIndex | Determines the index of the item that has the focus rectangle in a multiple-selection list box.
SetCaretIndex | Sets the focus rectangle to the item at the specified index in a multiple-selection list box.
GetSelCount | Returns the number of strings currently selected in a multiple-selection list box.
GetSelItems | Returns the indices of the strings currently selected in a list box.
SelItemRange | Selects or deselects a range of strings in a multiple-selection list box.
SetAnchorIndex | Sets the anchor in a multiple-selection list box to begin an extended selection.
GetAnchorIndex | Retrieves the zero-based index of the current anchor item in a list box.

String Operations
AddString | Adds a string to a list box.
DeleteString | Deletes a string from a list box.
InsertString | Inserts a string at a specific location in a list box.
ResetContent | Clears all the entries from a list box.
Dir | Adds filenames from the current directory to a list box.
FindString | Searches for a string in a list box.
FindStringExact | Finds the first list-box string that matches a specified string.
SelectString | Searches for and selects a string in a single-selection list box.

Overridables
DrawItem | Called by the framework when a visual aspect of an owner-draw list box changes.
MeasureItem | Called by the framework when an owner-draw list box is created to determine list-box dimensions.
CompareItem | Called by the framework to determine the position of a new item in a sorted owner-draw list box.
DeleteItem | Called by the framework when the user deletes an item from an owner-draw list box.
VKeyToItem | Override to provide custom WM_KEYDOWN handling for list boxes with the LBS_WANTKEYBOARDINPUT style set.
CharToItem | Override to provide custom WM_CHAR handling for owner-draw list boxes which don't have strings.

See Also

CListBox Overview, Control Classes


CListBox::AddString

Call this member function to add a string to a list box.

Syntax

int AddString( LPCTSTR lpszItem );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::InsertString, CListBox::CompareItem


CListBox::CharToItem

This member function is called by the framework when the list box's parent window receives a WM_CHARTOITEM message from the list box.

Syntax

virtual int CharToItem( UINT nKey, UINT nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::VKeyToItem, CListBox::SetCurSel, CListBox::SetSel, CListBox::SetCaretIndex


CListBox::CListBox

Call this member function to initialize the Windows list box and attach it to the CListBox.

You construct a CListBox object in two steps. First call the constructor CListBox, then call Create.

Syntax

CListBox( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::Create


CListBox::CompareItem

This member function is called by the framework to determine the relative position of a new item in a sorted owner-draw list box.

Syntax

virtual int CompareItem( LPCOMPAREITEMSTRUCT lpCompareItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CWnd::OnCompareItem, CListBox::DrawItem, CListBox::MeasureItem, CListBox::DeleteItem


CListBox::Create

Call this member function to initialize the Windows list box and attach it to the CListBox object.

You construct a CListBox object in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE supports a new list box style, called LBS_EX_CONSTSTRINGDATA. When an application inserts a string into a list box that has this style, the list box stores the pointer passed to it by the application rather than copying the string. This saves RAM resources when you have a large table of strings in ROM that you want to insert into a list box. All list boxes in Windows CE have the LBS_HASSTRINGS style by default. For more information on list box styles, see List Box Styles.

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::CListBox


CListBox::DeleteItem

This member function is called by the framework when the user deletes an item from an owner-draw CListBox object or destroys the list box.

Syntax

virtual void DeleteItem( LPDELETEITEMSTRUCT lpDeleteItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::CompareItem, CWnd::OnDeleteItem, CListBox::DrawItem, CListBox::MeasureItem


CListBox::DeleteString

Call this member function to delete an item in a list box.

Syntax

int DeleteString( UINT nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::AddString, CListBox::InsertString


CListBox::Dir

Call this member function to add a list of filenames and/or drives to a list box.

Syntax

int Dir( UINT attr, LPCTSTR lpszWildCard );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 only
Complete documentation | Visual C++ documentation

Remarks

Version 1.0 of Windows CE supports this member function; versions 2.0 and later do not.

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CFile::GetStatus


CListBox::DrawItem

This member function is called by the framework when a visual aspect of an owner-draw list box changes.

Syntax

virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::CompareItem, CWnd::OnDrawItem, CListBox::MeasureItem, CListBox::DeleteItem


CListBox::FindString

Call this member function to find the first string in a list box that contains the specified prefix, without changing the list-box selection.

Syntax

int FindString( int nStartAfter, LPCTSTR lpszItem ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SelectString, CListBox::AddString, CListBox::InsertString


CListBox::FindStringExact

Call this member function to find the first list-box string that matches the string specified in lpszFind.

Syntax

int FindStringExact( int nIndexStart, LPCTSTR lpszFind ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::FindString


CListBox::GetAnchorIndex

Call this member function to retrieve the zero-based index of the current anchor item in the list box.

Syntax

int GetAnchorIndex( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetAnchorIndex


CListBox::GetCaretIndex

Call this member function to determine the index of the item that has the focus rectangle in a multiple-selection list box.

Syntax

int GetCaretIndex( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetCaretIndex


CListBox::GetCount

Call this member function to retrieve the number of items in a list box.

Syntax

int GetCount( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes


CListBox::GetCurSel

Call this member function to retrieve the zero-based index of the currently selected item, if any, in a single-selection list box.

Syntax

int GetCurSel( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetCurSel


CListBox::GetHorizontalExtent

Call this member function to retrieve the width in pixels by which the list box can be scrolled horizontally. This is applicable only if the list box has a horizontal scroll bar.

Syntax

int GetHorizontalExtent( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetHorizontalExtent


CListBox::GetItemData

Call this member function to retrieve the application-supplied doubleword value associated with the specified list-box item.

Syntax

DWORD GetItemData( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::AddString, CListBox::GetItemDataPtr, CListBox::SetItemDataPtr, CListBox::InsertString, CListBox::SetItemData


CListBox::GetItemDataPtr

Call this member function to retrieve the application-supplied 32-bit value associated with the specified list-box item as a pointer (void*).

Syntax

void* GetItemDataPtr( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::AddString, CListBox::GetItemData, CListBox::InsertString, CListBox::SetItemData


CListBox::GetItemHeight

Call this member function to determine the height of items in a list box.

Syntax

int GetItemHeight( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetItemHeight


CListBox::GetItemRect

Call this member function to retrieve the dimensions of the rectangle that bounds a list-box item as it is currently displayed in the list-box window.

Syntax

int GetItemRect( int nIndex, LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes


CListBox::GetLocale

Call this member function to retrieve the locale used by the list box. The locale is used, for example, to determine the sort order of the strings in a sorted list box.

Syntax

LCID GetLocale( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetLocale


CListBox::GetSel

Call this member function to retrieve the selection state of an item. This member function works with both single- and multiple-selection list boxes.

Syntax

int GetSel( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetSel


CListBox::GetSelCount

Call this member function to retrieve the total number of selected items in a multiple-selection list box.

Syntax

int GetSelCount( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetSel


CListBox::GetSelItems

Call this member function to fill a buffer with an array of integers that specifies the item numbers of selected items in a multiple-selection list box.

Syntax

int GetSelItems( int nMaxItems, LPINT rgIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes


CListBox::GetText

Call this member function to retrieve a string from a list box. The second form of this member function fills a CString object with the string text.

Syntax

int GetText( int nIndex, LPTSTR lpszBuffer ) const;

void GetText( int nIndex, CString& rString ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetTextLen


CListBox::GetTextLen

Call this member function to retrieve the length of a string in a list-box item.

Syntax

int GetTextLen( int nIndex ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetText


CListBox::GetTopIndex

Call this member function to retrieve the zero-based index of the first visible item in a list box. Initially, item zero is at the top of the list box, but if the list box is scrolled, another item may be at the top.

Syntax

int GetTopIndex( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetTopIndex


CListBox::InitStorage

Call this member function to allocate memory for storing list-box items.

Syntax

int InitStorage ( int nItems, UINT nBytes )

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE calculates the amount of memory to allocate. The nBytes parameter isn't used. Set the nBytes parameter to zero.

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::CListBox, CListBox::Create, CListBox::ResetContent


CListBox::InsertString

Call this member function to insert a string into the list box.

Syntax

int InsertString( int nIndex, LPCTSTR lpszItem );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::AddString


CListBox::ItemFromPoint

Call this member function to determine the list-box item nearest the point specified in pt. You could use this function to determine which list-box item the mouse cursor moves over.

Syntax

UINT ItemFromPoint( CPoint pt, BOOL& bOutside ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetItemRect


CListBox::MeasureItem

This member function is called by the framework when a list box with an owner-draw style is created.

Syntax

virtual void MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::CompareItem, CWnd::OnMeasureItem, CListBox::DrawItem, CListBox::DeleteItem


CListBox::ResetContent

Call this member function to remove all items from a list box.

Syntax

void ResetContent( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes


CListBox::SelectString

Call this member function to search for a list-box item that matches the specified string. If a matching item is found, this function selects the item.

Syntax

int SelectString( int nStartAfter, LPCTSTR lpszItem );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::FindString


CListBox::SelItemRange

Call this member function to select multiple consecutive items in a multiple-selection list box.

Syntax

int SelItemRange( BOOL bSelect, int nFirstItem, int nLastItem );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetSelItems


CListBox::SetAnchorIndex

Call this member function to set the anchor in a multiple-selection list box to begin an extended selection.

Syntax

void SetAnchorIndex( int nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetAnchorIndex


CListBox::SetCaretIndex

Call this member function to set the focus rectangle to the item at the specified index in a multiple-selection list box.

Syntax

int SetCaretIndex( int nIndex, BOOL bScroll = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetCaretIndex


CListBox::SetColumnWidth

Call this member function to set the width in pixels of all columns in a multicolumn list box.

Syntax

void SetColumnWidth( int cxWidth );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes


CListBox::SetCurSel

Call this member function to select a string and scroll it into view, if necessary. When the new string is selected, the list box removes the highlight from the previously selected string.

Syntax

int SetCurSel( int nSelect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetCurSel


CListBox::SetHorizontalExtent

Call this member function to set the width, in pixels, by which a list box can be scrolled horizontally.

Syntax

void SetHorizontalExtent( int cxExtent );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetHorizontalExtent, CListBox::SetColumnWidth


CListBox::SetItemData

Call this member function to set a 32-bit value associated with the specified item in a list box.

Syntax

int SetItemData( int nIndex, DWORD dwItemData );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetItemDataPtr, CListBox::GetItemData


CListBox::SetItemDataPtr

Call this member function to set the 32-bit value associated with the specified item in a list box to be the specified pointer (void*).

Syntax

int SetItemDataPtr( int nIndex, void* pData );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::SetItemData, CListBox::GetItemData, CListBox::GetItemDataPtr


CListBox::SetItemHeight

Call this member function to set the height of all items in the list box.

Syntax

int SetItemHeight ( int nIndex, UINT cyItemHeight );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Because Windows CE doesn't support owner-drawn list boxes, there's no reason to specify an item index in the nIndex parameter. Always set the index parameter to zero.

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetItemHeight


CListBox::SetLocale

Call this member function to set the locale identifier for this list box.

Syntax

LCID SetLocale( LCID nNewLocale );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetLocale


CListBox::SetSel

Call this member function to select a string in a multiple-selection list box.

Syntax

int SetSel( int nIndex, BOOL bSelect = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetSel


CListBox::SetTabStops

Call this member function to set the tab-stop positions in a list box.

Syntax

void SetTabStops( );

BOOL SetTabStops( const int& cxEachStop );

BOOL SetTabStops( int nTabStops, LPINT rgTabStops );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes


CListBox::SetTopIndex

Call this member function to ensure that a particular list-box item is visible. The system scrolls the list box until either the item specified by nIndex appears at the top of the list box or the maximum scroll range has been reached.

Syntax

int SetTopIndex( int nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::GetTopIndex


CListBox::VKeyToItem

This member function is called by the framework when the list box's parent window receives a WM_VKEYTOITEM message from the list box.

Syntax

virtual int VKeyToItem( UINT nKey, UINT nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListBox Overview, CListBox Member Functions, Control Classes, CListBox::CharToItem, CListBox::SetCurSel, CListBox::SetSel, CListBox::SetCaretIndex


CListCtrl

The CListCtrl class encapsulates the functionality of a Windows list view control, which is a control that displays a collection of items, each consisting of an icon and a label.

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE doesn't support the CreateDragImage member function of the CListCtrl class.

See Also

CListCtrl Member Functions, Control Classes, CImageList


CListCtrl Member Functions

Construction
ListCtrl | Constructs a CListCtrl object.
Create | Creates a list control and attaches it to a CListCtrl object.

Attributes
GetBkColor | Retrieves the background color of a list view control.
SetBkColor | Sets the background color of the list view control.
GetImageList | Retrieves the handle to an image list used for drawing list view items.
SetImageList | Assigns an image list to a list view control.
GetItemCount | Retrieves the number of items in a list view control.
GetItem | Retrieves a list view item's attributes.
GetItemData | Retrieves the application-specific value associated with an item.
SetItem | Sets some or all of a list view item's attributes.
SetItemData | Sets the item's application-specific value.
GetCallbackMask | Retrieves the callback mask for a list view control.
SetCallbackMask | Sets the callback mask for a list view control.
GetNextItem | Searches for a list view item with specified properties and with specified relationship to a given item.
GetItemRect | Retrieves the bounding rectangle for an item.
SetItemPosition | Moves an item to a specified position in a list view control.
GetItemPosition | Retrieves the position of a list view item.
GetStringWidth | Determines the minimum column width necessary to display all of a given string.
GetEditControl | Retrieves the handle to the edit control used to edit an item's text.
GetColumn | Retrieves the attributes of a control's column.
SetColumn | Sets the attributes of a list view column.
GetColumnWidth | Retrieves the width of a column in report view or list view.
SetColumnWidth | Changes the width of a column in report view or list view.
GetViewRect | Retrieves the bounding rectangle of all items in the list view control.
GetTextColor | Retrieves the text color of a list view control.
SetTextColor | Sets the text color of a list view control.
GetTextBkColor | Retrieves the text background color of a list view control.
SetTextBkColor | Sets the background color of text in a list view control.
GetTopIndex | Retrieves the index of the topmost visible item.
GetCountPerPage | Calculates the number of items that can fit vertically in a list view control.
GetOrigin | Retrieves the current view origin for a list view control.
SetItemState | Changes the state of an item in a list view control.
GetItemState | Retrieves the state of a list view item.
GetItemText | Retrieves the text of a list view item or subitem.
SetItemText | Changes the text of a list view item or subitem.
SetItemCount | Prepares a list view control for adding a large number of items.
GetSelectedCount | Retrieves the number of selected items in the list view control.

Operations
InsertItem | Inserts a new item in a list view control.
DeleteItem | Deletes an item from the control.
DeleteAllItems | Deletes all items from the control.
FindItem | Searches for a list view item having specified characteristics.
SortItems | Sorts list view items using an application-defined comparison function.
HitTest | Determines which list view item is at a specified position.
EnsureVisible | Ensures that an item is visible.
Scroll | Scrolls the content of a list view control.
RedrawItems | Forces a list view control to repaint a range of items.
Update | Forces the control to repaint a specified item.
Arrange | Aligns items on a grid.
EditLabel | Begins in-place editing of an item's text.
InsertColumn | Inserts a new column in a list view control.
DeleteColumn | Deletes a column from the list view control.

Overridables
DrawItem Called when a visual aspect of an owner-draw control changes.

See Also

CListCtrl Overview, Control Classes


CListCtrl::Arrange

Call this member function to reposition items in an icon view so that they align on a grid. The nCode parameter specifies the alignment style and an optional sort order. If no sort flag is included with nCode, this function does not change the items' indexes.

Syntax

BOOL Arrange( UINT nCode );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::EnsureVisible


CListCtrl::CListCtrl

Call this member function to construct a CListCtrl object.

Syntax

CListCtrl( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::Create


CListCtrl::Create

Call this member function to create the list view control and attaches it to the CListCtrl object.

You construct a CListCtrl in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE supports a new list view style, called LVS_OWNERDATA, that specifies a virtual list view control. For information about how to use this style, see New Features for List Views and Virtual List View Overview. Windows CE version prior to 2.0 don't support the LVS_OWNERDATA style. For information on supported list control styles, see List View Styles.

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::CListCtrl


CListCtrl::DeleteAllItems

Call this member function to delete all items from the list view control.

Syntax

BOOL DeleteAllItems( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::InsertItem, CListCtrl::DeleteItem


CListCtrl::DeleteColumn

Call this member function to delete a column from the list view control.

Syntax

BOOL DeleteColumn( int nCol );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::InsertColumn, CListCtrl::DeleteAllItems


CListCtrl::DeleteItem

Call this member function to delete an item from a list view control.

Syntax

BOOL DeleteItem( int nItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::InsertItem, CListCtrl::DeleteAllItems


CListCtrl::DrawItem

This member function is called by the framework when a visual aspect of an owner-draw list view control changes. The itemAction member of the DRAWITEMSTRUCT structure defines the drawing action that is to be performed.

Syntax

virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CWnd::OnDrawItem


CListCtrl::EditLabel

Call this member function to begin in-place editing of the specified list view item's text. A list view control that has the LVS_EDITLABELS window style enables a user to edit item labels in place. The user begins editing by clicking the label of an item that has the focus.

Syntax

CEdit* EditLabel( int nItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetEditControl


CListCtrl::EnsureVisible

Call this member function to ensure that a list view item is at least partially visible. The list view control is scrolled if necessary. If the bPartialOK parameter is nonzero, no scrolling occurs if the item is partially visible.

Syntax

BOOL EnsureVisible( int nItem, BOOL bPartialOK );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::Scroll


CListCtrl::FindItem

Call this member function to search for a list view item having specified characteristics.

Syntax

int FindItem( LV_FINDINFO* pFindInfo, int nStart = –1 ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SortItems


CListCtrl::GetBkColor

Call this member function to retrieve the background color of a list view control.

Syntax

COLORREF GetBkColor( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetBkColor


CListCtrl::GetCallbackMask

Call this member function to retrieve the callback mask for a list view control.

Syntax

UINT GetCallbackMask( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetCallbackMask


CListCtrl::GetColumn

Call this member function to retrieve the attributes of a list view control's column.

Syntax

BOOL GetColumn( int nCol, LV_COLUMN* pColumn ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetColumn, CListCtrl::GetColumnWidth


CListCtrl::GetColumnWidth

Call this member function to retrieve the width of a column in report view or list view.

Syntax

int GetColumnWidth( int nCol ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetColumnWidth, CListCtrl::GetColumn


CListCtrl::GetCountPerPage

Call this member function to calculate the number of items that can fit vertically in the visible area of a list view control when in list view or report view.

Syntax

int GetCountPerPage( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetTopIndex


CListCtrl::GetEditControl

Call this member function to retrieve the handle to the edit control used to edit a list view item's text.

Syntax

CEdit* GetEditControl( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::EditLabel


CListCtrl::GetImageList

Call this member function to retrieve the handle to an image list used for drawing list view items.

Syntax

CImageList* GetImageList( int nImageList ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CImageList, CListCtrl::SetImageList


CListCtrl::GetItem

Call this member function to retrieve some or all of a list view item's attributes.

Syntax

BOOL GetItem( LV_ITEM* pItem ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetItem


CListCtrl::GetItemCount

Call this member function to retrieve the number of items in a list view control.

Syntax

int GetItemCount( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetItemCount, CListCtrl::GetSelectedCount


CListCtrl::GetItemData

Call this member function to retrieve the 32-bit application-specific value associated with the item specified by nItem. This value is the lParam member of the LV_ITEM structure; for more information on this structure, see GetItem.

Syntax

DWORD GetItemData( int nItem ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItem, CListCtrl::SetItemData


CListCtrl::GetItemPosition

Call this member function to retrieve the position of a list view item.

Syntax

BOOL GetItemPosition( int nItem, LPPOINT lpPoint ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetItemPosition, CListCtrl::GetOrigin


CListCtrl::GetItemRect

Call this member function to retrieve the bounding rectangle for all or part of an item in the current view.

Syntax

BOOL GetItemRect( int nItem, LPRECT lpRect, UINT nCode ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItemPosition, CListCtrl::SetItemPosition, CListCtrl::GetOrigin


CListCtrl::GetItemState

Call this member function to retrieve the state of a list view item.

Syntax

UINT GetItemState( int nItem, UINT nMask ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetItemState, CListCtrl::GetItem


CListCtrl::GetItemText

Call this member function to retrieve the text of a list view item or subitem. If nSubItem is zero, this function retrieves the item label; if nSubItem is nonzero, it retrieves the text of the subitem. For more information on the subitem argument, see the discussion of the LV_ITEM structure in CListCtrl::GetItem.

Syntax

int GetItemText( int nItem, int nSubItem, LPTSTR lpszText, int nLen ) const;

CString GetItemText( int nItem, int nSubItem ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItem


CListCtrl::GetNextItem

Call this member function to searche for a list view item that has the specified properties and that bears the specified relationship to a given item.

Syntax

int GetNextItem( int nItem, int nFlags ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItem


CListCtrl::GetOrigin

Call this member function to retrieve the current view origin for a list view control.

Syntax

BOOL GetOrigin( LPPOINT lpPoint ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItemPosition, CListCtrl::SetItemPosition


CListCtrl::GetSelectedCount

Call this member function to retrieve the number of selected items in the list view control.

Syntax

UINT GetSelectedCount( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetItemCount, CListCtrl::GetItemCount


CListCtrl::GetStringWidth

Call this member function to determine the minimum column width necessary to display all of a given string.

Syntax

int GetStringWidth( LPCTSTR lpsz ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetColumnWidth, CListCtrl::SetColumnWidth


CListCtrl::GetTextBkColor

Call this member function to retrieve the text background color of a list view control.

Syntax

COLORREF GetTextBkColor( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetTextBkColor, CListCtrl::GetTextColor


CListCtrl::GetTextColor

Call this member function to retrieve the text color of a list view control.

Syntax

COLORREF GetTextColor( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetTextColor, CListCtrl::GetTextBkColor


CListCtrl::GetTopIndex

Call this member function to retrieve the index of the topmost visible item when in list view or report view.

Syntax

int GetTopIndex( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetCountPerPage


CListCtrl::GetViewRect

Call this member function to retrieve the bounding rectangle of all items in the list view control. The list view must be in icon view or small icon view.

Syntax

BOOL GetViewRect( LPRECT lpRect ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetTopIndex


CListCtrl::HitTest

Call this member function to determine which list view item, if any, is at a specified position.

Syntax

int HitTest( LV_HITTESTINFO* pHitTestInfo ) const;

int HitTest( CPoint pt, UINT* pFlags = NULL ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetItemPosition, CListCtrl::GetItemPosition


CListCtrl::InsertColumn

Call this member function to insert a new column in a list view control.

Syntax

int InsertColumn( int nCol, const LV_COLUMN* pColumn );

int InsertColumn( int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, int nWidth = –1, int nSubItem = –1 );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::DeleteColumn


CListCtrl::InsertItem

Call this member function to insert an item into the list view control.

Syntax

int InsertItem( const LV_ITEM* pItem );

int InsertItem( int nItem, LPCTSTR lpszItem );

int InsertItem( int nItem, LPCTSTR lpszItem, int nImage );

int InsertItem( UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::DeleteItem, CListCtrl::DeleteAllItems


CListCtrl::RedrawItems

Call this member function to force a list view control to repaint a range of items.

The specified items are not actually repainted until the list view window receives a WM_PAINT message. To repaint immediately, call the Windows UpdateWindow function after using this function.

Syntax

BOOL RedrawItems( int nFirst, int nLast );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::DrawItem


CListCtrl::Scroll

Call this member function to scroll the content of a list view control.

Syntax

BOOL Scroll( CSize size );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::EnsureVisible


CListCtrl::SetBkColor

Call this member function to set the background color of the list view control.

Syntax

BOOL SetBkColor( COLORREF cr );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetBkColor


CListCtrl::SetCallbackMask

Call this member function to set the callback mask for a list view control.

Syntax

BOOL SetCallbackMask( UINT nMask );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetCallbackMask


CListCtrl::SetColumn

Call this member function to set the attributes of a list view column.

Syntax

BOOL SetColumn( int nCol, const LV_COLUMN* pColumn );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetColumn


CListCtrl::SetColumnWidth

Call this member function to change the width of a column in report view or list view.

Syntax

BOOL SetColumnWidth( int nCol, int cx );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetColumnWidth, CListCtrl::GetStringWidth


CListCtrl::SetImageList

Call this member function to assign an image list to a list view control.

Syntax

CImageList* SetImageList( CImageList* pImageList, int nImageList );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CImageList, CListCtrl::GetImageList


CListCtrl::SetItem

Call this member function to set some or all of a list view item's attributes.

Syntax

BOOL SetItem( const LV_ITEM* pItem );

BOOL SetItem( int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem, int nImage, UINT nState, UINT nStateMask, LPARAM lParam );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItem


CListCtrl::SetItemCount

Call this member function to prepare a list view control for adding a large number of items.

By calling this function before adding a large number of items, you enable a list view control to reallocate its internal data structures only once rather than every time you add an item.

Syntax

void SetItemCount( int nItems );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItemCount, CListCtrl::GetSelectedCount


CListCtrl::SetItemData

Call this member function to set the 32-bit application-specific value associated with the item specified by nItem. This value is the lParam member of the LV_ITEM structure; for more information on this structure, see GetItem.

Syntax

BOOL SetItemData( int nItem, DWORD dwData );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, GetItem, CListCtrl::GetItemData


CListCtrl::SetItemPosition

Call this member function to move an item to a specified position in a list view control. The control must be in icon or small icon view.

Syntax

BOOL SetItemPosition( int nItem, POINT pt );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItemPosition, CListCtrl::GetOrigin


CListCtrl::SetItemState

Call this member function to change the state of an item in a list view control.

Syntax

BOOL SetItemState( int nItem, LV_ITEM* pItem );

BOOL SetItemState( int nItem, UINT nState, UINT nMask );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItemState


CListCtrl::SetItemText

Call this member function to change the text of a list view item or subitem.

Syntax

BOOL SetItemText( int nItem, int nSubItem, LPTSTR lpszText );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetItemText


CListCtrl::SetTextBkColor

Call this member function to set the background color of text in a list view control.

Syntax

BOOL SetTextBkColor( COLORREF cr );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::GetTextBkColor


CListCtrl::SetTextColor

Call this member function to set the text color of a list view control.

Syntax

BOOL SetTextColor( COLORREF cr );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::SetTextBkColor


CListCtrl::SortItems

Call this member function to sort list view items using an application-defined comparison function. The index of each item changes to reflect the new sequence.

Syntax

BOOL SortItems( PFNLVCOMPARE pfnCompare, DWORD dwData );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::FindItem


CListCtrl::Update

Call this member function to force the list view control to repaint the item specified by nItem. This function also arranges the list view control if it has the LVS_AUTOARRANGE style.

Syntax

BOOL Update( int nItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CListCtrl Overview, CListCtrl Member Functions, Control Classes, CListCtrl::DrawItem


CListView

The CListView class simplifies use of the list control and of CListCtrl, the class that encapsulates list-control functionality, with MFC's document-view architecture.

At a Glance

Header file: Afxcview.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CListView Member Functions, View Classes, CView, CCtrlView, CListCtrl


CListView Member Functions

Construction
CListView Constructs a CListView object.

Attributes
GetListCtrl Returns the list control associated with the view.

See Also

CListView Overview, View Classes


CListView::CListView

Call this member function to construct a CListView object.

Syntax

CListView( );

At a Glance

Header file: Afxcview.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CListView Overview, CListView Member Functions, View Classes


CListView::GetListCtrl

Call this member function to get a reference to the list control associated with the view.

Syntax

CListCtrl& GetListCtrl( ) const;

At a Glance

Header file: Afxcview.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CListView Overview, CListView Member Functions, View Classes, CListCtrl


CLongBinary

The CLongBinary class simplifies working with very large binary data objects (often called "binary large objects", or BLOBs) in a database. For example, a record field in an SQL table might contain a bitmap representing a picture. A CLongBinary object stores such an object and keeps track of its size.

At a Glance

Header file: Afxdb_.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CLongBinary Member Functions, CLongBinary Data Members, Support Classes


CLongBinary Member Functions

Construction
CLongBinary Constructs a CLongBinary object.

See Also

CLongBinary Overview, CLongBinary Data Members, Support Classes


CLongBinary::CLongBinary

Use this constructor to construct a binary large object (BLOB) object.

Syntax

CLongBinary( );

At a Glance

Header file: Afxdb_.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CLongBinary Overview, CLongBinary Member Functions, Support Classes


CLongBinary Data Members

Data Members
m_dwDataLength | Contains the actual size in bytes of the data object whose handle is stored in m_hData.
m_hData | Contains a Windows HGLOBAL handle to the data in the CLongBinary object.

See Also

CLongBinary Overview, CLongBinary Member Functions, Support Classes


CLongBinary::m_dwDataLength

This data member contains the size in bytes of the object whose HGLOBAL handle is stored in m_hData. This size may be smaller than the size of the memory block allocated for the data.

DWORD m_dwDataLength;

At a Glance

Header file: Afxdb_.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CLongBinary Overview, CLongBinary Data Members, Support Classes


CLongBinary::m_hData

This data member contains a Windows HGLOBAL handle to the actual binary large object data.

HGLOBAL m_hData;

At a Glance

Header file: Afxdb.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CLongBinary Overview, CLongBinary Data Members, Support Classes


CMap

CMap is a dictionary collection class that maps unique keys to values. Once you have inserted a key-value pair (element) into the map, you can efficiently retrieve or delete the pair using the key to access it. You can also iterate over all the elements in the map.

Syntax

template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE >class CMap : public CObject

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Member Functions, CMap Operators, Map Classes


CMap Member Functions

Construction
CMap Constructs a collection that maps keys to values.

Operations
Lookup | Looks up the value mapped to a given key.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.
GetHashTableSize | Returns the size (number of elements) of the hash table.
InitHashTable | Initializes the hash table and specifies its size.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

See Also

CMap Overview, CMap Operators, Map Classes


CMap::CMap

Use this constructor to construct an empty map. As the map grows, memory is allocated in units of nBlockSize entries.

Syntax

CMap( int nBlockSize = 10 );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes


CMap::GetCount

Call this member function to retrieve the number of elements in the map.

Syntax

int GetCount( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::IsEmpty


CMap::GetHashTableSize

Call this member function to determine the number of elements in the hash table for the map.

Syntax

UINT GetHashTableSize( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::InitHashTable


CMap::GetNextAssoc

Call this member function to retrieve the map element at rNextPosition, and update rNextPosition to refer to the next element in the map.

Syntax

void GetNextAssoc( POSITION& rNextPosition, KEY& rKey, VALUE& rValue ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::GetStartPosition


CMap::GetStartPosition

Call this member function to retrieve a POSITION value that you can pass to GetNextAssoc initiate a map iteration. The iteration sequence is not predictable; therefore, the "first element in the map" has no special significance.

Syntax

POSITION GetStartPosition( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::GetNextAssoc


CMap::InitHashTable

Call this member function to initialize the hash table. For best performance, the hash table size should be a prime number. To minimize collisions the size should be roughly 20 percent larger than the largest anticipated data set.

Syntax

void InitHashTable( UINT hashSize );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::GetHashTableSize


CMap::IsEmpty

Call this member function to determine whether the map is empty.

Syntax

BOOL IsEmpty( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::GetCount


CMap::Lookup

Call this member function to quickly find a map element with a key that exactly matches the given key. This function uses a hashing algorithm.

Syntax

BOOL Lookup( ARG_KEY key, VALUE& rValue ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::operator []


CMap::RemoveAll

Call this member function to remove all the values from this map by calling the global helper function DestructElements.

The function works correctly if the map is already empty.

Syntax

void RemoveAll( );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::RemoveKey


CMap::RemoveKey

Call this member function to remove the map entry corresponding to the supplied key.

The DestructElements helper function is used to remove the entry.

Syntax

BOOL RemoveKey( ARG_KEY key );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::RemoveAll


CMap::SetAt

Call this member function to insert an element in a map.

Syntax

void SetAt( ARG_KEY key, ARG_VALUE newValue );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Member Functions, Map Classes, CMap::Lookup, CMap::operator []


CMap Operators

Operators
operator [] Inserts an element into the map — operator substitution for SetAt.

See Also

CMap Overview, CMap Member Functions, Map Classes


CMap::operator [ ]

Use this operator as a convenient substitute for the SetAt member function. You can only use it on the left side of an assignment statement (an l-value). If there is no map element with the specified key, then a new element is created.

There is no "right side" (r-value) equivalent to this operator because there is a possibility that a key may not be found in the map. Use the Lookup member function for element retrieval.

VALUE& operator[]( ARG_KEY key );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMap Overview, CMap Operators, Map Classes, CMap::SetAt, CMap::Lookup


CMapPtrToPtr

The CMapPtrToPtr class supports maps of void pointers keyed by void pointers.

The member functions of CMapPtrToPtr are similar to the member functions of class CMapStringToOb. Because of this similarity, you can use the CMapStringToOb reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Map Classes, CMapStringToOb


CMapPtrToPtr Class Members

Construction
CMapPtrToPtr Constructs a collection that maps void pointers to void pointers.

Operations
Lookup | Looks up a void pointer based on the void pointer key. The pointer value, not the entity it points to, is used for the key comparison.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

Operators
operator [ ] Inserts an element into the map — operator substitution for SetAt.

See Also

CMapPtrToPtr Overview, Map Classes


CMapPtrToWord

The CMapPtrToWord class supports maps of 16-bit words keyed by void pointers.

The member functions of CMapPtrToWord are similar to the member functions of class CMapStringToOb. Because of this similarity, you can use the CMapStringToOb reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Map Classes, CMapStringToOb


CMapPtrToWord Class Members

Construction
CMapPtrToWord Constructs a collection that maps void pointers to 16-bit words.

Operations
Lookup | Returns a WORD using a void pointer as a key. The pointer value, not the entity it points to, is used for the key comparison.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

Operators
operator [] Inserts an element into the map — operator substitution for SetAt.

See Also

CMapPtrToWord Overview, Map Classes


CMapStringToOb

CMapStringToOb is a dictionary collection class that maps unique CString objects to CObject pointers.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Member Functions, CMapStringToOb Operators, Map Classes, CMapPtrToPtr, CMapPtrToWord, CMapStringToPtr, CMapStringToString, CMapWordToOb, CMapWordToPtr


CMapStringToOb Member Functions

Construction
CMapStringToOb Constructs a collection that maps CString values to CObject pointers.

Operations
Lookup | Returns a CObject pointer based on a CString value.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

See Also

CMapStringToOb Overview, CMapStringToOb Operators, Map Classes


CMapStringToOb::CMapStringToOb

Call this member function to construct an empty CString-to-CObject* map. As the map grows, memory is allocated in units of nBlockSize entries.

Syntax

CMapStringToOb( int nBlockSize = 10 );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes


CMapStringToOb::GetCount

Call this member function to determine how many elements are in the map.

Syntax

int GetCount( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes, CMapStringToOb::IsEmpty


CMapStringToOb::GetNextAssoc

Call this member function to retrieve the map element at rNextPosition, then updates rNextPosition to refer to the next element in the map.

Syntax

void GetNextAssoc( POSITION& rNextPosition, CString& rKey, CObject*& rValue ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes, CMapStringToOb::GetStartPosition


CMapStringToOb::GetStartPosition

Call this member function to retrieve a POSITION value that you can pass to GetNextAssoc to initiate a map iteration. The iteration sequence is not predictable; therefore, the "first element in the map" has no special significance.

Syntax

POSITION GetStartPosition( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes


CMapStringToOb::IsEmpty

Call this member function to determine whether the map is empty.

Syntax

BOOL IsEmpty( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes


CMapStringToOb::Lookup

Call this member function to find the map element with a key that matches exactly (CString value).

Syntax

BOOL Lookup( LPCTSTR key, CObject*& rValue ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes, CMapStringToOb::operator []


CMapStringToOb::RemoveAll

Call this member function to remove all the elements from this map and destroys the CString key objects.

Syntax

void RemoveAll( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes, CMapStringToOb::RemoveKey


CMapStringToOb::RemoveKey

Call this member function to remove the map entry corresponding to the supplied key. This can cause memory leaks if the CObject object is not deleted elsewhere.

Syntax

BOOL RemoveKey( LPCTSTR key );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes, CMapStringToOb::RemoveAll


CMapStringToOb::SetAt

Call this member function to insert an element in a map.

Syntax

void SetAt( LPCTSTR key, CObject* newValue );
throw( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes, CMapStringToOb::Lookup, CMapStringToOb::operator []


CMapStringToOb Operators

Operators
operator [] Inserts an element into the map — operator substitution for SetAt.

See Also

CMapStringToOb Overview, CMapStringToOb Member Functions, Map Classes


CMapStringToOb::operator [ ]

Use this operator as a convenient substitute for the SetAt member function.

Syntax

CObject*& operator [ ]( LPCTSTR key );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMapStringToOb Overview, CMapStringToOb Operators, Map Classes, CMapStringToOb::SetAt, CMapStringToOb::Lookup


CMapStringToPtr

The CMapStringToPtr class supports maps of void pointers keyed by CString objects.

The member functions of CMapStringToPtr are similar to the member functions of class CMapStringToOb. Because of this similarity, you can use the CMapStringToOb reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Map Classes, CMapStringToOb


CMapStringToPtr Class Members

Construction
CMapStringToPtr Constructs a collection that maps CString objects to void pointers.

Operations
Lookup | Returns a void pointer based on a CString value.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

Operators
operator [] Inserts an element into the map — operator substitution for SetAt.

See Also

CMapStringToPtr Overview, Map Classes


CMapStringToString

The CMapStringToString class supports maps of CString objects keyed by CString objects.

The member functions of CMapStringToString are similar to the member functions of class CMapStringToOb. Because of this similarity, you can use the CMapStringToOb reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Map Classes, CMapStringToOb


CMapStringToString Class Members

Construction
CMapStringToString Constructs a collection that maps CString objects to CString objects.

Operations
Lookup | Returns a CString using a CString value as a key.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

Operators
operator [] Inserts an element into the map — operator substitution for SetAt.

See Also

CMapStringToString Overview, Map Classes


CMapWordToOb

The CMapWordToOb class supports maps of CObject pointers keyed by 16-bit words.

The member functions of CMapWordToOb are similar to the member functions of class CMapStringToOb. Because of this similarity, you can use the CMapStringToOb reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Map Classes, CMapStringToOb


CMapWordToOb Class Members

Construction
CMapWordToOb Constructs a collection that maps words to CObject pointers.

Operations
Lookup | Returns a CObject pointer using a word value as a key.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

Operators
operator [] Inserts an element into the map — operator substitution for SetAt.

See Also

CMapWordToOb Overview, Map Classes


CMapWordToPtr

The CMapWordToPtr class supports maps of void pointers keyed by 16-bit words.

The member functions of CMapWordToPtr are similar to the member functions of class CMapStringToOb. Because of this similarity, you can use the CMapStringToOb reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Map Classes, CMapStringToOb


CMapWordToPtr Class Members

Construction
CMapWordToPtr Constructs a collection that maps words to void pointers.

Operations
Lookup | Returns a void pointer using a word value as a key.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.
RemoveKey | Removes an element specified by a key.
RemoveAll | Removes all the elements from this map.
GetStartPosition | Returns the position of the first element.
GetNextAssoc | Gets the next element for iterating.

Status
GetCount | Returns the number of elements in this map.
IsEmpty | Tests for the empty-map condition (no elements).

Operators
operator [] Inserts an element into the map — operator substitution for SetAt.

See Also

CMapWordToPtr Overview, Map Classes


CMemFile

CMemFile is the CFile-derived class that supports memory files. These memory files behave like disk files, except that the file is stored in RAM rather than on disk. A memory file is useful for fast temporary storage, or for transferring raw bytes or serialized objects between independent processes.

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Member Functions, File Service Classes


CMemFile Member Functions

Construction
CMemFile Constructs a memory file object.

Operations
Attach | Attaches a block of memory to CMemFile.
Detach | Detaches the block of memory from CMemFile and returns a pointer to the block of memory detached.

Advanced Overridables
Alloc | Override to modify memory allocation behavior.
Free | Override to modify memory deallocation behavior.
Realloc | Override to modify memory reallocation behavior.
Memcpy | Override to modify memory copy behavior when reading and writing files.
GrowFile | Override to modify behavior when growing a file.

See Also

CMemFile Overview, File Service Classes


CMemFile::Alloc

This member function is called by CMemFile member functions. Override this function to implement custom memory allocation. If you override this function, you will probably also want to override Free and Realloc.

Syntax

BYTE * Alloc( DWORD nBytes );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CMemFile::Free, CMemFile::Realloc


CMemFile::Attach

Call this member function to attach a block of memory to a CMemFile object. This causes the CMemFile object to use the block of memory as the memory file.

Syntax

void Attach( BYTE* lpBuffer, UINT nBufferSize, UINT nGrowBytes = 0 );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CMemFile::Detach


CMemFile::CMemFile

Use this member function to construct a memory file object. The first version opens an empty memory file. The second overloaded version opens the memory file and attaches a block of memory to it.

Syntax

CMemFile( UINT nGrowBytes = 1024 );

CMemFile( BYTE* lpBuffer, UINT nBufferSize, UINT nGrowBytes = 0 );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CMemFile::Attach


CMemFile::Detach

Call this member function to close the memory file and retrieve a pointer to the memory block being used by the CMemFile object.

Syntax

BYTE * Detach( );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CFile::GetLength, CMemFile::Attach


CMemFile::Free

This member function is called by CMemFile member functions. Override this function to implement custom memory deallocation. If you override this function, you will probably also want to override Alloc and Realloc.

Syntax

void Free( BYTE * lpMem );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CMemFile::Alloc, CMemFile::Realloc


CMemFile::GrowFile

This member function is called by several of the CMemFile member functions. Override this function if you want to change the way CMemFile grows its memory file.

Syntax

void GrowFile( DWORD dwNewLen );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CMemFile::Alloc, CMemFile::Attach, CMemFile::CMemFile, CMemFile::Realloc


CMemFile::Memcpy

This member function is called by the CMemFile overrides of CFile::Read and CFile::Write to transfer data to and from the memory file. Override this function if you want to change the way that CMemFile handles copying memory files.

Syntax

BYTE * Memcpy( BYTE* lpMemTarget, BYTE* lpMemSource, UINT nBytes );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CFile::Read, CFile::Write


CMemFile::Realloc

This member function is called by several CMemFile member functions. Override this function to implement custom memory reallocation. If you override this function, you will probably also want to override Alloc and Free.

Syntax

BYTE * Realloc( BYTE* lpMem, DWORD nBytes );

At a Glance

Header file: Afx.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CMemFile Overview, CMemFile Member Functions, File Service Classes, CMemFile::Alloc, CMemFile::Free


CMemoryException

A CMemoryException object represents an out-of-memory exception condition.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMemoryException Member Functions, Exception Classes


CMemoryException Member Functions

Construction
CMemoryException Constructs a CMemoryException object.

See Also

CMemoryException Overview, Exception Classes


CMemoryException::CMemoryException

This member function constructs a CMemoryException object. Do not use this constructor directly; call the global function AfxThrowMemoryException. This global function can succeed in an out-of-memory situation because it constructs the exception object in previously allocated memory.

Syntax

CMemoryException( );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CMemoryException Overview, CMemoryException Member Functions, Exception Classes


CMenu

The CMenu class encapsulates the functionality associated with a Windows menu.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

To add a menu to the command bar in Windows CE applications, use the new CFrameWnd::InsertMenu member function.

MFC for Windows CE supports the following member functions of the CMenu class differently than the standard MFC library does.

CMenu::AppendMenu

CMenu::EnableMenuItem

CMenu::GetMenuString

CMenu::InsertMenu

CMenu::TrackPopupMenu

Windows CE does not support the following CMenu member functions.

GetMenuContextHelpId

LoadMenuIndirect

SetMenuContextHelpId

SetMenuItemBitmaps

Note Always place command bar menus in the leftmost portion of the command bar. If you provide File, Edit, View, Insert, Format, Tools, and/or Window menus, they must appear in this order, from left to right.

See Also

CMenu Member Functions, CMenu Data Members, Menu Classes, CObject


CMenu Member Functions

Construction
CMenu Constructs a CMenu object.

Initialization
Attach | Attaches a Windows menu handle to a CMenu object.
Detach | Detaches a Windows menu handle from a CMenu object and returns the handle.
FromHandle | Returns a pointer to a CMenu object given a Windows menu handle.
GetSafeHmenu | Returns the m_hMenu wrapped by this CMenu object.
DeleteTempMap | Deletes any temporary CMenu objects created by the FromHandle member function.
CreateMenu | Creates an empty menu and attaches it to a CMenu object.
CreatePopupMenu | Creates an empty pop-up menu and attaches it to a CMenu object.
LoadMenu | Loads a menu resource from the executable file and attaches it to a CMenu object.
DestroyMenu | Destroys the menu attached to a CMenu object and frees any memory that the menu occupied.

Menu Operations
DeleteMenu | Deletes a specified item from the menu. If the menu item has an associated pop-up menu, destroys the handle to the pop-up menu and frees the memory used by it.
TrackPopupMenu | Displays a floating pop-up menu at the specified location and tracks the selection of items on the pop-up menu.

Menu Item Operations
AppendMenu | Appends a new item to the end of this menu.
CheckMenuItem | Places a check mark next to or removes a check mark from a menu item in the pop-up menu.
CheckMenuRadioItem | Places a radio button next to a menu item and removes the radio button from all of the other menu items in the group.
EnableMenuItem | Enables, disables, or dims (grays) a menu item.
GetMenuItemCount | Determines the number of items in a pop-up or top-level menu.
GetMenuItemID | Obtains the menu-item identifier for a menu item located at the specified position.
GetMenuState | Returns the status of the specified menu item or the number of items in a pop-up menu.
GetMenuString | Retrieves the label of the specified menu item.
GetSubMenu | Retrieves a pointer to a pop-up menu.
InsertMenu | Inserts a new menu item at the specified position, moving other items down the menu.
ModifyMenu | Changes an existing menu item at the specified position.
RemoveMenu | Deletes a menu item with an associated pop-up menu from the specified menu.

Overridables
DrawItem | Called by the framework when a visual aspect of an owner-drawn menu changes.
MeasureItem | Called by the framework to determine menu dimensions when an owner-drawn menu is created.

See Also

CMenu Overview, CMenu Data Members, Menu Classes


CMenu::AppendMenu

Call this member function to append a new item to the end of a menu.

Syntax

BOOL AppendMenu ( UINT nFlags, UINT nIDNewItem = 0, LPCTSTR lpszNewItem = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The following flags are not supported for the ulFlags parameter:

MF_BITMAP

MF_DISABLED

MFS_GRAYED

MF_GRAYED can be used in place of MF_DISABLED and MFS_GRAYED.

Windows CE 1.0 doesn't support cascading menus. If you're using version 1.0, you can't insert an MF_POPUP menu into another pop-up menu.

In version 1.0, the following flags are not supported either.

MF_POPUP

MF_MENUBREAK

MF_MENUBARBREAK

In Windows CE versions 2.0 and later, these flags are supported. Cascading menus are also supported.

See Also

CMenu Overview, CMenu Member Functions, Menu Classes CMenu::InsertMenu, CMenu::RemoveMenu, CMenu::Detach


CMenu::Attach

Call this member function to attach an existing Windows menu to a CMenu object. This function should not be called if a menu is already attached to the CMenu object.

Syntax

BOOL Attach( HMENU hMenu );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::Detach, CMenu::CMenu, CWnd::GetMenu


CMenu::CheckMenuItem

Call this member function to add check marks to or removes check marks from menu items in a pop-up menu.

Syntax

UINT CheckMenuItem( UINT nIDCheckItem, UINT nCheck );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::GetMenuState, CMenu::CheckMenuRadioItem


CMenu::CheckMenuRadioItem

Call this member function to check a specified menu item and make it a radio item. At the same time, the function unchecks all other menu items in the associated group and clears the radio-item type flag for those items.

Syntax

BOOL CheckMenuRadioItem( UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Class, Hierarchy, Chart_vcce_Hierarchy_Chart, CMenu::CheckMenuItem_vcce_CMenu_CheckMenuItem, CMenu::GetMenuState_vcce_CMenu_GetMenuState


CMenu::CMenu

Use this constructor to construct a CMenu object. The menu is not actually created until you call one of the create or load member functions of CMenu:

  • CreateMenu
  • CreatePopupMenu
  • LoadMenu
  • Attach

Syntax

CMenu( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::CreateMenu, CMenu::CreatePopupMenu, CMenu::LoadMenu, CMenu::Attach


CMenu::CreateMenu

Call this member function to create a menu and attach it to the CMenu object.

Syntax

BOOL CreateMenu( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::CMenu, CMenu::DestroyMenu, CMenu::InsertMenu, CMenu::AppendMenu


CMenu::CreatePopupMenu

Call this member function to create a pop-up menu and attach it to the CMenu object.

Syntax

BOOL CreatePopupMenu( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::CreateMenu, CMenu::InsertMenu, CMenu::TrackPopupMenu, CMenu::AppendMenu


CMenu::DeleteMenu

Call this member function to delete an item from the menu. If the menu item has an associated pop-up menu, DeleteMenu destroys the handle to the pop-up menu and frees the memory used by the pop-up menu.

Syntax

BOOL DeleteMenu( UINT nPosition, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes


CMenu::DeleteTempMap

This member function is called automatically by the CWinApp idle-time handler, DeleteTempMap deletes any temporary CMenu objects created by the FromHandle member function.

Syntax

static void PASCAL DeleteTempMap( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::FromHandle


CMenu::DestroyMenu

Call this member function to destroy the menu and any Windows resources that it uses.

Syntax

BOOL DestroyMenu( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes


CMenu::Detach

Call this member function to detach a Windows menu from a CMenu object and retrieve its menu handle.

Syntax

HMENU Detach( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::Attach


CMenu::DrawItem

This member function is called by the framework when a visual aspect of an owner-drawn menu changes.

Syntax

virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes


CMenu::EnableMenuItem

Call this member function to enable, or disable and dim, a menu item.

Syntax

UINT EnableMenuItem ( UINT nIDEnableItem, UINT nEnable );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In MFC for Windows CE, you can't use the MF_DISABLED flag in the nEnable parameter. Use the MF_GRAYED flag instead.

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::GetMenuState


CMenu::FromHandle

Call this member function to obtain a pointer to a CMenu object when you have a Windows handle to a menu.

Syntax

static CMenu* PASCAL FromHandle( HMENU hMenu );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes


CMenu::GetMenuItemCount

Call this member function to determine the number of items in a pop-up or top-level menu.

Syntax

UINT GetMenuItemCount( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CWnd::GetMenu, CMenu::GetMenuItemID, CMenu::GetSubMenu


CMenu::GetMenuItemID

Call this member function to obtain the menu-item identifier for a menu item located at the position defined by nPos.

Syntax

UINT GetMenuItemID( int nPos ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CWnd::GetMenu, CMenu::GetMenuItemCount, CMenu::GetSubMenu


CMenu::GetMenuState

Call this member function to retrieve the status of the specified menu item or the number of items in a pop-up menu.

Syntax

UINT GetMenuState( UINT nID, UINT nFlags ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::CheckMenuItem, CMenu::EnableMenuItem


CMenu::GetMenuString

Call this member function to copy the label of the specified menu item to the specified buffer.

Syntax

int GetMenuString( UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags ) const;

int GetMenuString( UINT nIDItem, CString& rString, UINT nFlags ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In MFC for Windows CE, the return value indicates the actual number of characters (not bytes) copied to the buffer, not including the null terminator.

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::GetMenuState, CMenu::ModifyMenu


CMenu::GetSubMenu

Call this member function to obtain a pointer to the CMenu object of a pop-up menu.

Syntax

CMenu* GetSubMenu( int nPos ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CWnd::GetMenu, CMenu::GetMenuItemID


CMenu::GetSafeHmenu

Call this member function to obtain the HMENU wrapped by this CMenu object.

Syntax

HMENU GetSafeHmenu( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes


CMenu::InsertMenu

Call this member function to insert a new menu item at the position specified by nPosition, and move other items down the menu.

Syntax

BOOL InsertMenu( UINT nPosition, UINT nFlags, UINT nIDNewItem = 0, LPCTSTR lpszNewItem = NULL );

BOOL InsertMenu( UINT nPosition, UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE doesn't support the MF_BITMAP flag or the MF_DISABLED flag in the nFlags parameter. Menu items can't be disabled without being grayed. To disable a menu item use the MF_GRAYED flag.

Windows CE 1.0 doesn't support cascading menus. If you're using version 1.0, you can't insert an MF_POPUP menu into another pop-up menu.

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::AppendMenu, CMenu::Detach


CMenu::LoadMenu

Call this member function to load a menu resource from the application's executable file and attach it to the CMenu object.

Syntax

BOOL LoadMenu( LPCTSTR lpszResourceName );

BOOL LoadMenu( UINT nIDResource );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::AppendMenu, CMenu::DestroyMenu


CMenu::MeasureItem

This member function is called by the framework when a menu with the owner-draw style is created.

Syntax

virtual void MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes


CMenu::ModifyMenu

Call this member function to change an existing menu item at the position specified by nPosition.

Syntax

BOOL ModifyMenu( UINT nPosition, UINT nFlags, UINT nIDNewItem = 0, LPCTSTR lpszNewItem = NULL );

BOOL ModifyMenu( UINT nPosition, UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::AppendMenu, CMenu::InsertMenu, CMenu::CheckMenuItem, CMenu::EnableMenuItem, CMenu::Detach


CMenu::RemoveMenu

Call this member function to delete a menu item that has an associated pop-up menu from the menu.

Syntax

BOOL RemoveMenu( UINT nPosition, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::GetSubMenu


CMenu::TrackPopupMenu

Call this member function to display a floating pop-up menu at the specified location, and track the selection of items on the pop-up menu.

Syntax

BOOL TrackPopupMenu ( UINT nFlags, int x, int y, CWnd* pWnd, LPCRECT lpRect = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, the parameter lpRect must be NULL. The pop-up menu is dismissed if the user clicks outside the pop-up menu.

Because there are no left or right mouse buttons to track, you can't specify the TPM_LEFTBUTTON or TPM_RIGHTBUTTON flags in the nFlags parameter.

See Also

CMenu Overview, CMenu Member Functions, Menu Classes, CMenu::CreatePopupMenu, CMenu::GetSubMenu


CMenu Data Members

Data Members
m_hMenu Specifies the handle to the Windows menu attached to the CMenu object.

See Also

CMenu Overview, CMenu Member Functions, Menu Classes


CMenu::m_hMenu

This data member contains the menu handle to the Windows menu attached to this CMenu object.

HMENU m_hMenu;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CMenu Overview, CMenu Data Members, Menu Classes


CNotSupportedException

A CNotSupportedException object represents an exception that is the result of a request for an unsupported feature. No further qualification is necessary or possible.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CNotSupportedException Member Functions, Exception Classes


CNotSupportedException Member Functions

Construction
CNotSupportedException Constructs a CNotSupportedException object.

See Also

CNotSupportedException Overview, Exception Classes


CNotSupportedException::CNotSupportedException

Use this member function to construct a CNotSupportedException object.

Syntax

CNotSupportedException( );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CNotSupportedException Overview, CNotSupportedException Member Functions, Exception Classes


CObArray

The CObArray class supports arrays of CObject pointers. These object arrays are similar to C arrays, but they can dynamically shrink and grow as necessary.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Member Functions, CObArray Operators, Array Classes, CStringArray, CPtrArray, CByteArray, CWordArray, CDWordArray


CObArray Member Functions

Construction
CObArray Constructs an empty array for CObject pointers.

Bounds
GetSize | Gets the number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.

Operations
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.

Element Access
GetAt | Returns the value at a given index.
SetAt | Sets the value for a given index; array not allowed to grow.
ElementAt | Returns a temporary reference to the element pointer within the array.
GetData | Allows access to elements in the array. Can be NULL.

Growing the Array
SetAtGrow | Sets the value for a given index; grows the array if necessary.
Add | Adds an element to the end of the array; grows the array if necessary.
Append | Appends another array to the array; grows the array if necessary.
Copy | Copies another array to the array; grows the array if necessary.

Insertion/Removal
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.

See Also

CObArray Overview, CObArray Operators, Array Classes


CObArray::Add

Call this member function to add a new element to the end of an array, growing the array by one.

Syntax

int Add( CObject* newElement );
throw( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::SetAt, CObArray::SetAtGrow, CObArray::InsertAt, CObArray::operator []


CObArray::Append

Call this member function to add the contents of one array to the end of another array. The arrays must be of the same type. If necessary, Append may allocate extra memory to accommodate the elements appended to the array.

Syntax

int Append( const CArray& src );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::Copy


CObArray::CObArray

Use this constructor to construct an empty CObject pointer array. The array grows one element at a time.

Syntax

CObArray( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObList::CObList


CObArray::Copy

Call this member function to overwrite the elements of the given array with the elements of another array of the same type. Copy doesn't free memory; but, if necessary, Copy may allocate extra memory to accommodate the elements copied to the array.

Syntax

int Copy( const CArray& src );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::Append


CObArray::ElementAt

Call this member function to obtain a temporary reference to the element pointer within the array.

Syntax

CObject*& ElementAt( int nIndex );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::operator []


CObArray::FreeExtra

Call this member function to free any extra memory that was allocated while the array was grown. This function has no effect on the size or upper bound of the array.

Syntax

void FreeExtra( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes


CObArray::GetAt

Call this member function to retrieve the array element at the specified index.

Syntax

const CObject** GetData( ) const;

CObject** GetData( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::SetAt, CObArray::operator []


CObArray::GetData

Use this member function to gain direct access to the elements in the array. If no elements are available, GetData returns a null value. While direct access to the elements of an array can help you work more quickly, use caution when calling GetData; any errors you make directly affect the elements of your array.

Syntax

int Append( const CArray& src );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::GetAt, CObArray::SetAt, CObArray::ElementAt


CObArray::GetSize

Call this member function to retrieve the size of the array. Since indexes are zero-based, the size is 1 greater than the largest index.

Syntax

int GetSize( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::GetUpperBound, CObArray::SetSize


CObArray::GetUpperBound

Call this member function to retrieve the current upper bound of this array. Because array indexes are zero-based, this function returns a value 1 less than GetSize.

Syntax

int GetUpperBound( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::GetSize, CObArray::SetSize


CObArray::InsertAt

Call this member function to insert an element into the array. The first version of InsertAt inserts one element (or multiple copies of an element) at a specified index in an array. In the process, it shifts up (by incrementing the index) the existing element at this index, and it shifts up all the elements above it. The second version inserts all the elements from another CObArray collection, starting at the nStartIndex position.

Syntax

void InsertAt( int nIndex, CObject* newElement, int nCount = 1 );
throw( CMemoryException );

void InsertAt( int nStartIndex, CObArray* pNewArray );
throw( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::SetAt, CObArray::RemoveAt


CObArray::RemoveAll

Call this member function to retrieve all the pointers from this array and free all memory used for pointer storage, but does not actually delete the CObject objects.

Syntax

void RemoveAll( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes


CObArray::RemoveAt

Call this member function to remove one or more elements starting at a specified index in an array. In the process, it shifts down all the elements above the removed element(s). It decrements the upper bound of the array but does not free memory.

Syntax

void RemoveAt( int nIndex, int nCount = 1 );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::SetAt, CObArray::SetAtGrow, CObArray::InsertAt


CObArray::SetAt

Call this member function to set the array element at the specified index. SetAt will not cause the array to grow. Use SetAtGrow if you want the array to grow automatically. You must ensure that your index value represents a valid position in the array. If it is out of bounds, then the Debug version of the library asserts.

Syntax

void SetAt( int nIndex, CObject* newElement );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::GetAt, CObArray::SetAtGrow, CObArray::ElementAt, CObArray::operator []


CObArray::SetAtGrow

Call this member function to set the array element at the specified index. The array grows automatically if necessary (that is, the upper bound is adjusted to accommodate the new element).

Syntax

void SetAtGrow( int nIndex, CObject* newElement );
throw( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes, CObArray::GetAt, CObArray::SetAt, CObArray::ElementAt, CObArray::operator []


CObArray::SetSize

Call this member function to establish the size of an empty or existing array; allocating memory if necessary. If the new size is smaller than the old size, then the array is truncated and all unused memory is released. For efficiency, call SetSize to set the size of the array before using it. This prevents the need to reallocate and copy the array each time an item is added.

Syntax

void SetSize( int nNewSize, int nGrowBy = –1 );
throw( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Member Functions, Array Classes


CObArray Operators

Operators
operator [] Sets or gets the element at the specified index.

See Also

CObArray Overview, CObArray Member Functions, Array Classes


CObArray::operator [ ]

Use these subscript operators as a convenient substitute for the SetAt and GetAt functions.

Cobject* operator []( int nIndex );
Cobject* operator []( int nIndex ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObArray Overview, CObArray Operators, Array Classes, CObArray::GetAt, CObArray::SetAt


CObject

CObject is the principal base class for the MFC.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Member Functions, CObject Operators, Classes Derived from CObject


CObject Member Functions

Construction
CObject | Default constructor.
Cobject | Copy constructor.

Diagnostics
AssertValid | Validates this object's integrity.
Dump | Produces a diagnostic dump of this object.

Serialization
IsSerializable | Tests to see whether this object can be serialized.
Serialize | Loads or stores an object from/to an archive.

Miscellaneous
GetRuntimeClass | Returns the CRuntimeClass structure corresponding to this object's class.
IsKindOf | Tests this object's relationship to a given class.

See Also

CObject Overview, CObject Operators, Classes Derived from CObject


CObject::AssertValid

Call this member function to perform a validity check on this object by checking its internal state.

Syntax

virtual void AssertValid( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject


CObject::CObject

These functions are the standard CObject constructors. The default version is automatically called by the constructor of your derived class.

Syntax

CObject( );

CObject( const CObject& objectSrc );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject


CObject::Dump

Call this member function to dump the contents of your object to a CDumpContext object.

Syntax

virtual void Dump( CDumpContext& dc ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject, CDumpContext


CObject::GetRuntimeClass

Call this member function to retrieve a pointer to the CRuntimeClass structure corresponding to this object's class. There is one CRuntimeClass structure for each CObject-derived class.

Syntax

virtual CRuntimeClass* GetRuntimeClass( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject, CObject::IsKindOf


CObject::IsKindOf

Call this member function to test pClass to see if (1) it is an object of the specified class or (2) it is an object of a class derived from the specified class.

Syntax

BOOL IsKindOf( const CRuntimeClass* pClass ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject, CObject::GetRuntimeClass


CObject::IsSerializable

Call this member function to test whether this object is eligible for serialization.

Syntax

BOOL IsSerializable( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject, CObject::Serialize


CObject::Serialize

Call this member function to read or write this object from or to an archive.

Syntax

virtual void Serialize( CArchive& ar );
throw( CMemoryException );
throw( CArchiveException );
throw( CFileException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject


CObject Operators

Construction
Operator new | Special new operator.
Operator delete | Special delete operator.
Operator = | Assignment operator.

See Also

CObject Overview, CObject Member Functions, Classes Derived from CObject


CObject::operator =

The standard C++ default class assignment behavior is a member-by-member copy. The presence of this private assignment operator guarantees a compiler error message if you assign without the overridden operator. You must therefore provide an assignment operator in your derived class if you intend to assign objects of your derived class.

void operator =( const CObject& src );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Operators, Classes Derived from CObject


CObject::operator delete

For the Release version of the library, operator delete simply frees the memory allocated by operator new.

Syntax

void operator delete( void* p );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Operators, Classes Derived from CObject, CObject::operator new


CObject::operator new

For the Release version of the library, operator new performs an optimal memory allocation in a manner similar to malloc. In the Debug version, operator new participates in an allocation-monitoring scheme designed to detect memory leaks.

Syntax

void* operator new( size_t nSize );
throw( CMemoryException );

void* operator new( size_t nSize, LPCSTR lpszFileName, int nLine );
throw( CMemoryException );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObject Overview, CObject Operators, Classes Derived from CObject, CObject::operator delete


CObList

The CObList class supports ordered lists of nonunique CObject pointers accessible sequentially or by pointer value.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Member Functions, List Classes, CStringList, CPtrList


CObList Member Functions

Construction
CObList Constructs an empty list for CObject pointers.

Head/Tail Access
GetHead | Returns the head element of the list (cannot be empty).
GetTail | Returns the tail element of the list (cannot be empty).

Operations
RemoveHead | Removes the element from the head of the list.
RemoveTail | Removes the element from the tail of the list.
AddHead | Adds an element (or all the elements in another list) to the head of the list (makes a new head).
AddTail | Adds an element (or all the elements in another list) to the tail of the list (makes a new tail).
RemoveAll | Removes all the elements from this list.

Iteration
GetHeadPosition | Returns the position of the head element of the list.
GetTailPosition | Returns the position of the tail element of the list.
GetNext | Gets the next element for iterating.
GetPrev | Gets the previous element for iterating.

Retrieval/Modification
GetAt | Gets the element at a given position.
SetAt | Sets the element at a given position.
RemoveAt | Removes an element from this list, specified by position.

Insertion
InsertBefore | Inserts a new element before a given position.
InsertAfter | Inserts a new element after a given position.

Searching
Find | Gets the position of an element specified by pointer value.
FindIndex | Gets the position of an element specified by a zero-based index.

Status
GetCount | Returns the number of elements in this list.
IsEmpty | Tests for the empty list condition (no elements).

See Also

CObList Overview, List Classes


CObList::AddHead

Call this member function to add a new element or list of elements to the head of this list. The list can be empty before the operation.

Syntax

POSITION AddHead( CObject* newElement );
throw( CMemoryException );

void AddHead( CObList* pNewList );
throw( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetHead, CObList::RemoveHead


CObList::AddTail

Call this member function to add a new element or list of elements to the tail of this list. The list can be empty before the operation.

Syntax

POSITION AddTail( CObject* newElement );
throw( CMemoryException );

void AddTail( CObList* pNewList );
throw( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetTail, CObList::RemoveTail


CObList::CObList

Call this member function to construct an empty CObject pointer list. As the list grows, memory is allocated in units of nBlockSize entries. If a memory allocation fails, a CMemoryException is thrown.

Syntax

CObList( int nBlockSize = 10 );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes


CObList::Find

Call this member function to search the list sequentially for the first CObject pointer matching the specified CObject pointer. Note that the pointer values are compared, not the contents of the objects.

Syntax

POSITION Find( CObject* searchValue, POSITION startAfter = NULL ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetNext, CObList::GetPrev


CObList::FindIndex

Call this member function to conduct a sequential scan from the head of the list, stopping on the nIndexth element.

Syntax

POSITION FindIndex( int nIndex ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::Find, CObList::GetNext, CObList::GetPrev


CObList::GetAt

Call this member function to retrieve the CObject pointer associated with a given position. A variable of type POSITION is a key for the list. It is not the same as an index, and you cannot operate on a POSITION value yourself.

You must ensure that your POSITION value represents a valid position in the list. If it is invalid, then the Debug version of the MFC for Windows CE asserts.

Syntax

CObject*& GetAt( POSITION position );

CObject* GetAt( POSITION position ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::Find, CObList::SetAt, CObList::GetNext, CObList::GetPrev, CObList::GetHead


CObList::GetCount

Call this member function to retrieve the number of elements in this list.

Syntax

int GetCount( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::IsEmpty


CObList::GetHead

Call this member function to retrieve the CObject pointer that represents the head element of this list.

Syntax

CObject*& GetHead( );

CObject* GetHead( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetTail, CObList::GetTailPosition, CObList::AddHead, CObList::RemoveHead


CObList::GetHeadPosition

Call this member function to retrieve the position of the head element of this list.

Syntax

POSITION GetHeadPosition( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetTailPosition


CObList::GetNext

Call this member function to retrieve the list element identified by rPosition, and then set rPosition to the POSITION value of the next entry in the list.

Syntax

CObject*& GetNext( POSITION& rPosition );

CObject* GetNext( POSITION& rPosition ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::Find, CObList::GetHeadPosition, CObList::GetTailPosition, CObList::GetPrev, CObList::GetHead


CObList::GetPrev

Call this member function to retrieve the list element identified by rPosition, and then set rPosition to the POSITION value of the previous entry in the list.

Syntax

CObject*& GetPrev( POSITION& rPosition );

CObject* GetPrev( POSITION& rPosition ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::Find, CObList::GetTailPosition, CObList::GetHeadPosition, CObList::GetNext, CObList::GetHead


CObList::GetTail

Call this member function to retrieve the CObject pointer that represents the tail element of this list.

Syntax

CObject*& GetTail( );

CObject* GetTail( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::AddTail, CObList::AddHead, CObList::RemoveHead, CObList::GetHead


CObList::GetTailPosition

Call this member function to retrieve the position of the tail element of this list. It returns NULL if the list is empty.

Syntax

POSITION GetTailPosition( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetHeadPosition, CObList::GetTail


CObList::InsertAfter

Call this member function to add an element to this list after the element at the specified position.

Syntax

POSITION InsertAfter( POSITION position, CObject* newElement );
throw ( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::Find, CObList::InsertBefore


CObList::InsertBefore

Call this member function to add an element to this list before the element at the specified position.

Syntax

POSITION InsertBefore( POSITION position, CObject* newElement );
throw ( CMemoryException );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::Find, CObList::InsertAfter


CObList::IsEmpty

Call this member function to determine whether this list contains no elements.

Syntax

BOOL IsEmpty( ) const;

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetCount


CObList::RemoveAll

Call this member function to remove all the elements from this list and free the associated CObList memory. No error is generated if the list is already empty.

Syntax

void RemoveAll( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes


CObList::RemoveAt

Call this member function to remove the specified element from this list.

Syntax

void RemoveAt( POSITION position );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes


CObList::RemoveHead

Call this member function to remove the element from the head of the list and obtain a pointer to it.

Syntax

CObject* RemoveHead( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetHead, CObList::AddHead


CObList::RemoveTail

Call this member function to remove the element from the tail of the list and obtain a pointer to it.

Syntax

CObject* RemoveTail( );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::GetTail, CObList::AddTail


CObList::SetAt

Call this member function to write the CObject pointer to the specified position in the list. A variable of type POSITION is a key for the list. It is not the same as an index, and you cannot operate on a POSITION value yourself.

You must ensure that your POSITION value represents a valid position in the list. If it is invalid, then the Debug version of the MFC for Windows CE asserts.

Syntax

void SetAt( POSITION pos, CObject* newElement );

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CObList Overview, CObList Member Functions, List Classes, CObList::Find, CObList::GetAt, CObList::GetNext, CObList::GetPrev


COleControl

The COleControl class is a powerful base class for developing ActiveX controls. Derived from CWnd, this class inherits all the functionality of a Windows window object plus additional functionality specific to ActiveX, such as event firing and the ability to support methods and properties.

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

Remarks

MFC for Windows CE supports ActiveX and Automation. It does not support OLE documents or OLE servers. When a control is activated inside a container, the control's menus and toolbars are not merged with the container's. The container ignores any menus or toolbars the server object passes to it.

MFC for Windows CE does not support the following member functions of the COleControl class:

AmbientLocaleID

DrawMetafile

GetWindowlessDropTarget

Load

OnDrawMetafile

OnEdit

OnGetInPlaceMenu

OnHideToolBars

OnInactiveSetCursor

OnShowToolBars

In MFC for Windows CE, COleControl does not implement the IDataObject or IOleCache interfaces.

See Also

COleControl Member Functions, Control Classes, COlePropertyPage


COleControl Member Functions

Construction/Destruction
COleControl | Creates a COleControl object.
RecreateControlWindow | Destroys and re-creates the control's window.

Initialization
InitializeIIDs | Informs the base class of the IIDs the control will use.
ResetStockProps | Initializes COleControl stock properties to their default values.
ResetVersion | Initializes the version number to a given value.
SetInitialSize | Sets the size of an ActiveX control when first displayed in a container.

Control Modification Functions
GetControlFlags | Retrieves the control flag settings.
IsModified | Determines if the control state has changed.
SetModifiedFlag | Changes the modified state of a control.

Persistence
ExchangeExtent | Serializes the control's width and height.
ExchangeStockProps | Serializes the control's stock properties.
ExchangeVersion | Serializes the control's version number.
IsConvertingVBX | Allows specialized loading of an ActiveX control.
SerializeExtent | Serializes or initializes the display space for the control.
SerializeStockProps | Serializes or initializes the COleControl stock properties.
SerializeVersion | Serializes or initializes the control's version information.
WillAmbientsBeValidDuringLoad | Determines whether ambient properties will be available the next time the control is loaded.

Update/Painting Functions
DoSuperclassPaint | Redraws an ActiveX control that has been subclassed from a Windows control.
InvalidateControl | Invalidates an area of the displayed control, causing it to be redrawn.
IsOptimizedDraw | Indicates whether the container supports optimized drawing for the current drawing operation.
SelectFontObject | Selects a custom Font property into a device context.
TranslateColor | Converts an OLE_COLOR value to a COLORREF value.

Dispatch Exceptions
GetNotSupported | Prevents access to a control's property value by the user.
SetNotPermitted | Indicates that an edit request has failed.
SetNotSupported | Prevents modification to a control's property value by the user.
ThrowError | Signals that an error has occurred in an ActiveX control.

Ambient Property Functions
AmbientBackColor | Returns the value of the ambient BackColor property.
AmbientDisplayName | Returns the name of the control as specified by the container.
AmbientFont | Returns the value of the ambient Font property.
AmbientForeColor | Returns the value of the ambient ForeColor property.
AmbientScaleUnits | Returns the type of units used by the container.
AmbientShowGrabHandles | Determines if grab handles should be displayed.
AmbientShowHatching | Determines if hatching should be displayed.
AmbientTextAlign | Returns the type of text alignment specified by the container.
AmbientUIDead | Determines if the control should respond to user-interface actions.
AmbientUserMode | Determines the mode of the container.
GetAmbientProperty | Returns the value of the specified ambient property.

Event Firing Functions
FireClick | Fires the stock Click event.
FireDblClick | Fires the stock DblClick event.
FireError | Fires the stock Error event.
FireEvent | Fires a custom event.
FireKeyDown | Fires the stock KeyDown event.
FireKeyPress | Fires the stock KeyPress event.
FireKeyUp | Fires the stock KeyUp event.
FireMouseDown | Fires the stock MouseDown event.
FireMouseMove | Fires the stock MouseMove event.
FireMouseUp | Fires the stock MouseUp event.
FireReadyStateChange | Fires an event when the control's ready state changes.

Stock Methods/Properties
DoClick | Implementation of the stock DoClick method.
Refresh | Forces a repaint of a control's appearance.
GetAppearance | Returns the value of the stock Appearance property.
SetAppearance | Sets the value of the stock Appearance property.
GetBackColor | Returns the value of the stock BackColor property.
SetBackColor | Sets the value of the stock BackColor property.
GetBorderStyle | Returns the value of the stock BorderStyle property.
SetBorderStyle | Sets the value of the stock BorderStyle property
GetEnabled | Returns the value of the stock Enabled property.
SetEnabled | Sets the value of the stock Enabled property.
GetForeColor | Returns the value of the stock ForeColor property.
SetForeColor | Sets the value of the stock ForeColor property.
GetFont | Returns the value of the stock Font property.
GetFontTextMetrics | Returns the metrics of a CFontHolder object.
GetStockTextMetrics | Returns the metrics of the stock Font property.
InternalGetFont | Returns a CFontHolder object for the stock Font property.
SetFont | Sets the value of the stock Font property.
SelectStockFont | Selects the control's stock Font property into a device context.
GetHwnd | Returns the value of the stock hWnd property.
GetText | Returns the value of the stock Text or Caption property.
InternalGetText | Retrieves the stock Text or Caption property.
SetText | Sets the value of the stock Text or Caption property.

OLE Control Sizing Functions
GetControlSize | Returns the position and size of the ActiveX control.
SetControlSize | Sets the position and size of the ActiveX control.
GetRectInContainer | Returns the control's rectangle relative to its container.
SetRectInContainer | Sets the control's rectangle relative to its container.

OLE Data Binding Functions
BoundPropertyChanged | Notifies the container that a bound property has been changed.
BoundPropertyRequestEdit | Requests permission to edit the property value.

Simple Frame Functions
EnableSimpleFrame Enables simple frame support for a control.

OLE Control Site Functions
ControlInfoChanged | Call this member function after the set of mnemonics handled by the control has changed.
GetClientSite | Queries an object for the pointer to its current client site within its container.
GetExtendedControl | Retrieves a pointer to an extended control object belonging to the container.
LockInPlaceActive | Prevents your control from being deactivated by the container.
TransformCoords | Transforms coordinate values between a container and the control.

Modal Dialog Functions
PreModalDialog | Notifies the container that a modal dialog box is about to be displayed.
PostModalDialog | Notifies the container that a modal dialog box has been closed.

Windowless Operations
ClipCaretRect | Adjusts a caret rectangle if it is overlapped by a control.
GetCapture | Determines whether a windowless, activated control object has the mouse capture.
GetClientRect | Retrieves the size of the control's client area.
GetDC | Provides a means for a windowless control to get a device context from its container.
GetFocus | Determines whether the control has the focus.
InvalidateRgn | Invalidates the container window's client area within the given region. Can be used to redraw windowless controls in the region.
OnWindowlessMessage | Processes window messages (other than mouse and keyboard messages) for windowless controls.
ReleaseCapture | Releases mouse capture.
ReleaseDC | Releases the display device context of a container of a windowless control.
ScrollWindow | Allows a windowless control to scroll an area within its in-place active image on the display.
SetCapture | Causes the control's container window to take possession of the mouse capture on the control's behalf.
SetFocus | Causes the control's container window to take possession of the input focus on the control's behalf.

Inactive Pointer Handling Functions
ClientToParent | Translates a point relative to the control's origin to a point relative to its container's origin.
GetActivationPolicy | Alters the default activation behavior of a control that supports the IPointerInactive interface.
GetClientOffset | Retrieves the difference between the upper-left corner of the control's rectangular area and the upper-left corner of its client area.
OnInactiveMouseMove | Override to have the container for the inactive control under the mouse pointer dispatch WM_MOUSEMOVE messages to the control.
ParentToClient | Translates a point relative to the container's origin to a point relative to the control's origin.

Asynchronous Control Functions
GetReadyState | Returns the control's readiness state.
InternalSetReadyState | Sets the control's readiness state and fires the ready-state-change event.

Overridables
DisplayError | Displays stock Error events to the control's user.
DoPropExchange | Serializes the properties of a COleControl object.
GetClassID | Retrieves the COM class ID of the control.
GetMessageString | Provides status bar text for a menu item.
IsSubclassedControl | Called to determine if the control subclasses a Windows control.
OnClick | Called to fire the stock Click event.
OnDoVerb | Called after a control verb has been executed.
OnDraw | Called when a control is requested to redraw itself.
OnEnumVerbs | Called by the container to enumerate a control's verbs.
OnEventAdvise | Called when event handlers are connected or disconnected from a control.
OnKeyDownEvent | Called after the stock KeyDown event has been fired.
OnKeyPressEvent | Called after the stock KeyPress event has been fired.
OnKeyUpEvent | Called after the stock KeyUp event has been fired.
OnProperties | Called when the control's "Properties" verb has been invoked.
OnResetState | Resets a control's properties to the default values.

Change Notification Functions
OnAppearanceChanged | Called when the stock Appearance property is changed.
OnBackColorChanged | Called when the stock BackColor property is changed.
OnBorderStyleChanged | Called when the stock BorderStyle property is changed.
OnEnabledChanged | Called when the stock Enabled property is changed.
OnFontChanged | Called when the stock Font property is changed.
OnForeColorChanged | Called when the stock ForeColor property is changed.
OnTextChanged | Called when the stock Text or Caption property is changed.

OLE Interface Notification Functions
OnAmbientPropertyChange | Called when an ambient property is changed.
OnClose | Notifies the control that IOleControl::Close has been called.
OnFreezeEvents | Called when a control's events are frozen or unfrozen.
OnGetControlInfo | Provides mnemonic information to the container.
OnMnemonic | Called when a mnemonic key of the control has been pressed.
OnRenderData | Called by the framework to retrieve data in the specified format.
OnRenderFileData | Called by the framework to retrieve data from a file in the specified format.
OnRenderGlobalData | Called by the framework to retrieve data from global memory in the specified format.
OnSetClientSite | Notifies the control that IOleControl::SetClientSite has been called.
OnSetData | Replaces the control's data with another value.
OnSetExtent | Called after the control's extent has changed.
OnSetObjectRects | Called after the control's dimensions have been changed.

IViewObject Interface Notification Overridables
OnGetColorSet | Notifies the control that IOleObject::GetColorSet has been called.
OnGetNaturalExtent | Override to retrieve the control's display size closest to the proposed size and extent mode.
OnGetViewExtent | Override to retrieve the size of the control's display areas (can be used to enable two-pass drawing).
OnGetViewRect | Override to convert control's size into a rectangle starting at a specific position.
OnGetViewStatus | Override to retrieve the control's view status.
OnQueryHitPoint | Override to query whether a control's display overlaps a given point.
OnQueryHitRect | Override to query whether a control's display overlaps any point in a given rectangle.

Property Browsing Functions
OnGetDisplayString | Called to obtain a string to represent a property value.
OnGetPredefinedStrings | Returns strings representing possible values for a property.
OnGetPredefinedValue | Returns the value corresponding to a predefined string.
OnMapPropertyToPage | Indicates which property page to use for editing a property.

See Also

COleControl Overview, Control Classes


COleControl::AmbientBackColor

Call this member function to retrieve the value of the ambient BackColor property. The ambient BackColor property is available to all controls and is defined by the container. The container is not required to support this property.

Syntax

OLE_COLOR AmbientBackColor( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::TranslateColor, COleControl::GetBackColor, COleControl::AmbientForeColor, CString


COleControl::AmbientDisplayName

Call this member function to retrieve the name of the control as specified by the container.

Syntax

CString AmbientDisplayName( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::AmbientFont

Call this member function to retrieve the value of the ambient Font property.

Syntax

LPFONTDISP AmbientFont( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetFont, COleControl::SetFont


COleControl::AmbientForeColor

Call this member function to retrieve the value of the ambient ForeColor property.

Syntax

OLE_COLOR AmbientForeColor( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientBackColor , COleControl::GetForeColor, COleControl::TranslateColor


COleControl::AmbientScaleUnits

Call this member function to retrieve the type of units used by the container.

Syntax

CString AmbientScaleUnits( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::TransformCoords, CString


COleControl::AmbientShowGrabHandles

Call this member function to determine whether grab handles should be displayed.

Syntax

BOOL AmbientShowGrabHandles( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientShowHatching


COleControl::AmbientShowHatching

Call this member function to determine whether hatching should be displayed.

Syntax

BOOL AmbientShowHatching( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientShowGrabHandles


COleControl::AmbientTextAlign

Call this member function to retrieve the type of text alignment specified by the container.

Syntax

short AmbientTextAlign( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::AmbientUIDead

Call this member function to determine whether the control should respond to user-interface actions.

Syntax

BOOL AmbientUIDead( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientUserMode


COleControl::AmbientUserMode

Call this member function to determine the mode of the container.

Syntax

BOOL AmbientUserMode( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientUIDead


COleControl::BoundPropertyChanged

Call this member function to notify the container that a bound property has been changed.

Syntax

void BoundPropertyChanged( DISPID dispid );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::BoundPropertyRequestEdit, DISPID


COleControl::BoundPropertyRequestEdit

Call this member function to request permission to edit the property value.

Syntax

BOOL BoundPropertyRequestEdit( DISPID dispid )

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::BoundPropertyChanged, DISPID


COleControl::ClientToParent

Call this member function to translate a point relative to the control's origin to a point relative to its container's origin.

Syntax

virtual void ClientToParent( LPCRECT lprcBounds, LPPOINT pPoint ) const;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::ParentToClient , COleControl::GetClientOffset


COleControl::ClipCaretRect

Call this member function to adjust a caret rectangle if it is overlapped by a control.

Syntax

BOOL ClipCaretRect( LPRECT lpRect );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::COleControl

Use this constructor to construct a COleControl object.

Syntax

COleControl( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::ControlInfoChanged

Call this member function to after the set of mnemonics handled by the control has changed.

Syntax

void ControlInfoChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::DisplayError

Call this member function to display stock Error events to the control's user.

Syntax

virtual void DisplayError( SCODE scode, LPCTSTR lpszDescription, LPCTSTR lpszSource, LPCTSTR lpszHelpFile, UINT nHelpID );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireError, SCODE


COleControl::DoClick

This function is an implementation of the stock DoClick method.

Syntax

void DoClick( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnClick


COleControl::DoPropExchange

Call this member function to serialize the properties of a COleControl object.

Syntax

virtual void DoPropExchange( CPropExchange* pPX );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, CPropExchange


COleControl::DoSuperclassPaint

Call this member function to redraw an ActiveX control that has been subclassed from a Windows control.

Syntax

void DoSuperclassPaint( CDC* pDC, const CRect& rcBounds );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnDraw


COleControl::DrawContent

This member function is called by the framework when the control's appearance needs to be updated. This function directly calls the overridable OnDraw function.

Syntax

void DrawContent( CDC* pDC, CRect& rc );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnDraw


COleControl::EnableSimpleFrame

Call this member function to enable simple frame support for a control.

Syntax

void EnableSimpleFrame( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::ExchangeExtent

Call this member function to serialize the control's width and height.

Syntax

BOOL ExchangeExtent( CPropExchange* pPX );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoPropExchange, CPropExchange


COleControl::ExchangeStockProps

Call this member function to serialize the control's stock properties.

Syntax

void ExchangeStockProps( CPropExchange* pPX );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoPropExchange, CPropExchange


COleControl::ExchangeVersion

Call this member function to serialize the control's version number.

Syntax

BOOL ExchangeVersion( CPropExchange* pPX, DWORD dwVersionDefault, BOOL bConvert = TRUE );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoPropExchange, CPropExchange


COleControl::FireClick

Call this member function to fire the stock Click event.

Syntax

void FireClick( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireDblClick , COleControl::FireMouseDown, COleControl::FireMouseUp


COleControl::FireDblClick

Call this member function to fire the stock DblClick event.

Syntax

void FireDblClick( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireClick , COleControl::FireMouseDown, COleControl::FireMouseUp


COleControl::FireError

Call this member function to fire the stock Error event.

Syntax

void FireError( SCODE scode, LPCTSTR lpszDescription, UINT nHelpID = 0 );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DisplayError, SCODE


COleControl::FireEvent

Call this member function to fire a custom event.

Syntax

void FireEvent( DISPID dispid, BYTE FAR* pbParams, ... );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, DISPID


COleControl::FireKeyDown

Call this member function to fire the stock KeyDown event.

Syntax

void FireKeyDown( USHORT* pnChar, short nShiftState );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireKeyUp , COleControl::FireKeyPress, COleControl::OnKeyPressEvent


COleControl::FireKeyPress

Call this member function to fire the stock KeyPress event.

Syntax

void FireKeyPress( USHORT* pnChar );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnKeyPressEvent , COleControl::FireKeyDown, COleControl::FireKeyUp


COleControl::FireKeyUp

Call this member function to fire the stock KeyUp event.

Syntax

void FireKeyUp( USHORT* pnChar, short nShiftState );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireKeyDown , COleControl::FireKeyPress, COleControl::OnKeyUpEvent


COleControl::FireMouseDown

Call this member function to fire the stock MouseDown event.

Syntax

void FireMouseDown( short nButton, short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXEL y );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireMouseUp , COleControl::FireMouseMove, COleControl::FireClick


COleControl::FireMouseMove

Call this member function to fire the stock MouseMove event.

Syntax

void FireMouseMove( short nButton, short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::FireMouseUp

Call this member function to fire the stock MouseUp event.

Syntax

void FireMouseUp( short nButton, short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireMouseDown , COleControl::FireClick, COleControl::FireDblClick


COleControl::FireReadyStateChange

Call this member function to fire an event when the control's ready state changes.

Syntax

void FireReadyStateChange( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetReadyState , COleControl::InternalSetReadyState


COleControl::GetActivationPolicy

Call this member function to alter the default activation behavior of a control that supports the IPointerInactive interface.

Syntax

virtual DWORD GetActivationPolicy( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnInactiveMouseMove


COleControl::GetAmbientProperty

Call this member function to retrieve the value of the specified ambient property.

Syntax

BOOL GetAmbientProperty( DISPID dwDispid, VARTYPE vtProp, void* pvProp );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientForeColor , COleControl::AmbientScaleUnits, COleControl::AmbientShowGrabHandles, DISPID, VARTYPE


COleControl::GetAppearance

Call this member function to retrieve the value of the stock Appearance property.

Syntax

short GetAppearance ( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetAppearance , COleControl::OnAppearanceChanged


COleControl::GetBackColor

Call this member function to retrieve the value of the stock BackColor property.

Syntax

OLE_COLOR GetBackColor( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientBackColor , COleControl::TranslateColor, COleControl::SetBackColor, COleControl::GetForeColor


COleControl::GetBorderStyle

Call this member function to retrieve the value of the stock BorderStyle property.

Syntax

short GetBorderStyle( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetBorderStyle , COleControl::OnBorderStyleChanged


COleControl::GetCapture

Call this member function to determine whether a windowless, activated control object has the mouse capture.

Syntax

CWnd* GetCapture( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetCapture, COleControl::ReleaseCapture


COleControl::GetClassID

Call this member function to retrieve the COM class identifier of the control.

Syntax

virtual HRESULT GetClassID( LPCLSID pclsid ) = 0;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::GetClientOffset

Call this member function to retrieve he difference between the upper-left corner of the control's rectangular area and the upper-left corner of its client area.

Syntax

virtual void GetClientOffset( long* pdxOffset, long* pdyOffset ) const;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::ParentToClient , COleControl::ClientToParent


COleControl::GetClientRect

Call this member function to retrieve the size of the control's client area.

Syntax

virtual void GetClientRect( LPRECT lpRect ) const;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::GetClientSite

Call this member function to query an object for the pointer to its current client site within its container.

Syntax

LPOLECLIENTSITE GetClientSite( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::GetControlFlags

Call this member function to retrieve the control flag settings.

Syntax

virtual DWORD GetControlFlags( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, CDC::IntersectClipRect, COleControl::SetControlSize


COleControl::GetControlSize

Call this member function to retrieve the position and size of the ActiveX control.

Syntax

void GetControlSize( int* pcx, int* pcy );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetRectInContainer, COleControl::SetControlSize


COleControl::GetDC

Call this member function to provide a means for a windowless object to get a screen (or compatible) device context from its container. The COleControl::ReleaseDC member function must be called to release the context after painting.

Syntax

CDC* GetDC( LPCRECT lprcRect = NULL, DWORD dwFlags = OLEDC_PAINTBKGND );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::ReleaseDC


COleControl::GetEnabled

Call this member function to retrieve the value of the stock Enabled property.

Syntax

BOOL GetEnabled( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetEnabled , COleControl::OnEnabledChanged


COleControl::GetExtendedControl

Call this member function to retrieve a pointer to an extended control object belonging to the container.

Syntax

LPDISPATCH GetExtendedControl( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::GetFocus

Call this member function to determine whether the control has the focus.

Syntax

CWnd* GetFocus( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetFocus


COleControl::GetFont

Call this member function to retrieve the value of the stock Font property.

Syntax

LPFONTDISP GetFont( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetFont , COleControl::AmbientFont, COleControl::InternalGetFont


COleControl::GetFontTextMetrics

Call this member function to retrieve the metrics of a CFontHolder object.

Syntax

void GetFontTextMetrics( LPTEXTMETRIC lptm, CFontHolder& fontHolder );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, CFontHolder, TEXTMETRIC


COleControl::GetForeColor

Call this member function to retrieve the value of the stock ForeColor property.

Syntax

OLE_COLOR GetForeColor( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientForeColor , COleControl::TranslateColor, COleControl::GetBackColor, COleControl::SetForeColor


COleControl::GetHwnd

Call this member function to retrieve the value of the stock hWnd property.

Syntax

OLE_HANDLE GetHwnd( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::GetMessageString

Call this member function to retrieve the status bar text for a menu item.

Syntax

virtual void GetMessageString( UINT nID, CString& rMessage ) const;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, CString


COleControl::GetNotSupported

Call this member function in place of the Get function of any property where retrieval of the property by the control's user is not supported, for instance a property that is write-only.

Syntax

void GetNotSupported( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetNotSupported


COleControl::GetReadyState

Call this member function to retrieve the control's readiness state.

Syntax

long GetReadyState( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireReadyStateChange , COleControl::InternalSetReadyState


COleControl::GetRectInContainer

Call this member function to retrieve the control's rectangle relative to its container.

Syntax

BOOL GetRectInContainer( LPRECT lpRect );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetRectInContainer , COleControl::GetControlSize


COleControl::GetStockTextMetrics

Call this member function to retrieve the metrics of the stock Font property.

Syntax

void GetStockTextMetrics( LPTEXTMETRIC lptm );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, TEXTMETRIC


COleControl::GetText

Call this member function to retrieve the value of the stock Text or Caption property.

Syntax

BSTR GetText( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::InternalGetText , COleControl::SetText


COleControl::InitializeIIDs

Call this member function to inform the base class of the IIDs the control will use.

Syntax

void InitializeIIDs( const IID* piidPrimary, const IID* piidEvents );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::InternalGetFont

Call this member function to retrieve a CFontHolder object for the stock Font property.

Syntax

CFontHolder& InternalGetFont( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetFont , COleControl::SetFont, CFontHolder


COleControl::InternalGetText

Call this member function to retrieve the stock Text or Caption property.

Syntax

const CString& InternalGetText( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetText, COleControl::SetText, CString


COleControl::InternalSetReadyState

Call this member function to set the control's readiness state and fires the ready-state-change event.

Syntax

void InternalSetReadyState( long lNewReadyState );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireReadyStateChange , COleControl::GetReadyState


COleControl::InvalidateControl

Call this member function to invalidate an area of the displayed control, causing it to be redrawn.

Syntax

void InvalidateControl( LPCRECT lpRect = NULL );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::Refresh


COleControl::InvalidateRgn

Call this member function to invalidate the container window's client area within the given region. This function can be used to redraw windowless controls in the region.

Syntax

void InvalidateRgn( CRgn* pRgn, BOOL bErase = TRUE );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::IsConvertingVBX

Call this member function to allow specialized loading of a Visual Basic control (VBX).

Syntax

BOOL IsConvertingVBX( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoPropExchange


COleControl::IsModified

Call this member function to determine whether the control state has changed.

Syntax

BOOL IsModified( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetModifiedFlag


COleControl::IsOptimizedDraw

Call this member function to determine whether the container supports optimized drawing for the current drawing operation.

Syntax

BOOL IsOptimizedDraw( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::IsSubclassedControl

This member function is called by the framework to determine whether the control subclasses a Windows control.

Syntax

virtual BOOL IsSubclassedControl( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::LockInPlaceActive

Call this member function to prevent your control from being deactivated by the container. You should only lock your control for short periods, such as while firing an event. Every locking of the control must be paired with an unlocking of the control, when finished.

Syntax

BOOL LockInPlaceActive( BOOL bLock );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnAmbientPropertyChange

This member function is called by the framework when an ambient property is changed.

Syntax

virtual void OnAmbientPropertyChange( DISPID dispID );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetAmbientProperty


COleControl::OnAppearanceChanged

This member function is called by the framework when the stock Appearance property is changed

Syntax

virtual void OnAppearanceChanged ( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetAppearance , COleControl::SetAppearance, COleControl::InvalidateControl


COleControl::OnBackColorChanged

This member function is called by the framework when the stock BackColor property is changed.

Syntax

virtual void OnBackColorChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetBackColor , COleControl::InvalidateControl


COleControl::OnBorderStyleChanged

This member function is called by the framework when the stock BorderStyle property is changed.

Syntax

virtual void OnBorderStyleChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetBorderStyle , COleControl::InvalidateControl


COleControl::OnClick

This member function is called by the framework when a mouse button is clicked (or the stylus is tapped on a touch screen), to fire the stock Click event.

Syntax

virtual void OnClick( USHORT iButton );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoClick , COleControl::FireClick


COleControl::OnClose

This member function is called by the framework to notify the control that IOleControl::Close has been called.

Syntax

virtual void OnClose( DWORD dwSaveOption );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnDoVerb

This member function is called by the framework after a control verb has been executed.

Syntax

virtual BOOL OnDoVerb( LONG iVerb, LPMSG lpMsg, HWND hWndParent, LPCRECT lpRect );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnEnumVerbs


COleControl::OnDraw

This member function is called by the framework when a control is requested to redraw itself.

Syntax

virtual void OnDraw( CDC* pDC, const CRect& rcBounds, const CRect& rcInvalid );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DrawContent, CDC, CRect


COleControl::OnEnabledChange

COleControl::OnEnabledChanged

This member function is called by the framework when the stock Enabled property is changed. Override this function if you want notification after this property changes. The default implementation calls InvalidateControl.

Syntax

virtual void OnEnabledChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, InvalidateControl, COleControl::SetEnabled , COleControl::GetEnabled


COleControl::OnEnumVerbs

This member function is called by the container to enumerate a control's verbs.

Syntax

virtual BOOL OnEnumVerbs( LPENUMOLEVERB FAR* ppenumOleVerb );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnEventAdvise

This member function is called by the framework when event handlers are connected or disconnected from a control.

Syntax

virtual void OnEventAdvise( BOOL bAdvise );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnFontChanged

This member function is called by the framework when the stock Font property is changed.

Syntax

virtual void OnFontChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetFont , COleControl::InternalGetFont, COleControl::InvalidateControl


COleControl::OnForeColorChanged

This member function is called by the framework when the stock ForeColor property is changed.

Syntax

virtual void OnForeColorChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetForeColor , COleControl::InvalidateControl


COleControl::OnFreezeEvents

This member function is called by the framework when a control's events are frozen or unfrozen. Override this function if you want to implement some special behavior when event handling is frozen or unfrozen. The default implementation does nothing.

Syntax

virtual void OnFreezeEvents( BOOL bFreeze );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnGetColorSet

This member function is called by the framework when the container calls the IOleObject::GetColorSet function. The container calls this member function to obtain all the colors needed to draw the ActiveX control. The container can use the color sets obtained in conjunction with the colors it needs to set the overall color palette. The default implementation returns FALSE.

Syntax

virtual BOOL OnGetColorSet( DVTARGETDEVICE FAR* ptd, HDC hicTargetDev, LPLOGPALETTE FAR* ppColorSet );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, DVTARGETDEVICE, LOGPALETTE


COleControl::OnGetControlInfo

This member function is called by the container to provide mnemonic information for the control. This information consists primarily of a description of the control's mnemonic keys. The default implementation fills pControlInfo with default information.

Syntax

virtual void OnGetControlInfo( LPCONTROLINFO pControlInfo );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, CONTROLINFO


COleControl::OnGetDisplayString

This member function is called by the framework to obtain a string to represent a property value. Override this function if your control has a property whose value cannot be directly converted to a string and you want the property's value to be displayed in a container-supplied property browser.

Syntax

virtual BOOL OnGetDisplayString( DISPID dispid, CString& strValue );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnMapPropertyToPage, CString


COleControl::OnGetNaturalExtent

This member function is called by the framework in response to a container's IViewObjectEx::GetNaturalExtent request. Override this function to return the object's display size closest to the proposed size and extent mode in the DVEXTENTINFO structure. The default implementation returns FALSE and makes no adjustments to the size.

Syntax

virtual BOOL OnGetNaturalExtent( DWORD dwAspect, LONG lindex, DVTARGETDEVICE* ptd, HDC hicTargetDev, DVEXTENTINFO* pExtentInfo, LPSIZEL psizel );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnGetViewExtent, DVTARGETDEVICE, DVEXTENTINFO


COleControl::OnGetPredefinedStrings

This member function is called by the framework to obtain a set of predefined strings representing the possible values for a property. Override this function if your control has a property with a set of possible values that can be represented by strings. For each element added to pStringArray, you should add a corresponding "cookie" element to pCookieArray. These "cookie" values may later be passed by the framework to the COleControl::OnGetPredefinedValue function.

Syntax

virtual BOOL OnGetPredefinedStrings( DISPID dispid, CStringArray* pStringArray, CDWordArray* pCookieArray );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnGetPredefinedValue , COleControl::OnGetDisplayString, CStringArray, CDWordArray


COleControl::OnGetPredefinedValue

This member function is called by the framework to obtain the value corresponding to one of the predefined strings previously returned by an override of COleControl::OnGetPredefinedStrings.

Syntax

virtual BOOL OnGetPredefinedValue( DISPID dispid, DWORD dwCookie, VARIANT FAR* lpvarOut );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnGetPredefinedStrings , COleControl::OnGetDisplayString, VARIANT


COleControl::OnGetViewExtent

This function called by the framework in response to a container's IViewObjectEx::GetExtent request. Override this function if your control uses two-pass drawing, and its opaque and transparent parts have different dimensions.

Syntax

virtual BOOL OnGetViewExtent( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE* ptd, LPSIZEL lpsizel );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, DVTARGETDEVICE, COleControl::OnGetViewRect


COleControl::OnGetViewRect

This member function is called by the framework in response to a container's IViewObjectEx::GetRect request. The object's size is converted by OnGetViewRect into a rectangle starting at a specific position (the default is the upper left corner of the display). Override this function if your control uses two-pass drawing, and its opaque and transparent parts have different dimensions.

Syntax

virtual BOOL OnGetViewRect( DWORD dwAspect, LPRECTL pRect );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnGetViewExtent


COleControl::OnGetViewStatus

This member function is called by the framework in response to a container's IViewObjectEx::GetViewStatus request. Override this function if your control uses two-pass drawing. The default implementation returns VIEWSTATUS_OPAQUE.

Syntax

virtual DWORD OnGetViewStatus( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, DVASPECT


COleControl::OnInactiveMouseMove

This member function is called by the container for the inactive object under the mouse pointer on receipt of a WM_MOUSEMOVE message. Note that window client coordinates (pixels) are used to pass the mouse cursor position. This is made possible by also passing the bounding rectangle of the object in the same coordinate system.

Syntax

virtual void OnInactiveMouseMove( LPCRECT lprcBounds, long x, long y, DWORD dwKeyState );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetActivationPolicy , WM_MOUSEMOVE


COleControl::OnKeyDownEvent

This member function is called by the framework after the stock KeyDown event has been fired.

Syntax

virtual void OnKeyDownEvent( USHORT nChar, USHORT nShiftState );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireKeyDown, COleControl::OnKeyUpEvent , COleControl::OnKeyPressEvent


COleControl::OnKeyPressEvent

This member function is called by the framework after the stock KeyPress event has been fired.

Syntax

virtual void OnKeyPressEvent( USHORT nChar );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireKeyPress , COleControl::OnKeyDownEvent, COleControl::OnKeyUpEvent


COleControl::OnKeyUpEvent

This member function is called by the framework after the stock KeyUp event has been fired.

Syntax

virtual void OnKeyUpEvent( USHORT nChar, USHORT nShiftState );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, , COleControl::FireKeyUp, COleControl::OnKeyDownEvent , COleControl::OnKeyPressEvent


COleControl::OnMapPropertyToPage

This member function is called by the framework to obtain the class ID of a property page that implements editing of the specified property. Override this function to provide a way to invoke your control's property pages from the container's property browser.

Syntax

virtual BOOL OnMapPropertyToPage( DISPID dispid, LPCLSID lpclsid, BOOL* pbPageOptional );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnGetDisplayString


COleControl:: OnMnemonic

This member function is called by the framework when a mnemonic key of the control has been pressed.

Syntax

virtual void OnMnemonic( LPMSG pMsg );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnProperties

This member function is called by the framework when the control's Properties verb has been invoked by the container. The default implementation displays a modal property dialog box.

Syntax

virtual BOOL OnProperties( LPMSG lpMsg, HWND hWndParent, LPCRECT lpRect );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnQueryHitPoint

This member function is called by the framework in response to a container's IViewObjectEx::QueryHitPoint request. Queries whether an object's display rectangle overlaps the given point (hits the point). QueryHitPoint can be overridden to test hits for non-rectangular objects.

Syntax

virtual BOOL OnQueryHitPoint( DWORD dwAspect, LPCRECT pRectBounds, POINT ptlLoc, LONG lCloseHint, DWORD* pHitResult );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnQueryHitRect


COleControl::OnQueryHitRect

This member function is called by the framework in response to a container's IViewObjectEx::QueryHitRect request. Queries whether an object's display rectangle overlaps any point in the given rectangle (hits the rectangle). QueryHitRect can be overridden to test hits for non-rectangular objects.

Syntax

virtual BOOL OnQueryHitRect( DWORD dwAspect, LPCRECT pRectBounds, LPCRECT prcLoc, LONG lCloseHint, DWORD* pHitResult );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnQueryHitPoint


COleControl::OnRenderData

This member function is called by the framework to retrieve data in the specified format.

Syntax

virtual BOOL OnRenderData( LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

Remarks

Windows CE 2.0 does not support metafiles, so you cannot use this function to render metafiles or enhanced metafiles.

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnRenderFileData , COleControl::OnRenderGlobalData, FORMATETC , STGMEDIUM


COleControl::OnRenderFileData

This member function is called by the framework to retrieve data from a file in the specified format.

Syntax

virtual BOOL OnRenderFileData( LPFORMATETC lpFormatEtc, CFile* pFile );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnRenderData , COleControl::OnRenderGlobalData, CFile, FORMATETC


COleControl::OnRenderGlobalData

This member function is called by the framework to retrieve data from global memory in the specified format.

Syntax

virtual BOOL OnRenderGlobalData( LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::OnRenderFileData , COleControl::OnRenderData, FORMATETC


COleControl::OnResetState

This member function is called by the framework when the control's properties should be set to their default values. The default implementation calls COleControl::DoPropExchange, passing a CPropExchange object that causes properties to be set to their default values.

Syntax

virtual void OnResetState( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoPropExchange, COleControl::OnSetClientSite


COleControl::OnSetClientSite

This member function is called by the framework when the container has called the control's IOleControl::SetClientSite function.

Syntax

virtual void OnSetClientSite( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnSetData

This member function is called by the framework to replace the control's data with the specified data. If the data is in the persistent property set format, the default implementation modifies the control's state accordingly. Otherwise, the default implementation does nothing. If bRelease is TRUE, then a call to ReleaseStgMedium is made; otherwise not.

Syntax

virtual BOOL OnSetData( LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium, BOOL bRelease );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoPropExchange, FORMATETC , STGMEDIUM


COleControl::OnSetExtent

This member function is called by the framework when the control's extent needs to be changed, as a result of a call to IOleObject::SetExtent. The default implementation handles the resizing of the control's extent. If the control is in-place active, a call to the container's OnPosRectChanged is then made.

Syntax

virtual BOOL OnSetExtent( LPSIZEL lpSizeL );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnSetObjectRects

This member function is called by the framework to implement a call to IOleInPlaceObject::SetObjectRects. The default implementation automatically handles the repositioning and resizing of the control window and returns TRUE.

Syntax

virtual BOOL OnSetObjectRects( LPCRECT lpRectPos, LPCRECT lpRectClip );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::OnTextChanged

This member function is called by the framework when the stock Caption or Text property value has changed. The default implementation calls COleControl::InvalidateControl.

Syntax

virtual void OnTextChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetText , COleControl::InternalGetText, COleControl::InvalidateControl


COleControl::OnWindowlessMessage

This member function is called by the framework in response to a container's IOleInPlaceObjectWindowless::OnWindowMessage request. Processes window messages for windowless controls. OnWindowlessMessage should be used for window messages other than mouse messages and keyboard messages. COleControl provides SetCapture and SetFocus specifically to get mouse capture and keyboard focus for windowless ActiveX objects.

Syntax

virtual BOOL OnWindowlessMessage( UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* plResult );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetCapture , COleControl::SetFocus


COleControl::ParentToClient

Call this member function to translate a point relative to the container's origin to a point relative to the control's origin.

Syntax

virtual UINT ParentToClient( LPCRECT lprcBounds, LPPOINT pPoint, BOOL bHitTest = FALSE ) const;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::ClientToParent , COleControl::GetClientOffset


COleControl::PostModalDialog

Call this member function to notify the container that a modal dialog box has been closed.

Syntax

void PostModalDialog( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::PreModalDialog


COleControl::PreModalDialog

Call this member function to notify the container that a modal dialog box is about to be displayed.

Syntax

void PreModalDialog( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::PostModalDialog


COleControl::RecreateControlWindow

Call this member function to destroy and recreates the control's window.

Syntax

void RecreateControlWindow( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::Refresh

Call this member function to force a repaint of a control's appearance.

Syntax

void Refresh( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::InvalidateControl


COleControl::ReleaseCapture

Call this member function to release mouse capture.

Syntax

BOOL ReleaseCapture( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetCapture , COleControl::GetCapture


COleControl::ReleaseDC

Call this member function to release the display device context of a container of a windowless control, freeing the device context for use by other applications. The application must call ReleaseDC for each call to GetDC.

Syntax

int ReleaseDC( CDC* pDC );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetDC


COleControl::ResetStockProps

Call this member function to initialize COleControl stock properties to their default values.

Syntax

void ResetStockProps( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::ResetVersion , COleControl::SerializeStockProps


COleControl::ResetVersion

Call this member function to initialize the version number to a given value.

Syntax

void ResetVersion( DWORD dwVersionDefault );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::ResetStockProps, COleControl::SerializeVersion


COleControl::ScrollWindow

Call this member function to allow a windowless control to scroll an area within its in-place active image on the display.

Syntax

void ScrollWindow( int xAmount, int yAmount, LPCRECT lpRect = NULL, LPCRECT lpClipRect = NULL );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::SelectFontObject

Call this member function to select a custom Font property into a device context.

Syntax

CFont* SelectFontObject( CDC* pDC, CFontHolder& fontHolder );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SelectStockFont, CFont, CFontHolder


COleControl::SelectStockFont

Call this member function to select the stock Font property into a device context.

Syntax

CFont* SelectStockFont( CDC* pDC );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetFont , COleControl::SelectFontObject, COleControl::SetFont, CDC, CFont


COleControl::SerializeExtent

Call this member function to serialize or initialize the display space for the control.

Syntax

void SerializeExtent( CArchive& ar );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SerializeStockProps , COleControl::SerializeVersion, CArchive


COleControl::SerializeStockProps

Call this member function to serialize or initialize the COleControl stock properties.

Syntax

void SerializeStockProps( CArchive& ar );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SerializeExtent , COleControl::SerializeVersion , COleControl::ResetStockProps, CArchive


COleControl::SerializeVersion

Call this member function to serialize or initialize the control's version information.

Syntax

DWORD SerializeVersion( CArchive& ar, DWORD dwVersionDefault, BOOL bConvert = TRUE );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SerializeExtent , COleControl::SerializeStockProps, COleControl::ResetVersion, CArchive


COleControl::SetAppearance

Call this member function to set the value of the stock Appearance property.

Syntax

void SetAppearance ( short sAppearance );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetAppearance, COleControl::OnAppearanceChanged


COleControl::SetBackColor

Call this member function to set the value of the stock BackColor property.

Syntax

void SetBackColor( OLE_COLOR dwBackColor );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetForeColor , COleControl::GetBackColor, COleControl::OnBackColorChanged


COleControl::SetBorderStyle

Call this member function to set the value of the stock BorderStyle property.

Syntax

void SetBorderStyle( short sBorderStyle );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetBorderStyle , COleControl::OnBorderStyleChanged


COleControl::SetCapture

Call this member function to cause the control's container window to take possession of the mouse capture on the control's behalf.

Syntax

CWnd* SetCapture( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetCapture , COleControl::ReleaseCapture


COleControl::SetControlSize

Call this member function to set the position and size of the ActiveX control.

Syntax

BOOL SetControlSize( int cx, int cy );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetControlSize , COleControl::GetRectInContainer


COleControl::SetEnabled

Call this member function to set the value of the stock Enabled property.

Syntax

void SetEnabled( BOOL bEnabled );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetEnabled , COleControl::OnEnabledChanged


COleControl::SetFocus

Call this member function to cause the control's container window to take possession of the input focus on the control's behalf.

Syntax

CWnd* SetFocus( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetFocus


COleControl::SetFont

Call this member function to set the value of the stock Font property.

Syntax

void SetFont( LPFONTDISP pFontDisp );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetFont , COleControl::InternalGetText, COleControl::OnFontChanged


COleControl::SetForeColor

Call this member function to set the value of the stock ForeColor property.

Syntax

void SetForeColor( OLE_COLOR dwForeColor );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::SetBackColor , COleControl::GetForeColor, COleControl::OnForeColorChanged


COleControl:: SetInitialSize

Call this member function to set the size of an ActiveX control when first displayed in a container.

Syntax

void SetInitialSize( int cx, int cy );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes


COleControl::SetModifiedFlag

Call this member function to change the modified state of a control.

Syntax

void SetModifiedFlag( BOOL bModified = TRUE );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::IsModified


COleControl::SetNotPermitted

Call this member function when BoundPropertyRequestEdit fails. This function throws an exception of type COleDispScodeException to indicate that the set operation was not permitted.

Syntax

void SetNotPermitted( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::BoundPropertyRequestEdit


COleControl::SetNotSupported

Call this member function in place of the Set function when modification of the property value by the control's user is not supported. For instance, you'd call this function for a read-only property when a user attempts to set its value.

Syntax

void SetNotSupported( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetNotSupported


COleControl::SetRectInContainer

Call this member function to set the control's rectangle relative to its container.

Syntax

BOOL SetRectInContainer( LPRECT lpRect );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetRectInContainer , COleControl::GetControlSize


COleControl::SetText

Call this member function to set the value of the stock Text or Caption property.

Syntax

void SetText( LPCTSTR pszText );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetText , COleControl::InternalGetText, COleControl::OnTextChanged


COleControl::ThrowError

Call this member function to signal that an error has occurred in an ActiveX control.

Syntax

void ThrowError( SCODE sc, UINT nDescriptionID, UINT nHelpID = -1 );

void ThrowError( SCODE sc, LPCTSTR pszDescription = NULL, UINT nHelpID = 0 );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::FireError, COleControl::DisplayError


COleControl::TransformCoords

Call this member function to transform coordinate values between a container and the control.

Syntax

void TransformCoords( POINTL FAR* lpptlHimetric, POINTF FAR* lpptfContainer, DWORD flags );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::AmbientScaleUnits


COleControl::TranslateColor

Call this member function to convert an OLE_COLOR value to a COLORREF value.

Syntax

COLORREF TranslateColor( OLE_COLOR clrColor, HPALETTE hpal = NULL );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

Remarks

Windows CE only supports the following two of the eight OLE_COLOR types supported by the desktop Windows platforms.

  • 0x00bbggrr
  • 0x800000xx, where xx is the index used by GetSysColor.

MFC for Windows CE does not support the hPal argument. Always pass NULL for this argument.

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::GetForeColor , COleControl::GetBackColor, COLORREF


COleControl::WillAmbientsBeValidDuringLoad

Call this member function to determine whether ambient properties will be available the next time the control is loaded.

Syntax

BOOL WillAmbientsBeValidDuringLoad( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleControl Overview, COleControl Member Functions, Control Classes, COleControl::DoPropExchange , COleControl::GetAmbientProperty


COleControlModule

The COleControlModule class is the base class from which you derive an ActiveX control module object. This class provides member functions for initializing your control module. Each ActiveX control module that uses the Microsoft Foundation classes can only contain one object derived from COleControlModule. This object is constructed when other C++ global objects are constructed. Declare your derived COleControlModule object at the global level.

COleControlModule is derived from CWinApp, and serves the same function in an ActiveX control module that CWinApp serves in a stand-alone application. For more information on using the COleControlModule class, see the CWinApp class.

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

Application Architecture Classes, CWinApp


COleCurrency

The COleCurrency class encapsulates the CURRENCY data type used in Automation. CURRENCY is implemented as an 8-byte, two's-complement integer value scaled by 10,000. This gives a fixed-point number with 15 digits to the left of the decimal point and 4 digits to the right. The CURRENCY data type is extremely useful for calculations involving money, or for any fixed-point calculation where accuracy is important. It is one of the possible types for the VARIANT data type of Automation.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Member Functions, COleCurrency Operators, COleCurrency Data Members, COleCurrency Enumerations, Automation Types, COleVariant, CURRENCY


COleCurrency Member Functions

Construction
COleCurrency Constructs a COleCurrency object.

Attributes
GetStatus | Retrieves the status (validity) of this COleCurrency object.
SetStatus | Sets the status (validity) of this COleCurrency object.

Operations
SetCurrency | Sets the value of this COleCurrency object.
Format | Generates a formatted string representation of a COleCurrency object.
ParseCurrency | Reads a CURRENCY value from a string and sets the value of COleCurrency.

See Also

COleCurrency Overview, COleCurrency Operators, COleCurrency Data Members, COleCurrency Enumerations, Automation Types


COleCurrency::COleCurrency

Use these constructors to construct a COleCurrency object.

The default constructor initializes the new COleCurrency object to zero.

Use the copy constructor to construct a COleCurrency object from an existing COleCurrency object.

Use COleCurrency ( cySrc ) to construct a COleCurrency object from a CURRENCY value.

Use COleCurrency ( varSrc ) to convert a VARIANT structure or COleVariant object to a currency (VT_CY) value. If this conversion is successful, the converted value is copied into the new COleCurrency object. If it is not, the new COleCurrency object is initialized to zero.

Use COleCurrency (nUnits ,nFractionalUnits ) to construct a COleCurrency object initialized to the specified numerical values.

Syntax

COleCurrency( );

COleCurrency( const COleCurrency& curSrc );

COleCurrency( CURRENCY cySrc );

COleCurrency( const VARIANT& varSrc );

COleCurrency( long nUnits, long nFractionalUnits );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Member Functions, Automation Types, COleCurrency::SetCurrency, COleCurrency::operator =, COleCurrency::GetStatus, COleCurrency::m_cur, COleCurrency::m_status, CURRENCY, VARIANT


COleCurrency::Format

Call this member function to create a formatted representation of the currency value. It formats the value using the national language specifications (locale IDs). A currency symbol is not included in the value returned. If the status of this COleCurrency object is null, the return value is an empty string. If the status is invalid, the return string is specified by the string resource IDS_INVALID_CURRENCY.

Syntax

CString Format( DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Member Functions, Automation Types, COleCurrency::ParseCurrency, COleCurrency::GetStatus, CString


COleCurrency::GetStatus

Call this member function to retrieve the status (validity) of a given COleCurrency object. The return value is defined by the COleCurrency::CurrencyStatus enumerated type.

Syntax

COleCurrency::CurrencyStatus GetStatus( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Member Functions, Automation Types, COleCurrency::CurrencyStatus, COleCurrency::m_status, COleCurrency::SetStatus


COleCurrency::ParseCurrency

Call this member function to parse a string to read a currency value. It uses national language specifications (locale IDs) for the meaning of nonnumeric characters in the source string.

Syntax

BOOL ParseCurrency( LPCTSTR lpszCurrency, DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT );
throw( CMemoryException );
throw( COleException );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Member Functions, Automation Types, COleCurrency::Format, COleCurrency::GetStatus, CMemoryException, COleException


COleCurrency::SetCurrency

Call this member function to set the units and fractional part of the COleCurrency object.

Syntax

void SetCurrency( long nUnits, long nFractionalUnits );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Member Functions, Automation Types, COleCurrency::COleCurrency, COleCurrency::operator =, COleCurrency::m_cur


COleCurrency::SetStatus

Call this member function to set the status (validity) of this COleCurrency object. The nStatus parameter value is defined by the COleCurrency::CurrencyStatus enumerated type.

Syntax

void SetStatus( COleCurrency::CurrencyStatus nStatus );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Member Functions, Automation Types, COleCurrency::CurrencyStatus, COleCurrency::GetStatus, COleCurrency::m_status, COleCurrency::operator =, COleCurrency::SetCurrency


COleCurrency Operators

Operators
operator CURRENCY | Convert this COleCurrency value to a CURRENCY type.
operator = | Copy a COleCurrency value.
operator +, -_ | Add and subtract COleCurrency values.
operator +=, -= | Add and subtract a COleCurrency value from this COleCurrency object.
operator *, / | Scale a COleCurrency value by an integer value.
operator *=, /=_ | Scale this COleCurrency value by an integer value.
operator ==, !=, <,>, <=, >= | Compare two COleCurrency values.

Archive/Dump
operator << | Output a COleCurrency value to CArchive or CDumpContext.
operator >> | Input a COleCurrency object from CArchive.

See Also

COleCurrency Overview, COleCurrency Member Functions, COleCurrency Data Members, COleCurrency Enumerations, Automation Types


COleCurrency::operator =

Use these overloaded assignment operators to copy the source currency value into this COleCurrency object.

COleCurrency ( cySrc ) constructs a COleCurrency object from a CURRENCY value.

COleCurrency& operator =( curSrc ) constructs a COleCurrency object from an existing COleCurrency object.

COleCurrency ( varSrc ) Attempts to convert a VARIANT structure or COleVariant object to a currency (VT_CY) value. If this conversion is successful, the converted value is copied into the new COleCurrency object. If it is not, the new COleCurrency object is initialized to zero.

Syntax

const COleCurrency& operator =( CURRENCY cySrc );

const COleCurrency& operator =( const COleCurrency& curSrc );

const COleCurrency& operator =( const VARIANT& varSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, COleCurrency::COleCurrency, COleCurrency::SetCurrency, COleCurrency::GetStatus, CURRENCY, VARIANT


COleCurrency::operator +, -

Use these operators to add and subtract two COleCurrency values to and from each other and to change the sign of a COleCurrency value.

Syntax

COleCurrency operator +( const COleCurrency& cur ) const;

COleCurrency operator -( const COleCurrency& cur ) const;

COleCurrency operator -( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, COleCurrency::operator +=, -=, COleCurrency::GetStatus


COleCurrency::operator +=, -=

Use these operators to add and subtract a COleCurrency value to and from this COleCurrency object.

Syntax

const COleCurrency& operator +=( const COleCurrency& cur );

const COleCurrency& operator -=( const COleCurrency& cur );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, COleCurrency::operator +, -, COleCurrency::GetStatus


COleCurrency::operator *, /

Use these operators to scale a COleCurrency value by an integral value.

Syntax

COleCurrency operator *( long nOperand ) const;

COleCurrency operator /( long nOperand ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, COleCurrency::operator *=, /=, COleCurrency::GetStatus


COleCurrency::operator *=, /=

Use these operators to scale this COleCurrency value by an integral value.

Syntax

const COleCurrency& operator *=( long nOperand );

const COleCurrency& operator /=( long nOperand );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, COleCurrency::operator *, /, COleCurrency::GetStatus


COleCurrency::operator CURRENCY

Use this operator to obtain a CURRENCY structure whose value is copied from this COleCurrency object.

Syntax

operator CURRENCY( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, COleCurrency::m_cur, COleCurrency::SetCurrency, CURRENCY


COleDateTimeSpan::operator ==, !=, <, >, <=, >=

COleCurrency::operator ==, !=, <, >, <=, >=

Use these operators to compare two currency values.

Syntax

BOOL operator ==( const COleCurrency& cur ) const;

BOOL operator !=( const COleCurrency& cur ) const;

BOOL operator <( const COleCurrency& cur ) const;

BOOL operator >( const COleCurrency& cur ) const;

BOOL operator <=( const COleCurrency& cur ) const;

BOOL operator >=( const COleCurrency& cur ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, COleCurrency::GetStatus


COleCurrency::operator <<, >>

Use the COleCurrency insertion (<<) operator for diagnostic dumping and storing to an archive.

Use the extraction (>>) operator for loading from an archive.

Syntax

friend CDumpContext& operator <<( CDumpContext& dc, COleCurrency curSrc );

friend CArchive& operator <<( CArchive& ar, COleCurrency curSrc );

friend CArchive& operator >>( CArchive& ar, COleCurrency& curSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Operators, Automation Types, CDumpContext, CArchive


COleCurrency Data Members

Data Members
m_cur | Contains the underlying CURRENCY value for this COleCurrency object.
m_status | Contains the status of this COleCurrency object.

See Also

COleCurrency Overview, COleCurrency Member Functions, COleCurrency Operators, COleCurrency Enumerations, Automation Types


COleCurrency::m_cur

This data member contains the underlying CURRENCY structure for this COleCurrency object.

CURRENCY m_cur;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Data Members, Automation Types, COleCurrency::COleCurrency, COleCurrency::operator CURRENCY, COleCurrency::SetCurrency, CURRENCY


COleCurrency::m_status

This data member contains the status (validity) of this COleCurrency object. The type of this data member is the enumerated type COleCurrency::CurrencyStatus.

COleCurrency::CurrencyStatus m_status;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleCurrency Overview, COleCurrency Data Members, Automation Types, COleCurrency::CurrencyStatus, COleCurrency::GetStatus, COleCurrency::SetStatus


COleCurrency Enumerations

CurrencyStatus Specifies the values that can be used in the m_status data member to indicate whether the m_cur data member contains a valid value.

COleCurrency Overview, COleCurrency Member Functions, COleCurrency Operators, COleCurrency Data Members, Automation Types


COleCurrency::CurrencyStatus

The CurrencyStatus enumeration specifies the values that can be used in the COleCurrency::m_status data member to indicate whether the COleCurrency::m_cur data member contains a valid value. This enumeration is used with the COleCurrency::GetStatus and COleCurrency::SetStatus functions.

enum CurrencyStatus{
valid = 0,
invalid = 1,
null = 2,
};

At a Glance

Header file: | Afxdisp.h
Platforms: |
Versions: | 2.0 and later

See Also

COleCurrency Overview, COleCurrency Enumerations, Automation Types, COleCurrency::GetStatus, COleCurrency::m_cur, COleCurrency::m_status, COleCurrency::SetStatus


COleDateTime

The COleDateTime class encapsulates the DATE data type used in Automation. COleDateTime value represents an absolute date and time value as a floating point number. The COleDateTime class handles dates from 1 January 1900 to 31 December 9999.

This type is also used to represent date-only or time-only values. By convention, the date 0 (31 December 1899) is used for time-only values. Similarly, the time 0:00 (midnight) is used for date-only values.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

Remarks

MFC for Windows CE does not support the Format member function of the COleDateTime class.

See Also

COleDateTime Member Functions, COleDateTime Operators, COleDateTime Data Members, COleDateTime Enumerations, Automation Types, COleVariant


COleDateTime Member Functions

Construction
COleDateTime | Constructs a COleDateTime object.
GetCurrentTime | Creates a COleDateTime object that represents the current time. This is a static member function.

Attributes
GetStatus | Retrieves the status (validity) of this COleDateTime object.
SetStatus | Sets the status (validity) of this COleDateTime object.
GetYear | Returns the year this COleDateTime object represents.
GetMonth | Returns the month this COleDateTime object represents (1 – 12).
GetDay | Returns the day this COleDateTime object represents (1 – 31).
GetHour | Returns the hour this COleDateTime object represents (0 – 23).
GetMinute | Returns the minute this COleDateTime object represents (0 – 59).
GetSecond | Returns the second this COleDateTime object represents (0 – 59).
GetDayOfWeek | Returns the day of the week this COleDateTime object represents (Sunday = 1).
GetDayOfYear | Returns the day of the year this COleDateTime object represents (Jan 1 = 1).

Operations
SetDateTime | Sets the value of this COleDateTime object to the specified date/time value.
SetDate | Sets the value of this COleDateTime object to the specified date-only value.
SetTime | Sets the value of this COleDateTime object to the specified time-only value.
ParseDateTime | Reads a date/time value from a string and sets the value of COleDateTime.

See Also

COleDateTime Overview, COleDateTime Operators, COleDateTime Data Members, COleDateTime Enumerations, Automation Types


COleDateTime::COleDateTime

Use these constructors to construct a COleDateTime object.

The default constructor initializes it to zero (midnight, 30 December 1899).

Use the copy constructor to construct a COleDateTime object from an existing COleDateTime object.

Use COleDateTime( varSrc ) to convert a VARIANT structure or COleVariant object to a date/time (VT_DATE) value. If this conversion is successful, the converted value is copied into the new COleDateTime object. If not, it behaves like the default constructor.

Use COleDateTime( nYear, nMonth, nDay, nHour, nMin, nSec ) to construct a COleDateTime object from the specified numerical values.

Use the other constructors to construct a COleDateTime object from a DATE, a time_t, a SYSTEMTIME, a FILETIME, or MS-DOS date and time values, respectively

Syntax

COleDateTime( );

COleDateTime( const COleDateTime& dateSrc );

COleDateTime( const VARIANT& varSrc );

COleDateTime( DATE dtSrc );

COleDateTime( time_t timeSrc );

COleDateTime( const SYSTEMTIME& systimeSrc );

COleDateTime( const FILETIME& filetimeSrc );

COleDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec );

COleDateTime( WORD wDosDate, WORD wDosTime );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::SetDate, COleDateTime::SetDateTime, COleDateTime::SetTime, COleDateTime::GetStatus, COleDateTime::operator =, COleDateTime::m_dt, COleDateTime::m_status, COleVariant, DATE, FILETIME, SYSTEMTIME, VARIANT


COleDateTime::GetCurrentTime

Call this member function to create a COleDateTime object that represents the current time. This is a static member function.

Syntax

static COleDateTime PASCAL GetCurrentTime( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types


COleDateTime::GetDay

Call this member function to retrieve the day portion of the date this COleDateTime object represents (1 – 31).

Syntax

int GetDay( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::GetDayOfWeek

Call this member function to retrieve the day of the week this COleDateTime object represents (Sunday = 1).

Syntax

int GetDayOfWeek( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::GetDayOfYear

Call this member function to retrieve the day of the year this COleDateTime object represents (Jan 1 = 1).

Syntax

int GetDayOfYear( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, , COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::GetHour

Call this member function to retrieve the hour portion of the time this COleDateTime object represents (0 – 23).

Syntax

int GetHour( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::GetMinute

Call this member function to retrieve the minute portion of the time this COleDateTime object represents (0 – 59).

Syntax

int GetMinute( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::GetMonth

Call this member function to retrieve the month portion of the date this COleDateTime object represents (1 – 12).

Syntax

int GetMonth( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::GetSecond

Call this member function to retrieve the second portion of the time this COleDateTime object represents (0 – 59).

Syntax

int GetSecond( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::GetStatus

Call this member function to retrieve the status (validity) of this COleDateTime object, using a value from the COleDateTime::DateTimeStatus enumeration.

Syntax

COleDateTime::DateTimeStatus GetStatus( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::SetStatus, COleDateTime::DateTimeStatus, COleDateTime::m_status


COleDateTime::GetYear

Call this member function to retrieve the year portion of the date this COleDateTime object represents.

Syntax

int GetYear( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =


COleDateTime::ParseDateTime

Call this member function to read a date/time value from a string and sets the value of COleDateTime.

Syntax

BOOL ParseDateTime( LPCTSTR lpszDate, DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT );
throw( CMemoryException );
throw( COleException );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types,COleDateTime::GetStatus


COleDateTime::SetDate

Call this member function to set the value of this COleDateTime object to the specified date-only value.

Syntax

int SetDate( int nYear, int nMonth, int nDay );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =, COleDateTime::m_dt


COleDateTime::SetDateTime

Call this member function to set the value of this COleDateTime object to the specified date/time value.

Syntax

int SetDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::COleDateTime, COleDateTime::GetStatus, COleDateTime::SetDate, COleDateTime::SetTime, COleDateTime::operator =, COleDateTime::m_dt


COleDateTime::SetStatus

Call this member function to set the status (validity) of this COleDateTime object, using a value from the COleDateTime::DateTimeStatus enumeration.

Syntax

void SetStatus( COleDateTime::DateTimeStatus nStatus );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::GetStatus, COleDateTime::SetDateTime, COleDateTime::operator =, COleDateTime::DateTimeStatus, COleDateTime::m_dt


COleDateTime::SetTime

Call this member function to set the value of this COleDateTime object to the specified time-only value.

Syntax

int SetTime( int nHour, int nMin, int nSec );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Member Functions, Automation Types, COleDateTime::GetHour, COleDateTime::GetMinute, COleDateTime::GetSecond, COleDateTime::operator =


COleDateTime Operators

Operators
operator DATE | Converts a COleDateTime value into a DATE.
operator DATE* | Converts a COleDateTime value into a DATE*.
operator = | Copies a COleDateTime value.
operator +, - | Add and subtract COleDateTime values.
operator +=, -= | Add and subtract a COleDateTime value from this COleDateTime object.
operator ==, !=, <,>, <=, >= | Compares two COleDateTime values.

Archive/Dump
operator << | Outputs a COleDateTime value to CArchive or CDumpContext.
operator >> | Inputs a COleDateTime object from CArchive.

See Also

COleDateTime Overview, COleDateTime Member Functions, COleDateTime Data Members, COleDateTime Enumerations, Automation Types


COleDateTime::operator DATE

Use this operator to convert a COleDateTime value into a DATE.

Syntax

operator DATE( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Operators, Automation Types, COleDateTime::m_dt, DATE


COleDateTime::operator =

Use one of the assignment operators to assign a value to a COleDateTime object.

Syntax

const COleDateTime& operator =( const COleDateTime& dateSrc );

const COleDateTime& operator =( const VARIANT& varSrc );

const COleDateTime& operator =( DATE dtSrc );

const COleDateTime& operator =( const time_t& timeSrc );

const COleDateTime& operator =( const SYSTEMTIME& systimeSrc );

const COleDateTime& operator =( const FILETIME& filetimeSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Operators, Automation Types, COleDateTime::COleDateTime, COleDateTime::SetDateTime, COleDateTime::GetStatus, , DATE, FILETIME, SYSTEMTIME, VARIANT


COleDateTime::operator +, -

Use these operators to add and subtract COleDateTime values.

Syntax

COleDateTime operator +( const COleDateTimeSpan& dateSpan ) const;

COleDateTime operator -( const COleDateTimeSpan& dateSpan ) const;

COleDateTimeSpan operator -( const COleDateTime& date ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Operators, Automation Types, COleDateTime::operator +=, -=,, COleDateTime::GetStatus, COleDateTimeSpan


COleDateTime::operator +=, -=

Use these operators to add and subtract a COleDateTime value from this COleDateTime object.

Syntax

const COleDateTime& operator +=( const COleDateTimeSpan dateSpan );

const COleDateTime& operator -=( const COleDateTimeSpan dateSpan );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Operators, Automation Types, COleDateTime::operator +, -, COleDateTime::GetStatus


COleDateTime::operator ==, !=, <, >, <=, >=

Use this operator to compare two COleDateTime values.

Syntax

BOOL operator ==( const COleDateTime& date ) const;

BOOL operator !=( const COleDateTime& date ) const;

BOOL operator <( const COleDateTime& date ) const;

BOOL operator >( const COleDateTime& date ) const;

BOOL operator <=( const COleDateTime& date ) const;

BOOL operator >=( const COleDateTime& date ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Operators, Automation Types, COleDateTime::GetStatus


COleDateTime::operator <<, >>

Use the COleDateTime insertion (<<) operator for diagnostic dumping and storing to an archive.

Use the extraction (>>) operator for loading from an archive.

Syntax

friend CDumpContext& AFXAPI operator <<( CDumpContext& dc, COleDateTime timeSrc );

friend CArchive& AFXAPI operator <<( CArchive& ar, COleDateTime dateSrc );

friend CArchive& AFXAPI operator >>( CArchive& ar, COleDateTime& dateSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Operators, Automation Types, CDumpContext , CArchive


COleDateTime Data Members

Data Members
m_dt | Contains the underlying DATE for this COleDateTime object.
m_status | Contains the status of this COleDateTime object.

See Also

COleDateTime Overview, COleDateTime Member Functions, COleDateTime Operators, COleDateTime Enumerations, Automation Types


COleDateTime::m_dt

This data member contains the underlying DATE structure for this COleDateTime object.

DATE m_dt;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Data Members, Automation Types, COleDateTime::SetDate, COleDateTime::SetDateTime, COleDateTime::SetTime, COleDateTime::operator DATE, DATE


COleDateTime::m_status

This data member contains the status of this COleDateTime object, using one of the COleDateTime::DateTimeStatus enumerated values.

COleDateTime::DateTimeStatus m_status;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTime Overview, COleDateTime Data Members, Automation Types, COleDateTime::DateTimeStatus, COleDateTime::GetStatus, COleDateTime::SetStatus


COleDateTime Enumerations

DateTimeStatus Specifies the values that can be used in the m_status data member to indicate whether the m_dt data member contains a valid value.

COleDateTime Overview, COleDateTime Member Functions, COleDateTime Operators, COleDateTime Data Members, Automation Types


COleDateTime::DateTimeStatus

The DateTimeStatus enumeration specifies the values that can be used in the COleDateTime::m_status data member to indicate whether the COleDateTime::m_dt data member contains a valid value. This enumeration is used with the COleDateTime::GetStatus and COleDateTime::SetStatus functions.

enum DateTimeStatus
valid =0,
invalid = 1,
null = 2
}

At a Glance

Header file: | Afxdisp.h
Platforms: |
Versions: | 2.0 and later

See Also

COleDateTime Overview, COleDateTime Enumerations, Automation Types, COleDateTime::GetStatus, COleDateTime::SetStatus, COleDateTime::m_dt, COleDateTime::m_status


COleDateTimeSpan

The COleDateTimeSpan class represents a relative time, or time span. A COleDateTimeSpan keeps time in days. This class is used with its companion class COleDateTime.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

Remarks

MFC for Windows CE does not support the Format member function of the COleDateTimeSpan class.

See Also

COleDateTimeSpan Member Functions, COleDateTimeSpan Operators, COleDateTimeSpan Data Members, COleDateTimeSpan Enumerations, Automation Types, COleDateTime


COleDateTimeSpan Member Functions

Construction
COleDateTimeSpan Constructs a COleDateTimeSpan object.

Attributes
GetStatus | Retrieves the status (validity) of this COleDateTimeSpan object.
SetStatus | Sets the status (validity) of this COleDateTimeSpan object.
GetDays | Returns the day portion of the span this COleDateTimeSpan object represents.
GetHours | Returns the hour portion of the span this COleDateTimeSpan object represents.
GetMinutes | Returns the minute portion of the span this COleDateTimeSpan object represents.
GetSeconds | Returns the second portion of the span this COleDateTimeSpan object represents.
GetTotalDays | Returns the number of days this COleDateTimeSpan object represents.
GetTotalHours | Returns the number of hours this COleDateTimeSpan object represents.
GetTotalMinutes | Returns the number of minutes this COleDateTimeSpan object represents.
GetTotalSeconds | Returns the number of seconds this COleDateTimeSpan object represents.

Operations
SetDateTimeSpan Sets the value of this COleDateTimeSpan object.

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Operators, COleDateTimeSpan Data Members, COleDateTimeSpan Enumerations, Automation Types


COleDateTimeSpan::COleDateTimeSpan

Use these constructors to construct a COleDateTimeSpan object.

The default constructor initializes it to zero.

Use the copy constructor to construct a COleDateTimeSpan object from an existing COleDateTimeSpan object.

Use COleDateTimeSpan( dblSpanSrc ) to construct a COleDateTimeSpan object from a floating point value.

Use COleDateTimeSpan( lDays, nHours, nMins, nSecs ) to construct a COleDateTimeSpan object initialized to the specified numerical values.

Syntax

COleDateTimeSpan( );

COleDateTimeSpan( const COleDateTimeSpan& dateSpanSrc );

COleDateTimeSpan( double dblSpanSrc );

COleDateTimeSpan( long lDays, int nHours, int nMins, int nSecs );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::GetStatus, COleDateTimeSpan::operator =, COleDateTimeSpan::m_span, COleDateTimeSpan::m_status


COleDateTimeSpan::GetDays

Call this member function to retrieve the day portion of the span this COleDateTimeSpan object represents.

Syntax

long GetDays( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan


COleDateTimeSpan::GetHours

Call this member function to retrieve the hour portion of the span this COleDateTimeSpan object represents.

Syntax

long GetHours( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan


COleDateTimeSpan::GetMinutes

Call this member function to retrieve the minute portion of the span this COleDateTimeSpan object represents.

Syntax

long GetMinutes( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan


COleDateTimeSpan::GetSeconds

Call this member function to retrieve the second portion of the span this COleDateTimeSpan object represents.

Syntax

long GetSeconds( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan


COleDateTimeSpan::GetStatus

Call this member function to retrieve the status (validity) of this COleDateTimeSpan object, using a value from the COleDateTimeSpan::DateTimeSpanStatus enumeration.

Syntax

COleDateTimeSpan::DateTimeSpanStatus GetStatus( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::DateTimeSpanStatus, COleDateTimeSpan::SetStatus , COleDateTimeSpan::m_status


COleDateTimeSpan::GetTotalDays

Call this member function to retrieve the number of days this COleDateTimeSpan object represents.

Syntax

double GetTotalDays( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan, COleDateTimeSpan::operator double


COleDateTimeSpan::GetTotalHours

Call this member function to retrieve the number of hours this COleDateTimeSpan object represents.

Syntax

double GetTotalHours( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan


COleDateTimeSpan::GetTotalMinutes

Call this member function to retrieve the number of minutes this COleDateTimeSpan object represents

Syntax

double GetTotalMinutes( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan


COleDateTimeSpan::GetTotalSeconds

Call this member function to retrieve the number of seconds this COleDateTimeSpan object represents.

Syntax

double GetTotalSeconds( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::SetDateTimeSpan


COleDateTimeSpan::SetDateTimeSpan

Call this member function to set the value of this COleDateTimeSpan object.

Syntax

void SetDateTimeSpan( long lDays, int nHours, int nMins, int nSecs );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::GetStatus , COleDateTimeSpan::m_span


COleDateTimeSpan::SetStatus

Call this member function to set the status (validity) of this COleDateTimeSpan object, using a value from the COleDateTimeSpan::DateTimeSpanStatus enumeration.

Syntax

void SetStatus( COleDateTimeSpan::DateTimeSpanStatus nStatus );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, Automation Types, COleDateTimeSpan::DateTimeSpanStatus, COleDateTimeSpan::GetStatus, COleDateTimeSpan::m_status


COleDateTimeSpan Operators

Operators
operator double | Converts this COleDateTimeSpan value to a double.
operator = | Copies a COleDateTimeSpan value.
operator +, - | Add and subtract COleDateTimeSpan values.
operator +=, -= | Add and subtract a COleDateTimeSpan value from this COleDateTimeSpan object.
operator ==, !=, <,>, <=, >= | Compares two COleDateTimeSpan values.

Archive/Dump
operator << | Outputs a COleDateTimeSpan value to CArchive or CDumpContext.
operator >> | Inputs a COleDateTimeSpan object from CArchive.

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, COleDateTimeSpan Data Members, COleDateTimeSpan Enumerations, Automation Types


COleDateTimeSpan::operator =

Use this operator to copy a COleDateTimeSpan value.

const COleDateTimeSpan& operator=( double dblSpanSrc );

const COleDateTimeSpan& operator=( const COleDateTimeSpan& dateSpanSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Operators, Automation Types, COleDateTimeSpan::COleDateTimeSpan


COleDateTimeSpan::operator +, -

Use these operators to add and subtract COleDateTimeSpan values.

COleDateTimeSpan operator+( const COleDateTimeSpan& dateSpan ) const;

COleDateTimeSpan operator-( const COleDateTimeSpan& dateSpan ) const;

COleDateTimeSpan operator-( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Operators, Automation Types, COleDateTimeSpan::operator +=, -=


COleDateTimeSpan::operator +=, -=

Use these operators to add and subtract a COleDateTimeSpan value from this COleDateTimeSpan object.

const COleDateTimeSpan& operator+=( const COleDateTimeSpan dateSpan );

const COleDateTimeSpan& operator-=( const COleDateTimeSpan dateSpan );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Operators, Automation Types, COleDateTimeSpan::operator +, -


COleDateTimeSpan::operator double

Use this operator to convert this COleDateTimeSpan value to a double.

operator double( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Operators, Automation Types, COleDateTimeSpan::GetTotalDays, COleDateTimeSpan::SetDateTimeSpan, COleDateTimeSpan::m_span


COleDateTimeSpan::operator ==, !=, <, >, <=, >=

Use these operators to compare two COleDateTimeSpan values.

Syntax

BOOL operator==( const COleDateTimeSpan& dateSpan ) const;

BOOL operator!=( const COleDateTimeSpan& dateSpan ) const;

BOOL operator<( const COleDateTimeSpan& dateSpan ) const;

BOOL operator>( const COleDateTimeSpan& dateSpan ) const;

BOOL operator<=( const COleDateTimeSpan& dateSpan ) const;

BOOL operator>=( const COleDateTimeSpan& dateSpan ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Operators, Automation Types,


COleDateTimeSpan::operator <<, >>

Use the COleDateTimeSpan insertion (<<) operator for diagnostic dumping and storing to an archive.

Use the extraction (>>) operator for loading from an archive.

friend CDumpContext& AFXAPI operator<<( CDumpContext& dc, COleDateTimeSpan dateSpan );

friend CArchive& AFXAPI operator<<( CArchive& ar, COleDateTimeSpan dateSpan );

friend CArchive& AFXAPI operator>>( CArchive& ar, COleDateTimeSpan& dateSpan );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Operators, Automation Types, CDumpContext, CArchive


COleDateTimeSpan Data Members

Data Members
m_span | Contains the underlying double value this COleDateTimeSpan object represents.
m_status | Contains the status of this COleDateTimeSpan object.

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, COleDateTimeSpan Operators, COleDateTimeSpan Enumerations, Automation Types


COleDateTimeSpan::m_span

This data member contains the underlying double value represented by this COleDateTimeSpan object. This value expresses the date/time-span in days.

double m_span;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Data Members, Automation Types, COleDateTimeSpan::COleDateTimeSpan, COleDateTimeSpan::SetDateTimeSpan, COleDateTimeSpan::operator double


COleDateTimeSpan::m_status

This data member contains the status of this COleDateTimeSpan object, using one of the COleDateTimeSpan::DateTimeSpanStatus enumerated values.

COleDateTimeSpan::DateTimeSpanStatus m_status;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Data Members, Automation Types, COleDateTimeSpan::DateTimeSpanStatus, COleDateTimeSpan::GetStatus , COleDateTimeSpan::SetStatus


COleDateTimeSpan Enumerations

DateTimeSpanStatus Specifies the values that can be used in the m_status data member to indicate whether the m_span data member contains a valid value.

COleDateTimeSpan Overview, COleDateTimeSpan Member Functions, COleDateTimeSpan Operators, COleDateTimeSpan Data Members, Automation Types


COleDateTimeSpan::DateTimeSpanStatus

The DateTimeSpanStatus enumeration specifies the values that can be used in the COleDateTimeSpan::m_status data member to indicate whether the COleDateTimeSpan::m_span data member contains a valid value. This enumeration is used with the COleDateTimeSpan::GetStatus and COleDateTimeSpan::SetStatus functions.

enum DateTimeSpanStatus
valid =0,
invalid = 1,
null = 2
}

At a Glance

Header file: | Afxdisp.h
Platforms: |
Versions: | 2.0 and later

See Also

COleDateTimeSpan Overview, COleDateTimeSpan Enumerations, Automation Types, COleDateTimeSpan::GetStatus, COleDateTimeSpan::SetStatus, COleDateTimeSpan::m_span, COleDateTimeSpan::m_status


COleDispatchDriver

The COleDispatchDriver class implements the client side of Automation. Dispatch interfaces provide access to an object's methods and properties.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Member Functions, COleDispatchDriver Data Members, Support Classes, CCmdTarget


COleDispatchDriver Member Functions

Construction
COleDispatchDriver Constructs a COleDispatchDriver object.

Operations
CreateDispatch | Creates an IDispatch connection and attaches it to the COleDispatchDriver object.
AttachDispatch | Attaches an IDispatch connection to the COleDispatchDriver object.
DetachDispatch | Detaches an IDispatch connection, without releasing it.
ReleaseDispatch | Releases an IDispatch connection.
InvokeHelper | Helper for calling automation methods.
SetProperty | Sets an automation property.
GetProperty | Gets an automation property.

See Also

COleDispatchDriver Overview, COleDispatchDriver Data Members, Support Classes


COleDispatchDriver::AttachDispatch

Call this member function to attach an IDispatch pointer to the COleDispatchDriver object and release any IDispatch pointer that was already attached to it.

Syntax

void AttachDispatch( LPDISPATCH lpDispatch, BOOL bAutoRelease = TRUE );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, IDispatch


COleDispatchDriver::COleDispatchDriver

Use this constructor to construct a COleDispatchDriver object.

The default constructor creates a COleDispatchDriver object but does not connect the IDispatch interface. Before using COleDispatchDriver object, you should connect an IDispatch interface to it by using either COleDispatchDriver::CreateDispatch or COleDispatchDriver::AttachDispatch.

The form COleDispatchDriver(LPDISPATCH lpDispatch, BOOL bAutoRelease = TRUE) connects the IDispatch interface.

The third form is the copy constructor.

Syntax

COleDispatchDriver( );

COleDispatchDriver( LPDISPATCH lpDispatch, BOOL bAutoRelease = TRUE );

COleDispatchDriver( const COleDispatchDriver& dispatchSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, COleDispatchDriver::CreateDispatch, COleDispatchDriver::AttachDispatch, IDispatch


COleDispatchDriver::CreateDispatch

Call this member function to create an IDispatch interface object and attach it to the COleDispatchDriver object.

Syntax

BOOL CreateDispatch( REFCLSID clsid, COleException* pError = NULL );

BOOL CreateDispatch( LPCTSTR lpszProgID, COleException* pError = NULL );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, COleDispatchDriver::AttachDispatch, COleDispatchDriver::DetachDispatch, COleDispatchDriver::ReleaseDispatch, COleException, COleDispatchDriver::m_lpDispatch, IDispatch


COleDispatchDriver::DetachDispatch

Call this member function to detach the current IDispatch connection from this object. The IDispatch is not released.

Syntax

LPDISPATCH DetachDispatch( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, COleDispatchDriver::AttachDispatch, COleDispatchDriver::CreateDispatch, COleDispatchDriver::ReleaseDispatch, IDispatch


COleDispatchDriver::GetProperty

Call this member function to retrieve the object property specified by dwDispID.

Syntax

void GetProperty( DISPID dwDispID, VARTYPE vtProp, void* pvProp ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, COleDispatchDriver::InvokeHelper, COleDispatchDriver::SetProperty, DISPID, VARTYPE


COleDispatchDriver::InvokeHelper

Use this member function to call the object method or property specified by dwDispID, in the context specified by wFlags. The pbParamInfo parameter specifies the types of the parameters passed to the method or property. The variable list of arguments is represented by ... in the syntax declaration.

Syntax

void InvokeHelper( DISPID dwDispID, WORD wFlags, VARTYPE vtRet, void* pvRet, const BYTE FAR* pbParamInfo, ... );
throw( COleException );
throw( COleDispatchException );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, COleDispatchDriver::GetProperty, COleDispatchDriver::SetProperty, COleException, COleDispatchException


COleDispatchDriver::ReleaseDispatch

Call this member function to release the IDispatch connection. If auto release has been set for this connection, this function calls IDispatch::Release before releasing the interface.

Syntax

void ReleaseDispatch( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, COleDispatchDriver::AttachDispatch, COleDispatchDriver::CreateDispatch, COleDispatchDriver::DetachDispatch, IDispatch, COleDispatchDriver::m_lpDispatch, COleDispatchDriver::m_bAutoRelease


COleDispatchDriver::SetProperty

Call this member function to set the object property specified by dwDispID.

Syntax

void SetProperty(DISPID dwDispID, VARTYPE vtProp, ... );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes, COleDispatchDriver::GetProperty, COleDispatchDriver::InvokeHelper, DISPID, VARTYPE


COleDispatchDriver Data Members

DataMembers
m_bAutoRelease | Specifies whether to release the IDispatch interface during ReleaseDispatch or object destruction.
m_lpDispatch | The pointer to the IDispatch interface attached to this COleDispatchDriver.

See Also

COleDispatchDriver Overview, COleDispatchDriver Member Functions, Support Classes


COleDispatchDriver::m_bAutoRelease

This data member contains a flag that specifies whether the COM object accessed by m_lpDispatch will be automatically released when either ReleaseDispatch is called or this COleDispatchDriver object is destroyed.

BOOL m_bAutoRelease

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Data Members, Support Classes, COleDispatchDriver::AttachDispatch, COleDispatchDriver::ReleaseDispatch, COleDispatchDriver::m_lpDispatch


COleDispatchDriver::m_lpDispatch

This data member contains a pointer to the IDispatch interface attached to this COleDispatchDriver.

LPDISPATCH m_lpDispatch

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchDriver Overview, COleDispatchDriver Data Members, Support Classes, COleDispatchDriver::AttachDispatch, COleDispatchDriver::CreateDispatch, COleDispatchDriver::DetachDispatch, COleDispatchDriver::ReleaseDispatch


COleDispatchException

The COleDispatchException class handles exceptions specific to the COM IDispatch interface, which is a key part of Automation. Like the other exception classes derived from the CException base class, COleDispatchException can be used with the THROW, THROW_LAST, TRY, CATCH, AND_CATCH, and END_CATCH macros.

Call AfxThrowOleDispatchException to create and throw a COleDispatchException object.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchException Data Members, Exception Classes, COleDispatchDriver, COleException, AfxThrowOleDispatchException


COleDispatchException Data Members

DataMembers
m_wCode | IDispatch-specific error code.
m_strDescription | Verbal error description.
m_dwHelpContext | Help context for error.
m_strHelpFile | Help file to use with m_dwHelpContext.
m_strSource | Application that generated the exception.

See Also

COleDispatchException Overview, Exception Classes


COleDispatchException::m_dwHelpContext

This data member identifies a help context in your application's help (.HLP) file. This member is set by the function AfxThrowOleDispatchException when an exception is thrown.

DWORD m_dwHelpContext;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchException Overview, COleDispatchException Data Members, Exception Classes, COleDispatchException::m_strDescription, COleDispatchException::m_strHelpFile, COleDispatchException::m_wCode, AfxThrowOleDispatchException


COleDispatchException::m_strDescription

This data member contains a verbal error description. This member is set by the function AfxThrowOleDispatchException when an exception is thrown.

CString m_strDescription;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchException Overview, COleDispatchException Data Members, Exception Classes, COleDispatchException::m_dwHelpContext, COleDispatchException::m_wCode, AfxThrowOleDispatchException


COleDispatchException::m_strHelpFile

The framework fills in this data member with the name of the application's help file.

CString m_strHelpFile;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchException Overview, COleDispatchException Data Members, Exception Classes, CString, AfxThrowOleDispatchException


COleDispatchException::m_strSource

The framework fills in this data member with the name of the application that generated the exception.

CString m_strSource;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchException Overview, COleDispatchException Data Members, Exception Classes, CString, AfxThrowOleDispatchException


COleDispatchException::m_wCode

This data member contains an error code specific to your application. This member is set by the function AfxThrowOleDispatchException when an exception is thrown.

WORD m_wCode;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleDispatchException Overview, COleDispatchException Data Members, Exception Classes, COleDispatchException::m_strDescription, COleDispatchException::m_dwHelpContext, AfxThrowOleDispatchException


COleException

A COleException object represents an exception condition related to an ActiveX or Automation operation. The COleException class includes a public data member that holds the status code indicating the reason for the exception. Generally, you should not create a COleException object directly; instead, you should call AfxThrowOleException.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleException Member Functions, COleException Data Members, Exception Classes, AfxThrowOleException


COleException Member Functions

Operations
Process Translates a caught exception into an OLE return code (SCODE).

See Also

COleException Overview, COleException Data Members, Exception Classes


COleException::Process

Call this member function to translate a caught exception into a COM status code (SCODE).

Syntax

static SCODE PASCAL Process( const CException* pAnyException );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleException Overview, COleException Member Functions, Exception Classes, CException


COleException Data Members

DataMembers
m_sc Contains the status code that indicates the reason for the exception.

See Also

COleException Overview, COleException Member Functions, Exception Classes


COleException::m_sc

This data member holds the COM status code (SCODE) that indicates the reason for the exception. This variable's value is set by AfxThrowOleException.

SCODE m_sc;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleException Overview, COleException Data Members, Exception Classes, AfxThrowOleException


COleObjectFactory

The COleObjectFactory class implements the COM class factory, which creates ActiveX controls and automation objects.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

Remarks

MFC for Windows CE doesn't support the Revoke and RevokeAll member functions of the COleObjectFactory class.

See Also

COleObjectFactory Member Functions, Application Architecture Classes


COleObjectFactory Member Functions

Construction
COleObjectFactory Constructs a COleObjectFactory object.

Attributes
GetClassID | Returns the COM class ID of the objects this factory creates.
IsRegistered | Indicates whether the object factory is registered with the system DLLs.

Operations
Register | Registers this object factory with the system DLLs.
RegisterAll | Registers all of the application's object factories with system DLLs.
UpdateRegistryAll | Registers all of the application's object factories with the system registry.

Overridables
GetLicenseKey | Requests a unique key from the control's DLL.
OnCreateObject | Called by the framework to create a new object of this factory's type.
UpdateRegistry | Registers this object factory with the system registry.
VerifyLicenseKey | Verifies that the key embedded in the control matches the key embedded in the container.
VerifyUserLicense | Verifies that the control is licensed for design-time use.

See Also

COleObjectFactory Overview, Application Architecture Classes


COleObjectFactory::COleObjectFactory

Call this member function to construct a COleObjectFactory object, initialize it as an unregistered object factory, and add it to the list of factories. You must register it before you can use it.

Syntax

COleObjectFactory( REFCLSID clsid, CRuntimeClass* pRuntimeClass, BOOL bMultiInstance, LPCTSTR lpszProgID );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::Register, CRuntimeClass


COleObjectFactory::GetClassID

Call this member function to retrieve a reference to the COM class ID this factory represents.

Syntax

REFCLSID GetClassID( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::COleObjectFactory


COleObjectFactory::GetLicenseKey

Call this member function to retrieve the unique license key from the control's DLL and store it in the BSTR pointed to by pbstrKey.

Syntax

virtual BOOL GetLicenseKey( DWORD dwReserved, BSTR *pbstrKey );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::VerifyUserLicense, COleObjectFactory::VerifyLicenseKey


COleObjectFactory::IsRegistered

Call this member function to determine whether the factory is registered with the system DLLs.

Syntax

BOOL IsRegistered( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Architecture Classes, COleObjectFactory::Register


COleObjectFactory::OnCreateObject

This member function is called by the framework to create a new object. Override this function if you want to create the object from something other than the CRuntimeClass passed to the constructor.

Syntax

virtual CCmdTarget* OnCreateObject( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::COleObjectFactory, CRuntimeClass


COleObjectFactory::Register

Call this member function to register the object factory with the system DLLs. This function is usually called by CWinApp::InitInstance when the application is launched.

Syntax

BOOL Register( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::RegisterAll, CWinApp::InitInstance


COleObjectFactory::RegisterAll

Call this member function to register all of the application's object factories with the system DLLs. This function is usually called by CWinApp::InitInstance when the application is launched.

Syntax

static BOOL PASCAL RegisterAll( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::Register, CWinApp::InitInstance


COleObjectFactory::UpdateRegistry

Call this member function to register this object factory with the system registry. The first version of this function is usually called by CWinApp::InitInstance when the application is launched.

The virtual version of the function registers the control class with the system registry if bRegister is TRUE. Otherwise, it unregisters the class. This version is overridable.

Syntax

void UpdateRegistry( LPCTSTR lpszProgID = NULL );

virtual void UpdateRegistry( BOOL bRegister ) = 0;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::Register, COleObjectFactory::UpdateRegistryAll, CWinApp::InitInstance


COleObjectFactory::UpdateRegistryAll

Call this member function to register all of the application's object factories with the system registry. This function is usually called by CWinApp::InitInstance when the application is launched.

Syntax

static void PASCAL UpdateRegistryAll( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::Register, COleObjectFactory::UpdateRegistry, CWinApp::InitInstance


COleObjectFactory::VerifyLicenseKey

Call this member function to verify that the container is licensed to use the control.

Syntax

virtual BOOL VerifyLicenseKey( BSTR bstrKey );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::GetLicenseKey, COleObjectFactory::VerifyUserLicense


COleObjectFactory::VerifyUserLicense

Call this member function to verify the design-time license for the control.

Syntax

virtual BOOL VerifyUserLicense( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COleObjectFactory Overview, COleObjectFactory Member Functions, Application Architecture Classes, COleObjectFactory::GetLicenseKey, COleObjectFactory::VerifyLicenseKey


COlePropertyPage

The COlePropertyPage class is used to display the properties of a custom control in a graphical interface, similar to a dialog box. For instance, a property page may include an edit control that allows the user to view and modify the control's caption property.

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Member Functions, Dialog Box Classes, CDialog


COlePropertyPage Member Functions

Construction
COlePropertyPage Constructs a COlePropertyPage object.

Operations
GetControlStatus | Indicates whether the user has modified the value in the control.
GetObjectArray | Returns the array of objects being edited by the property page.
GetPageSite | Returns a pointer to the property page's IPropertyPageSite interface.
IgnoreApply | Determines which controls do not enable the Apply button.
IsModified | Indicates whether the user has modified the property page.
SetControlStatus | Sets a flag indicating whether the user has modified the value in the control.
SetDialogResource | Sets the property page's dialog resource.
SetHelpInfo | Sets the property page's brief help text, the name of its help file, and its help context.
SetModifiedFlag | Sets a flag indicating whether the user has modified the property page.
SetPageName | Sets the property page's name (caption).

Overridables
OnEditProperty | Called by the framework when the user edits a property.
OnHelp | Called by the framework when the user invokes help.
OnInitDialog | Called by the framework when the property page is initialized.
OnObjectsChanged | Called by the framework when another control, with new properties, is chosen.
OnSetPageSite | Called by the framework when the property frame provides the page's site.

See Also

COlePropertyPage Overview, Dialog Box Classes


COlePropertyPage::COlePropertyPage

Call this member function to construct a property page object. When you subclass COlePropertyPage, your subclass's constructor should call the COlePropertyPage constructor to identify the dialog-template resource on which the property page is based and the string resource containing its caption.

Syntax

COlePropertyPage( UINT idDlg, UINT idCaption );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes


COlePropertyPage::GetControlStatus

Call this member function to determine whether the user has modified the value of the property page control with the specified resource ID.

Syntax

BOOL GetControlStatus( UINT nID );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::SetControlStatus


COlePropertyPage::GetObjectArray

Call this member function to retrieve a pointer to the array of IDispatch interface pointers of the objects being edited by the page. It sets the pnObjects parameter to the number of elements in the returned array.

Syntax

LPDISPATCH FAR* GetObjectArray( ULONG FAR* pnObjects );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes


COlePropertyPage::GetPageSite

Call this member function to retrieve a pointer to the IPropertyPageSite interface on the property page's page site. The control's container provides a property frame to display the control's property pages, and the property frame provides a page site for each page.

Syntax

LPPROPERTYPAGESITE GetPageSite( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::OnSetPageSite


COlePropertyPage::IgnoreApply

Call this member function to specify that the Apply button should not be enabled when the property page's values change.

Syntax

void IgnoreApply( UINT nID );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::GetControlStatus


COlePropertyPage::IsModified

Call this member function to determine whether the user has changed any values on the property page.

Syntax

BOOL IsModified( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::SetModifiedFlag


COlePropertyPage::OnEditProperty

The framework calls this member function when a property is about to be edited. You can override it to set the focus to the appropriate control on the page. The default implementation does nothing and returns FALSE.

Syntax

virtual BOOL OnEditProperty( DISPID dispid );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes


COlePropertyPage::OnHelp

The framework calls this member function when the user requests online help. Override it if your property page must perform any special action when the user accesses help. The default implementation does nothing and returns FALSE.

Syntax

virtual BOOL OnHelp( LPCTSTR lpszHelpDir );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes


COlePropertyPage::OnInitDialog

The framework calls this member function when the property page's dialog is initialized. Override it if any special action is required when the dialog is initialized. The default implementation calls CDialog::OnInitDialog and returns FALSE.

Syntax

virtual BOOL OnInitDialog( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, CDialog::OnInitDialog


COlePropertyPage::OnObjectsChanged

The framework calls this member function when a property page is being displayed in the developer environment, and the user selects another control. In the developer environment, a modeless dialog box is used to display the property pages, and when a different control is selected, a different set of property pages must be displayed. Override this function to receive notification of this action and perform any special actions.

Syntax

virtual void OnObjectsChanged( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes


COlePropertyPage::OnSetPageSite

The framework calls this member function when the property frame provides the property page's page site. The default implementation loads the page's caption and attempts to determine the page's size from the dialog resource. Override this function if your property page requires any further action; your override should call the base-class implementation.

Syntax

virtual void OnSetPageSite( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::GetPageSite


COlePropertyPage::SetControlStatus

Call this member function to change the status of a property page control. If the status of a property page control is dirty when the property page is closed or the Apply button is chosen, the control's property will be updated with the appropriate value.

Syntax

BOOL SetControlStatus( UINT nID, BOOL IsDirty );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::GetControlStatus


COlePropertyPage::SetDialogResource

Call this member function to set the property page's dialog resource.

Syntax

void SetDialogResource( HGLOBAL hDialog );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes


COlePropertyPage::SetHelpInfo

Call this member function to specify a brief text string describing the purpose of this property page and its help filename and the help context.

Syntax

void SetHelpInfo( LPCTSTR lpszDocString, LPCTSTR lpszHelpFile = NULL, DWORD dwHelpContext = 0 );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::OnHelp


COlePropertyPage::SetModifiedFlag

Call this member function to set the flag that indicates whether the user has modified the property page.

Syntax

void SetModifiedFlag( BOOL bModified = TRUE );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes, COlePropertyPage::IsModified


COlePropertyPage::SetPageName

Call this member function to set the property page's name, which the property frame will typically display on the page's tab.

Syntax

void SetPageName( LPCTSTR lpszPageName );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

COlePropertyPage Overview, COlePropertyPage Member Functions, Dialog Box Classes


COleSafeArray

The COleSafeArray class is used for working with arrays of arbitrary types and dimensions. COleSafeArray provides implementations of the COM SAFEARRAY member functions, as well as a set of member functions specifically designed for one-dimensional arrays of bytes. COleSafeArray derives from the COM VARIANT structure.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Member Functions, COleSafeArray Operators, Structures, VARIANT, SAFEARRAY


COleSafeArray Member Functions

Construction
COleSafeArray Constructs a COleSafeArray object.

Operations
Attach | Gives control of the existing VARIANT array to the COleSafeArray object.
Clear | Clears the safe array.
Detach | Detaches the VARIANT array from the COleSafeArray object (so that the data will not be freed).

Win32 API Wrappers
AccessData | Retrieves a pointer to the array data.
AllocData | Allocates memory for the array.
AllocDescriptor | Allocates memory for the safe array descriptor.
Copy | Creates a copy of an existing array.
Create | Creates a safe array.
Destroy | Destroys an existing array.
DestroyData | Destroys data in a safe array.
DestroyDescriptor | Destroys a descriptor of a safe array.
GetDim | Returns the number of dimensions in the array.
GetElement | Retrieves a single element of the safe array.
GetElemSize | Returns the size, in bytes, of one element in a safe array.
GetLBound | Returns the lower bound for any dimension of a safe array.
GetUBound | Returns the upper bound for any dimension of a safe array.
Lock | Increments the lock count of an array and places a pointer to the array data in the array descriptor.
PtrOfIndex | Returns a pointer to the element specified by the index values.
PutElement | Assigns a single element into the array.
Redim | Changes the least significant (rightmost) bound of a safe array.
UnaccessData | Decrements the lock count of an array and invalidates the pointer retrieved by AccessData.
Unlock | Decrements the lock count of an array so it can be freed or resized.

One-Dimensional Array Operations
CreateOneDim | Creates a one-dimensional COleSafeArray object.
GetOneDimSize | Returns the number of elements in the one-dimensional COleSafeArray object.
ResizeOneDim | Changes the number of elements in a one-dimensional COleSafeArray object.

See Also

COleSafeArray Overview, COleSafeArray Operators, Structures


COleSafeArray::AccessData

Call this member function to retrieve a pointer to the array data.

Syntax

void AccessData( void** ppvData );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::UnaccessData , SafeArrayAccessData


COleSafeArray::AllocData

Call this member function to allocate memory for the array.

Syntax

void AllocData( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::AllocDescriptor , SafeArrayAllocData


COleSafeArray::AllocDescriptor

Call this member function to allocate memory for the safe array descriptor.

Syntax

void AllocDescriptor( DWORD dwDims );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::AllocData , SafeArrayAllocDescriptor


COleSafeArray::Attach

Call this member function to give control of the existing VARIANT array to the COleSafeArray object.

Syntax

void Attach( VARIANT& varSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Detach, VARIANT


COleSafeArray::Clear

Call this member function to clear the safe array. The function clears a safe array by setting the VARTYPE of the object to VT_EMPTY. The current contents are released and the array is freed.

Syntax

void Clear( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, VariantClear, VARTYPE


COleSafeArray::COleSafeArray

Use this constructor to construct a COleSafeArray object.

Syntax

COleSafeArray( );

COleSafeArray( const SAFEARRAY& saSrc, VARTYPE vtSrc );

COleSafeArray( LPCSAFEARRAY psaSrc, VARTYPE vtSrc );

COleSafeArray( const COleSafeArray& saSrc );

COleSafeArray( const VARIANT& varSrc );

COleSafeArray( LPCVARIANT pSrc );

COleSafeArray( const COleVariant& varSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleVariant, VariantCopy, SAFEARRAY, VARIANT, VARTYPE


COleSafeArray::Copy

Call this member function to create a copy of an existing array.

Syntax

void Copy( LPSAFEARRAY* ppsa );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, SafeArrayCopy, SAFEARRAY


COleSafeArray::Create

Call this member function to create a safe array.

Syntax

void Create( VARTYPE vtSrc, DWORD dwDims, DWORD* rgElements );

void Create( VARTYPE vtSrc, DWORD dwDims, SAFEARRAYBOUND* rgsabounds );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, SafeArrayCreate, SAFEARRAY


COleSafeArray::CreateOneDim

Call this member function to create a one-dimensional COleSafeArray object.

Syntax

void CreateOneDim( VARTYPE vtSrc, DWORD dwElements, void pvSrcData = NULL, long nLBound = 0 );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::GetOneDimSize , COleSafeArray::ResizeOneDim, COleSafeArray::Create


COleSafeArray::Destroy

Call this member function to destroy an existing array.

Syntax

void Destroy( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::DestroyData , COleSafeArray::DestroyDescriptor, SafeArrayDestroy


COleSafeArray::DestroyData

Call this member function to destroy data in a safe array.

Syntax

void DestroyData( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Destroy, COleSafeArray::DestroyDescriptor, SafeArrayDestroyData


COleSafeArray::DestroyDescriptor

Call this member function to destroy a descriptor of a safe array.

Syntax

void DestroyDescriptor( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Destroy , COleSafeArray::DestroyData, SafeArrayDestroyDescriptor


COleSafeArray::Detach

Call this member function to detach the VARIANT array from the COleSafeArray object (so that the data will not be freed).

Syntax

VARIANT Detach( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Attach , VariantClear, VARIANT


COleSafeArray::GetDim

Call this member function to retrieve the number of dimensions in the array.

Syntax

DWORD GetDim( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Create , COleSafeArray::Redim, SafeArrayGetDim


COleSafeArray::GetElement

Call this member function to retrieve a single element of the safe array.

Syntax

void GetElement( long* rgIndices, void* pvData );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::PutElement , SafeArrayGetElement


COleSafeArray::GetElemSize

Call this member function to retrieve the size, in bytes, of one element in a safe array.

Syntax

DWORD GetElemSize( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::GetDim , SafeArrayGetElemSize


COleSafeArray::GetLBound

Call this member function to retrieve the lower bound for any dimension of a safe array.

Syntax

void GetLBound( DWORD dwDim, long* pLBound );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::GetUBound , SafeArrayGetLBound


COleSafeArray::GetOneDimSize

Call this member function to retrieve the number of elements in a one-dimensional COleSafeArray object.

Syntax

DWORD GetOneDimSize( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::CreateOneDim , COleSafeArray::ResizeOneDim, SafeArrayRedim


COleSafeArray::GetUBound

Call this member function to retrieve the upper bound for any dimension of a safe array.

Syntax

void GetUBound( DWORD dwDim, long* pUBound );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::GetLBound , SafeArrayGetUBound


COleSafeArray::Lock

Call this member function to increment the lock count of an array and place a pointer to the array data in the array descriptor.

Syntax

void Lock( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Unlock , SafeArrayLock


COleSafeArray::PtrOfIndex

Call this member function to obtain a pointer to the element specified by the index values.

Syntax

void PtrOfIndex( long* rgIndices, void** ppvData );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, SafeArrayPtrOfIndex


COleSafeArray::PutElement

Call this member function to assign a single element into the array.

Syntax

void PutElement( long* rgIndices, LPVOID pvData );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::GetElement , SafeArrayPutElement


COleSafeArray::Redim

Call this member function to change the least significant (rightmost) bound of a safe array.

Syntax

void Redim( SAFEARRAYBOUND* psaboundNew );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Create , COleSafeArray::GetDim, COleSafeArray::ResizeOneDim, SafeArrayRedim, SAFEARRAY , SAFEARRAYBOUND


COleSafeArray::ResizeOneDim

Call this member function to change the number of elements in a one-dimensional COleSafeArray object.

Syntax

void ResizeOneDim( DWORD dwElements );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Redim , COleSafeArray::GetOneDimSize, COleSafeArray::CreateOneDim, SafeArrayRedim


COleSafeArray::UnaccessData

Call this member function to decrement the lock count of an array and invalidates the pointer retrieved by COleSafeArray::AccessData.

Syntax

void UnaccessData( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::AccessData , SafeArrayUnaccessData


COleSafeArray::Unlock

Call this member function to decrement the lock count of an array so it can be freed or resized.

Syntax

void Unlock( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures, COleSafeArray::Lock , SafeArrayUnlock


COleSafeArray Operators

Operators
operator = | Copies values into a COleSafeArray object. The values to be copied can be a SAFEARRAY, a COleSafeArray, or an array of VARIANT or COleVariant objects.
operator == | Compares two variant arrays. The array with which to compare the COleSafeArray object can be a SAFEARRAY, a COleSafeArray, or an array of VARIANT or COleVariant objects.
operator LPVARIANT | Accesses the underlying VARIANT structure of the COleSafeArray object.
operator LPCVARIANT | Accesses the underlying VARIANT structure of the COleSafeArray object.

See Also

COleSafeArray Overview, COleSafeArray Member Functions, Structures


COleSafeArray::operator =

Use these overloaded assignment operators to copy an array of values into a COleSafeArray object. The values to be copied can be a SAFEARRAY, a COleSafeArray, an array of VARIANTs, or an array of COleVariant objects.

Syntax

COleSafeArray& operator =( const COleSafeArray& saSrc );

COleSafeArray& operator =( const VARIANT& varSrc );

COleSafeArray& operator =( LPCVARIANT pSrc );

COleSafeArray& operator =( const COleVariant& varSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Operators, Structures, COleVariant, VARIANT , VariantCopy, SAFEARRAY


COleSafeArray::operator ==

Use these overloaded operators to compare two variant arrays. The array with which to compare the COleSafeArray object can be a SAFEARRAY, a COleSafeArray, or an array of VARIANT or COleVariant objects.

Syntax

BOOL operator ==( const SAFEARRAY& saSrc ) const;

BOOL operator ==( LPCSAFEARRAY pSrc ) const;

BOOL operator ==( const COleSafeArray& saSrc ) const;

BOOL operator ==( const VARIANT& varSrc ) const;

BOOL operator ==( LPCVARIANT pSrc ) const;

BOOL operator ==( const COleVariant& varSrc ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Operators, Structures, COleVariant, VARIANT, SAFEARRAY


COleSafeArray::operator LPCVARIANT

Use this operator to access the underlying VARIANT structure of the COleSafeArray object.

Syntax

operator LPCVARIANT( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Operators, Structures, VARIANT


COleSafeArray::operator LPVARIANT

Use this operator to access the underlying VARIANT structure of the COleSafeArray object.

Syntax

operator LPVARIANT( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleSafeArray Overview, COleSafeArray Operators, Structures, COleVariant, VARIANT , VariantCopy


COleStreamFile

A COleStreamFile object represents a stream of data (IStream) in a compound file as part of COM Structured Storage. An IStorage object must exist before the stream can be opened or created unless it is a memory stream. COleStreamFile objects are manipulated exactly like CFile objects.

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Member Functions, File Service Classes


COleStreamFile Member Functions

Construction
COleStreamFile Constructs a COleStreamFile object.

Operations
Attach | Associates a stream with the object.
CreateMemoryStream | Creates a stream from global memory and associates it with the object.
CreateStream | Creates a stream and associates it with the object.
Detach | Disassociates the stream from the object.
GetStream | Returns the current stream.
OpenStream | Safely opens a stream and associates it with the object.

See Also

COleStreamFile Overview, File Service Classes


COleStreamFile::Attach

Call this member function to associate the supplied COM stream with the COleStreamFile object. The object must not already be associated with a COM stream.

Syntax

void Attach( LPSTREAM lpStream );

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Overview, COleStreamFile Member Functions, File Service Classes, COleStreamFile::Detach


COleStreamFile::COleStreamFile

Use this member function to construct a COleStreamFile object. If lpStream is NULL, the object is not associated with a COM stream, otherwise, the object is associated with the supplied COM stream.

Syntax

COleStreamFile( LPSTREAM lpStream = NULL );

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Overview, COleStreamFile Member Functions, File Service Classes, COleStreamFile::Attach, CFile


COleStreamFile::CreateMemoryStream

Call this member function to safely create a new stream out of global, shared memory where a failure is a normal, expected condition. The memory is allocated by the COM subsystem.

Syntax

BOOL CreateMemoryStream( CFileException* pError = NULL );

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Overview, COleStreamFile Member Functions, File Service Classes, COleStreamFile::OpenStream, COleStreamFile::CreateStream, CFileException


COleStreamFile::CreateStream

Call this member function to safely create a new stream in the supplied storage object where a failure is a normal, expected condition. A file exception will be thrown if the open fails and pError is not NULL.

Syntax

BOOL CreateStream( LPSTORAGE lpStorage, LPCTSTR lpszName, DWORD nOpenFlags = modeReadWrite|shareExclusive|modeCreate, CFileException* pError = NULL );

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Overview, COleStreamFile Member Functions, File Service Classes, COleStreamFile::OpenStream, COleStreamFile::CreateMemoryStream, CFileException


COleStreamFile::Detach

Call this member function to disassociate the stream from the object without closing the stream. The stream must be closed in some other fashion before the program terminates.

Syntax

LPSTREAM Detach( );

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Overview, COleStreamFile Member Functions, File Service Classes, COleStreamFile::Attach


COleStreamFile::GetStream

Call this member function to retrieve a pointer to current stream.

Syntax

IStream* GetStream( ) const;

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Overview, COleStreamFile Member Functions, File Service Classes, IStream


COleStreamFile::OpenStream

Call this member function to open an existing stream. A file exception will be thrown if the open fails and pError is not NULL.

Syntax

BOOL OpenStream( LPSTORAGE lpStorage, LPCTSTR lpszName, DWORD nOpenFlags = modeReadWrite|shareExclusive, CFileException* pError = NULL );

At a Glance

Header file: Afxole.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleStreamFile Overview, COleStreamFile Member Functions, File Service Classes, COleStreamFile::CreateStream, COleStreamFile::CreateMemoryStream, CFileException


COleVariant

The COleVariant class encapsulates the VARIANT data type. This data type is used in Automation. Specifically, the DISPPARAMS structure contains a pointer to an array of VARIANT structures. A DISPPARAMS structure is used to pass parameters to IDispatch::Invoke. COleVariant is derived from the VARIANT structure. This means you can pass a COleVariant in a parameter that calls for a VARIANT.

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Member Functions, COleVariant Operators, Automation Types, VARIANT, DISPPARAMS, IDispatch::Invoke


COleVariant Member Functions

Construction
COleVariant Constructs a COleVariant object.

Operations
Attach | Attaches a VARIANT to a COleVariant object.
ChangeType | Changes the variant type of this COleVariant object.
Clear | Clears this COleVariant object.
Detach | Detaches a VARIANT from a COleVariant object and returns the VARIANT.

See Also

COleVariant Overview, COleVariant Operators, Automation Types


COleVariant::Attach

Call this member function to attach the specified VARIANT object to the current COleVariant object. This function sets the VARTYPE of varSrc to VT_EMPTY.

Syntax

void Attach( VARIANT& varSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Member Functions, Automation Types, COleVariant::operator LPCVARIANT, COleVariant::operator LPVARIANT, VARIANT, VARTYPE


COleVariant::COleVariant

Use these overloaded constructors to construct a new COleVariant object, initialized to the specified value.

Syntax

COleVariant( );

COleVariant( const VARIANT& varSrc );

COleVariant( const COleVariant& varSrc );

COleVariant( LPCVARIANT pSrc );

COleVariant( LPCTSTR lpszSrc );

COleVariant( LPCTSTR lpszSrc, VARTYPE vtSrc );

COleVariant( CString& strSrc );

COleVariant( BYTE nSrc );

COleVariant( short nSrc, VARTYPE vtSrc = VT_I2 );

COleVariant( long lSrc, VARTYPE vtSrc = VT_I4 );

COleVariant( const COleCurrency& curSrc );

COleVariant( float fltSrc );

COleVariant( double dblSrc );

COleVariant( const COleDateTime& dateSrc );

COleVariant( const CByteArray& arrSrc );

COleVariant( const CLongBinary& lbSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Member Functions, Automation Types, COleVariant::operator =, CByteArray, CLongBinary, COleCurrency, COleDateTime, CString, VARIANT, VARTYPE


COleVariant::ChangeType

Call this member function to convert the type of VARIANT value in this COleVariant object to the type specified by vartype.

Syntax

void ChangeType( VARTYPE vartype, LPVARIANT pSrc = NULL );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Member Functions, Automation Types, COleVariant::operator =


COleVariant::Clear

Call this member function to clear the VARIANT. This sets the VARTYPE for this object to VT_EMPTY. The COleVariant destructor calls this function.

Syntax

void Clear( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Member Functions, Automation Types, VariantClear, VARIANT, VARTYPE


COleVariant::Detach

Call this member function to detach the underlying VARIANT object from this COleVariant object. This function sets the VARTYPE for this COleVariant object to VT_EMPTY. After calling Detach, it is the caller's responsibility to call VariantClear on the resulting VARIANT structure.

Syntax

VARIANT Detach( );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Member Functions, Automation Types, VariantClear, VARIANT, VARTYPE


COleVariant::SetString

Call this member function to set the string to a particular type. The parameter vtSrc must be VT_BSTR (UNICODE) or VT_BSTRT (ANSI). SetString is typically used to set strings to ANSI, since the default for the COleVariant::COleVariant constructor with a string or string pointer parameter and no VARTYPE is UNICODE.

Syntax

void SetString( LPCTSTR lpszSrc, VARTYPE vtSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Member Functions, Automation Types, COleVariant::COleVariant, VARIANT, VARTYPE


COleVariant Operators

Operators
operator LPCVARIANT | Converts a COleVariant value into an LPCVARIANT.
operator LPVARIANT | Converts a COleVariant object into an LPVARIANT.
operator = | Copy a COleVariant value.
operator == | Compare two COleVariant values.

Archive/Dump
operator << | Output a COleVariant value to CArchive or CDumpContext.
operator >> | Input a COleVariant object from CArchive.

See Also

COleVariant Overview, COleVariant Member Functions, Automation Types


COleVariant::operator =

Use these overloaded assignment operators to copy the source value into this COleVariant object.

Syntax

const COleVariant& operator =( const VARIANT& varSrc );

const COleVariant& operator =( LPCVARIANT pSrc );

const COleVariant& operator =( const COleVariant& varSrc );

const COleVariant& operator =( const LPCTSTR lpszSrc );

const COleVariant& operator =( const CString& strSrc );

const COleVariant& operator =( const BYTE nSrc );

const COleVariant& operator =( const short nSrc );

const COleVariant& operator =( const long lSrc );

const COleVariant& operator =( const COleCurrency& curSrc );

const COleVariant& operator =( const float fltSrc );

const COleVariant& operator =( const double dblSrc );

const COleVariant& operator =( const COleDateTime& dateSrc );

const COleVariant& operator =( const CByteArray& arrSrc );

const COleVariant& operator =( const CLongBinary& lbSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Operators, Automation Types, COleVariant::COleVariant, COleVariant::operator LPCVARIANT, COleVariant::operator LPVARIANT, VARIANT, CByteArray, CLongBinary, COleCurrency, COleDateTime


COleVariant::operator ==

Use this operator to compare two VARIANT values.

Syntax

BOOL operator ==( const VARIANT& varSrc ) const;

BOOL operator ==( LPCVARIANT pSrc ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Operators, Automation Types, COleVariant::operator =, VARIANT


COleVariant::operator LPCVARIANT

Use this casting operator to obtain a VARIANT structure whose value is copied from this COleVariant object.

Syntax

operator LPCVARIANT( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Operators, Automation Types, COleVariant::operator LPVARIANT, VARIANT


COleVariant::operator LPVARIANT

Use this casting operator to access the underlying VARIANT structure for this COleVariant object.

Syntax

operator LPVARIANT( ) const;

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Operators, Automation Types, COleVariant::operator LPCVARIANT, VARIANT


COleVariant::operator <<, >>

Use the COleVariant insertion (<<) operator for diagnostic dumping and storing to an archive.

Use the extraction (>>) operator for loading from an archive.

Syntax

friend CDumpContext& AFXAPI operator <<( CDumpContext& dc, COleVariant varSrc );

friend CArchive& AFXAPI operator <<( CArchive& ar, COleVariant varSrc );

friend CArchive& AFXAPI operator >>( CArchive& ar, COleVariant& varSrc );

At a Glance

Header file: Afxdisp.h
Platforms:
Versions: 2.0 and later
Complete documentation: Visual C++ documentation

See Also

COleVariant Overview, COleVariant Operators, Automation Types, CDumpContext, CArchive


CPaintDC

The CPaintDC class is a device-context class derived from CDC.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPaintDC Member Functions, CPaintDC Data Members, Graphical Drawing Classes, CDC


CPaintDC Member Functions

Construction
CPaintDC Constructs a CPaintDC connected to the specified CWnd.

See Also

CPaintDC Overview, Graphical Drawing Classes


CPaintDC::CPaintDC

Use this constructor to constructs a CPaintDC object, prepares the application window for painting, and stores the PAINTSTRUCT structure in the m_ps member variable.

Syntax

CPaintDC( CWnd* pWnd );
throw( CResourceException );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPaintDC Overview, CPaintDC Member Functions, Graphical Drawing Classes


CPaintDC Data Members

Data Members
m_hWnd | The HWND to which this CPaintDC object is attached.
m_ps | Contains the PAINTSTRUCT used to paint the client area.

See Also

CPaintDC Overview, CPaintDC Data Members, Graphical Drawing Classes


CPaintDC::m_hWnd

This data member contains the handle to the window to which this CPaintDC object is attached.

HWND m_hWnd;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPaintDC Overview, CPaintDC Data Members, Graphical Drawing Classes


CPaintDC::m_ps

This data member contains a PAINTSTRUCT structure that maintains information the application uses to paint the client area of the window associated with a CPaintDC object.

PAINTSTRUCT m_ps;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPaintDC Overview, CPaintDC Data Members, Graphical Drawing Classes, PAINTSTRUCT


CPen

The CPen class encapsulates a Windows graphics device interface (GDI) pen.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the overloaded versions of the CPen::CPen and CPen::CreatePen member functions that take the pLogBrush, nStyleCount, and lpStyle parameters.

Windows CE also does not support the GetExtLogPen member function of the CPen class.

See Also

CPen Member Functions, CPen Operators, Graphical Drawing Object Classes, CBrush


CPen Member Functions

Construction
CPen Constructs a CPen object.

Initialization
CreatePen | Creates a logical cosmetic or geometric pen with the specified style, width, and brush attributes, and attaches it to the CPen object.
CreatePenIndirect | Creates a pen with the style, width, and color given in a LOGPEN structure, and attaches it to the CPen object.

Operations
FromHandle Returns a pointer to a CPen object when given a Windows HPEN.

Attributes
GetLogPen Gets a LOGPEN underlying structure.

See Also

CPen Overview, Graphical Drawing Object Classes


CPen::CPen

Use this constructor to construct a CPen object. After constructing it, you must initialize it by using either the CPen::CreatePen or CPen::CreatePenIndirect member functions, or by calling CGDI::CreateStockObject.

Syntax

CPen( );

CPen ( int nPenStyle, int nWidth, COLORREF crColor );
throw( CResourceException );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the following overloaded version of the constructor.

CPen ( int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL )

In Windows CE version 1.0, only solid pens can draw wide lines.

See Also

CPen Overview, CPen Member Functions, Graphical Drawing Object Classes, CPen::CreatePen, CPen::CreatePenIndirect, CGdiObject::CreateStockObject


CPen::CreatePen

Call this member function to initialize a pen with the specified style, width, and color.

Syntax

BOOL CreatePen (
int nPenStyle,
int nWidth,
COLORREF crColor
);

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the following overloaded version of the CPen::CreatePen member function.

BOOL CreatePen( int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL );

In Windows CE version 1.0, only solid pens can draw wide lines.

See Also

CPen Overview, CPen Member Functions, Graphical Drawing Object Classes, CPen::CreatePenIndirect, CPen::CPen, CGdiObject::DeleteObject


CPen::CreatePenIndirect

Call this member function to initialize a pen that has the style, width, and color given in the structure pointed to by lpLogPen.

Syntax

BOOL CreatePenIndirect( LPLOGPEN lpLogPen );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE 1.0, wide lines are only supported for solid pens.

See Also

CPen Overview, CPen Member Functions, Graphical Drawing Object Classes, CPen::CreatePen, CPen::CPen


CPen::FromHandle

Call this member function to obtain a pointer to a CPen object when you have a handle to a Windows GDI pen object.

Syntax

static CPen* PASCAL FromHandle( HPEN hPen );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPen Overview, CPen Member Functions, Graphical Drawing Object Classes


CPen::GetLogPen

Call this member function to get a LOGPEN underlying structure. The LOGPEN structure defines the style, color, and pattern of a pen.

Syntax

int GetLogPen( LOGPEN* pLogPen );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPen Overview, CPen Member Functions, Graphical Drawing Object Classes


CPen Operators

Attributes
operator HPEN Returns the Windows handle attached to the CPen object.

See Also

CPen Overview, CPen Member Functions, Graphical Drawing Object Classes


CPen::operator HPEN

Use this operator to get the attached Windows GDI handle to the CPen object. This operator is a casting operator, which supports direct use of an HPEN object.

Syntax

operator HPEN( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPen Overview, CPen Operators, Graphical Drawing Object Classes


CPoint

The CPoint class is similar to the Windows POINT structure. It also includes member functions to manipulate CPoint and POINT structures.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Member Functions, CPoint Operators, Simple Value Types, CRect, CSize


CPoint Member Functions

Construction
CPoint Constructs a CPoint.

Operations
Offset Adds values to the x and y members of the CPoint.

See Also

CPoint Overview, CPoint Operators, Simple Value Types


CPoint::CPoint

Use this constructor to construct a CPoint object. If no arguments are given, x and y members are not initialized.

Syntax

CPoint( );

CPoint( int initX, int initY );

CPoint( POINT initPt );

CPoint( SIZE initSize );

CPoint( DWORD dwPoint );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Member Functions, Simple Value Types


CPoint::Offset

Call this member function to add to the values of the x and y members of the CPoint object.

Syntax

void Offset( int xOffset, int yOffset );

void Offset( POINT point );

void Offset( SIZE size );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Member Functions, Simple Value Types, CPoint::operator +=, CPoint::operator – =


CPoint Operators

Operations
operator == | Checks for equality between two points.
operator != | Checks for inequality between two points.

Operators Returning CPoint Values
operator += | Offsets CPoint by adding a size or point.
operator –= | Offsets CPoint by subtracting a size or point.
operator + | Returns the sum of a CPoint and a size or point.
operator – | Returns the difference of a CPoint and a size, or the negation of a point.

Operators Returning CSize Values
operator – Returns the size difference between two points.

Operators Returning CRect Values
operator + | Returns a CRect offset by a size.
operator – | Returns a CRect offset by a negative size.

See Also

CPoint Overview, CPoint Member Functions, Simple Value Types


CPoint::operator ==

Use this operator to check for equality between two points.

BOOL operator ==( POINT point ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Operators, Simple Value Types, CPoint::Operator !=


CPoint::operator !=

Use this operator to check for inequality between two points.

BOOL operator !=( POINT point ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Operators, Simple Value Types, CPoint::Operator ==


CPoint::operator +=

Use this operator to add the x (or cx) member of the right-hand operand to the x member of the CPoint object and the y (or cy) member of the right-hand operand to the y member of the CPoint object.

Syntax

void operator +=( SIZE size );

void operator +=( POINT point );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Operators, Simple Value Types, CPoint::operator – =, CPoint::operator +, CPoint::Offset


CPoint::operator -=

Use this operator to subtract the x (or cx) member of the right-hand operand from the x member of the CPoint and the y (or cy) member of the right-hand operand from the y member of the CPoint.

Syntax

void operator –=( SIZE size );

void operator–=( POINT point );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Operators, Simple Value Types, CPoint::operator –, CPoint::operator +=, CPoint::Offset


CPoint::operator +

Use this operator to offset CPoint by a CPoint or CSize object, or to offset a CRect by a CPoint.

Syntax

CPoint operator +( SIZE size ) const;

CPoint operator +( POINT point ) const;

CRect operator +( const RECT* lpRect ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Operators, Simple Value Types, CPoint::operator – =, CPoint::operator –, CPoint::operator +=, CSize::operator +, CRect::operator +, CPoint::Offset, CRect::OffsetRect


CPoint::operator -

Use this operator to subtract a CPoint or CSize object from CPoint. The third overloaded version of this operator offsets a CRect by the negation of CPoint.

Use the unary operator to negate CPoint.

Syntax

CSize operator –( POINT point ) const;

CPoint operator –( SIZE size ) const;

CRect operator –( const RECT* lpRect ) const;

CPoint operator –( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CPoint Overview, CPoint Operators, Simple Value Types, CPoint::operator – =, CPoint::operator +=, CPoint::operator +, CSize::operator -, CRect::operator -, CPoint::Offset, CRect::OffsetRect


CProgressCtrl

The CProgressCtrl class provides the functionality of the Windows common progress bar control.

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Member Functions, Control Classes


CProgressCtrl Member Functions

Construction
CProgressCtrl | Constructs a CProgressCtrl object.
Create | Creates a progress bar control and attaches it to a CProgressCtrl object.

Attributes
SetRange | Sets the minimum and maximum ranges for a progress bar control and redraws the bar to reflect the new ranges.
SetPos | Sets the current position for a progress bar control and redraws the bar to reflect the new position.
OffsetPos | Advances the current position of a progress bar control by a specified increment and redraws the bar to reflect the new position.
SetStep | Specifies the step increment for a progress bar control.

Operations
StepIt Advances the current position for a progress bar control by the step increment (see SetStep) and redraws the bar to reflect the new position.

See Also

CProgressCtrl Overview, Control Classes


CProgressCtrl::CProgressCtrl

Use this constructor to construct a CProgressCtrl object.

Syntax

CProgressCtrl( );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Overview, CProgressCtrl Member Functions, Control Classes, CProgressCtrl::Create


CProgressCtrl::Create

Call this member function to create the progress bar control attached to this CProgressCtrl object.

You construct a CProgressCtrl object in two steps. First call the constructor, which creates the CProgressCtrl object; then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Overview, CProgressCtrl Member Functions, Control Classes, CProgressCtrl::CProgressCtrl


CProgressCtrl::OffsetPos

Call this member function to advance the progress bar control's current position by the increment specified by nPos, and redraw the bar to reflect the new position.

Syntax

int OffsetPos( int nPos );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Overview, CProgressCtrl Member Functions, Control Classes, CProgressCtrl::SetPos, CProgressCtrl::SetRange, CProgressCtrl::StepIt


CProgressCtrl::SetPos

Call this member function to set the progress bar control's current position as specified by nPos, and redraw the bar to reflect the new position.

Syntax

int SetPos( int nPos );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Overview, CProgressCtrl Member Functions, Control Classes, CProgressCtrl::OffsetPos, CProgressCtrl::SetRange, CProgressCtrl::StepIt


CProgressCtrl::SetRange

Call this member function to set the upper and lower limits of the progress bar control's range, and redraw the bar to reflect the new ranges.

Syntax

void SetRange( int nLower, int nUpper );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Overview, CProgressCtrl Member Functions, Control Classes, CProgressCtrl::OffsetPos, CProgressCtrl::SetPos, CProgressCtrl::StepIt


CProgressCtrl::SetStep

Call this member function to specify the step increment for a progress bar control. The step increment is the amount by which a call to CProgressCtrl::StepIt increases the progress bar's current position.

Syntax

int SetStep( int nStep );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Overview, CProgressCtrl Member Functions, Control Classes, CProgressCtrl::OffsetPos, CProgressCtrl::SetPos, CProgressCtrl::StepIt


CProgressCtrl::StepIt

Call this member function to advance the current position for a progress bar control by the step increment, and redraw the bar to reflect the new position.

Syntax

int StepIt( );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CProgressCtrl Overview, CProgressCtrl Member Functions, Control Classes CProgressCtrl::SetPos, CProgressCtrl::SetRange, CProgressCtrl::SetStep


CPropertyPage

The CPropertyPage class encapsulates a single page of a Windows property sheet.

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Because the current version of Windows CE does not support wizards, MFC for Windows CE does not support the OnWizardBack, OnWizardNext, or OnWizardFinish member functions of the CPropertyPage class.

See Also

CPropertyPage Member Functions, CPropertyPage Data Members, Dialog Box Classes, CPropertySheet, CDialog


CPropertyPage Member Functions

Construction
CPropertyPage | Constructs a CPropertyPage object.
Construct | Constructs a CPropertyPage object. Use Construct if you want to specify your parameters at run time, or if you are using arrays.

Operations
CancelToClose | Changes the OK button to read Close, and disables the Cancel button, after an unrecoverable change in the page of a modal property sheet.
SetModified | Call to activate or deactivate the Apply Now button.
QuerySiblings | Forwards the message to each page of the property sheet.

Overridables
OnCancel | Called by the framework when the Cancel button is clicked.
OnKillActive | Called by the framework when the current page is no longer the active page. Perform data validation here.
OnOK | Called by the framework when the OK, Apply Now, or Close button is clicked.
OnSetActive | Called by the framework when the page is made the active page.
OnApply | Called by the framework when the Apply Now button is clicked.
OnReset | Called by the framework when the Cancel button is clicked.
OnQueryCancel | Called by the framework when the Cancel button is clicked, and before the cancel has taken place.

See Also

CPropertyPage Overview, CPropertyPage Data Members, Dialog Box Classes


CPropertyPage::CancelToClose

Call this member function after an unrecoverable change has been made to the data in a page of a modal property sheet. This function will change the OK button to Close and disable the Cancel button. This change alerts the user that a change is permanent and the modifications cannot be canceled.

The CancelToClose member function does nothing in a modeless property sheet, because a modeless property sheet does not have a Cancel button by default.

Syntax

void CancelToClose( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertyPage::OnKillActive, CPropertyPage::SetModified


CPropertyPage::Construct

Call this member function to construct a CPropertyPage object. The object is displayed after all of the following conditions are met:

  • The page has been added to a property sheet using CPropertySheet::AddPage.
  • The property sheet's DoModal or Create function has been called.
  • The user has selected (tabbed to) this page.

Call Construct if one of the other class constructors has not been called. The Construct member function is flexible because you can leave the parameter statement blank and then specify multiple parameters and construction at any point in your code.

Syntax

void Construct( UINT nIDTemplate, UINT nIDCaption = 0 );

void Construct( LPCTSTR lpszTemplateName, UINT nIDCaption = 0 );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertyPage::CPropertyPage, CPropertySheet::DoModal, CPropertySheet::AddPage


CPropertyPage::CPropertyPage

Call this member function to construct a CPropertyPage object. The object is displayed after all of the following conditions are met:

  • The page has been added to a property sheet using CPropertySheet::AddPage.
  • The property sheet's DoModal or Create function has been called.
  • The user has selected (tabbed to) this page.

If you have multiple parameters (for example, if you are using an array), use CPropertySheet::Construct instead of CPropertyPage.

Syntax

CPropertyPage( );

CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );

CPropertyPage( LPCTSTR lpszTemplateName, UINT nIDCaption = 0 );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertySheet::Create, CPropertySheet::DoModal, CPropertySheet::AddPage, CPropertyPage::Construct


CPropertyPage::OnApply

This member function is called by the framework when the user chooses the OK or the Apply Now button. When the framework calls this member function, changes made on all property pages in the property sheet are accepted, the property sheet retains focus, and OnApply returns TRUE (the value 1).

Syntax

virtual void OnApply( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertyPage::SetModified, CPropertyPage::OnOK


CPropertyPage::OnCancel

This member function is called by the framework when the Cancel button is selected. Override this member function to perform Cancel button actions. The default negates any changes that have been made.

Syntax

virtual void OnCancel( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertyPage::OnApply, CDialog::OnCancel, CPropertyPage::OnOK


CPropertyPage::OnKillActive

This member function is called by the framework when the page is no longer the active page. Override this member function to perform special data validation tasks.

The default implementation of this member function copies settings from the controls in the property page to the member variables of the property page. If the data was not updated successfully due to a dialog data validation (DDV) error, the page retains focus.

Syntax

virtual BOOL OnKillActive( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CWnd::UpdateData, CPropertyPage::OnOK, CPropertyPage::OnSetActive


CPropertyPage::OnOK

This member function is called by the framework when the user chooses either the OK or Apply Now button, immediately after the framework calls OnKillActive. Override this member function to implement additional behavior specific to the currently active page when user dismisses the entire property sheet.

Syntax

virtual void OnOK( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CDialog::OnOK, CPropertyPage::OnKillActive


CPropertyPage::OnQueryCancel

This member function is called by the framework when the user clicks the Cancel button and before the cancel action has taken place. Override this member function to specify an action the program takes when the user clicks the Cancel button.

Syntax

virtual BOOL OnQueryCancel( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes


CPropertyPage::OnReset

This member function is called by the framework when the user chooses the Cancel button. When the framework calls this member function, changes to all property pages that were made by the user previously choosing the Apply Now button are discarded, and the property sheet retains focus.

Syntax

virtual void OnReset( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertyPage::OnCancel, CPropertyPage::OnApply


CPropertyPage::OnSetActive

This member function is called by the framework when the page is chosen by the user and becomes the active page. Override this member function to perform tasks when a page is activated. Your override of this member function should call the default version before any other processing is done.

Syntax

virtual BOOL OnSetActive( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertyPage::OnKillActive


CPropertyPage::QuerySiblings

Call this member function to forward a message to each page in the property sheet. If a page returns a nonzero value, the property sheet does not send the message to subsequent pages.

Syntax

LRESULT QuerySiblings( WPARAM wParam, LPARAM lParam );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes


CPropertyPage::SetModified

Call this member function to enable or disable the Apply Now button, based on whether the settings in the property page should be applied to the appropriate external object.

Syntax

void SetModified( BOOL bChanged = TRUE );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes, CPropertyPage::CancelToClose


CPropertyPage Data Members

Data Members
m_psp The Windows CE PROPSHEETPAGE structure. Provides access to basic property page parameters

See Also

CPropertyPage Overview, CPropertyPage Member Functions, Dialog Box Classes


CPropertyPage::m_psp

The m_psp data member is a structure whose members store the characteristics of PROPSHEETPAGE. Use this structure to initialize the appearance of a property page after it is constructed.

PROPSHEETPAGE m_psp;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertyPage Overview, CPropertyPage Data Members, Dialog Box Classes, CPropertySheet


CPropertySheet

The CPropertySheet class encapsulates a Windows property sheet, otherwise known as a tabbed dialog box. A property sheet consists of a CPropertySheet object and one or more CPropertyPage objects.

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

On Windows CE-based platforms, users access property sheets by using an alt+Tap action.

Because the current version of Windows CE does not support wizards, MFC for Windows CE does not support the SetFinishText, SetWizardButtons, or SetWizardMode member functions of the CPropertySheet class.

Tip To set the position of a property sheet window in an application, use the CWnd::SetWindowPos function rather than the CWnd::MoveWindow function. Call CWnd::SetWindowPos in the dialog box procedure of the first property page that comes up when the property sheet is invoked.

Property sheets in Windows CE are always modal.

Windows CE does not support all the fields in the PROPSHEETHEADER and PROPSHEETPAGE structures exactly as Windows 95 and Windows NT support them. For more information, see Property Sheet Structures.

See Also

CPropertySheet Member Functions, CPropertySheet Data Members, Property Sheets, PROPSHEETHEADER, PROPSHEETPAGE


CPropertySheet Member Functions

Construction
CPropertySheet | Constructs a CPropertySheet object.
Construct | Constructs a CPropertySheet object.

Attributes
GetActiveIndex | Retrieves the index of the active page of the property sheet.
GetPageIndex | Retrieves the index of the specified page of the property sheet.
GetPageCount | Retrieves the number of pages in the property sheet.
GetPage | Retrieves a pointer to the specified page.
GetActivePage | Returns the active page object.
SetActivePage | Programmatically sets the active page object.
SetTitle | Sets the caption of the property sheet.
GetTabControl | Retrieves a pointer to a tab control.

Operations
DoModal | Displays a modal property sheet.
Create | Displays a modeless property sheet.
AddPage | Adds a page to the property sheet.
RemovePage | Removes a page from the property sheet.
PressButton | Simulates the choice of the specified button in a property sheet.
EndDialog | Terminates the property sheet.

See Also

CPropertySheet Overview, CPropertySheet Data Members, Property Sheets


CPropertySheet::AddPage

Call this member function to add a CPropertyPage object to the property sheet. Add pages to the property sheet in the left-to-right order you want them to appear.

Syntax

void AddPage( CPropertyPage *pPage );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::RemovePage, CPropertyPage


CPropertySheet::Construct

Call this member function to construct a CPropertySheet object if one of the class constructors has not already been called. For example, call Construct when you declare or allocate arrays of CPropertySheet objects. In the case of arrays, you must call Construct for each member in the array.

Syntax

void Construct( UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0 );

void Construct( LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0 );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::CPropertySheet, CPropertySheet::DoModal, CPropertySheet::Create


CPropertySheet::CPropertySheet

Use this constructor to construct a CPropertySheet object. To display the property sheet, call DoModal or Create. The string contained in the first parameter will be placed in the caption bar for the property sheet.

Syntax

CPropertySheet( );

CPropertySheet( UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0 );

CPropertySheet( LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0 );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::Construct, CPropertySheet::DoModal, CPropertySheet::Create, CPropertyPage


CPropertySheet::Create

Call this member function to display a modeless property sheet. You can call Create from inside the constructor, or you can call it after the constructor is invoked.

Syntax

BOOL Create( CWnd* pParentWnd = NULL, DWORD dwStyle = WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | WS_VISIBLE, DWORD dwExStyle = WS_EX_DLGMODALFRAME );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CDialog::Create, CPropertySheet::DoModal


CPropertySheet::DoModal

Call this member function to display a modal property sheet. The return value corresponds to the identifier of the control that closed the property sheet. After this function returns, the windows corresponding to the property sheet and all the pages will have been destroyed. The objects themselves will still exist. Typically, you will retrieve data from the CPropertyPage objects after DoModal returns IDOK.

Syntax

virtual int DoModal( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CDialog::DoModal, CPropertySheet::Create, CPropertyPage


CPropertySheet::EndDialog

Call this member function to terminate the property sheet. This member function is called by the framework when the OK, Cancel, or Close button is pressed. Call this member function if an event occurs that should close the property sheet.

This member function is only used with a modeless dialog box.

Syntax

void EndDialog( int nEndID );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertyPage::OnOK, CPropertyPage::OnCancel, CWnd::DestroyWindow


CPropertySheet::GetActiveIndex

Call this member function to get the index number of the property sheet window's active page, then use the returned index number as the parameter for GetPage.

Syntax

int GetActiveIndex( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::GetPage, CPropertySheet::GetActivePage


CPropertySheet::GetActivePage

Call this member function to retrieve the property sheet window's active page. Use this member function to perform some action on the active page.

Syntax

CPropertyPage* GetActivePage( ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::GetPage


CPropertySheet::GetPage

Call this member function to retrieve a pointer to the specified page in this property sheet.

Syntax

CPropertyPage* GetPage( int nPage ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::AddPage, CPropertySheet::GetActivePage, CPropertySheet::GetPageCount, CPropertySheet::RemovePage, CPropertySheet::SetTitle


CPropertySheet::GetPageIndex

Call this member function to retrieve the index number of the specified page in the property sheet.

Syntax

int GetPageIndex( CPropertyPage* pPage ) const;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::SetActivePage, CPropertySheet::GetPage


CPropertySheet::GetPageCount

Call this member function to determine the number of pages currently in the property sheet.

Syntax

int GetPageCount( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::GetPage, CPropertySheet::AddPage, CPropertySheet::RemovePage


CPropertySheet::GetTabControl

Call this member function to retrieve a pointer to a tab control to do something specific to the tab control (that is, to use any of the APIs in CTabCtrl). For example, call this member function if you want to add bitmaps to each of the tabs during initialization.

Syntax

CTabCtrl* GetTabControl( );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CTabCtrl::CTabCtrl


CPropertySheet::PressButton

Call this member function to simulate the choice of the specified button in a property sheet.

Syntax

BOOL PressButton( int nButton );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets


CPropertySheet::RemovePage

Call this member function to remove a page from the property sheet and destroy the associated window. The CPropertyPage object itself is not destroyed until the owner of the CPropertySheet window is closed.

Syntax

void RemovePage( CPropertyPage *pPage );

void RemovePage( int nPage );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::AddPage, CPropertyPage


CPropertySheet::SetActivePage

Call this member function to change the active page. For example, use SetActivePage if a user's action on one page should cause another page to become the active page.

Syntax

BOOL SetActivePage( int nPage );

BOOL SetActivePage( CPropertyPage* pPage );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets


CPropertySheet::SetTitle

Call this member function to specify the property sheet's caption (the text displayed in the title bar of a frame window).

Syntax

void SetTitle( UINT nStyle, LPCTSTR lpszText );

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets, CPropertySheet::GetPage, CPropertySheet::GetActivePage


CPropertySheet Data Members

Data Members
m_psh Provides access to basic property sheet parameters.

See Also

CPropertySheet Overview, CPropertySheet Member Functions, Property Sheets


CPropertySheet::m_psh

This data member contains a PROPSHEETHEADER structure whose members store the characteristics of a proerty sheet. Use this structure to initialize the appearance of the property sheet after it's constructed but before it's displayed with the DoModal member function.

PROPSHEETHEADER m_psh;

At a Glance

Header File | Afxdlgs.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CPropertySheet Overview, CPropertySheet Data Members, Property Sheets, CPropertySheet::DoModal, PROPSHEETHEADER


CPropExchange

The CPropExchange class supports the implementation of persistence for your ActiveX controls. Persistence is the exchange of the control's state information, usually represented by its properties, between the control itself and a medium. CPropExchange can be used to serialize a control's properties or initialize a control's properties upon the load or creation of a control.

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Member Functions, Support Classes, COleControl::DoPropExchange


CPropExchange Member Functions

Operations
ExchangeBlobProp | Exchanges a binary large object (BLOB) property.
ExchangeFontProp | Exchanges a font property.
ExchangePersistentProp | Exchanges a property between a control and a file.
ExchangeProp | Exchanges properties of any built-in type.
ExchangeVersion | Exchanges the version number of a control.
GetVersion | Retrieves the version number of a control.
IsLoading | Indicates whether properties are being loaded into the control or saved from it.

See Also

CPropExchange Overview, Support Classes


CPropExchange::ExchangeBlobProp

Call this member function to serialize a property that stores binary large object (BLOB) data. The functions CArchivePropExchange::ExchangeBlobProp, CResetPropExchange::ExchangeBlobProp, and CPropsetPropExchange::ExchangeBlobProp override this pure virtual function.

Syntax

virtual BOOL ExchangeBlobProp( LPCTSTR pszPropName, void** ppvBlob, const void* pvBlobDefault = NULL ) = 0;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Overview, CPropExchange Member Functions, Support Classes, COleControl::DoPropExchange, CPropExchange::ExchangeFontProp, CPropExchange::ExchangePersistentProp, CPropExchange::ExchangeProp


CPropExchange::ExchangeFontProp

Call this member function to exchange a font property between a storage medium and the control. The functions CArchivePropExchange::ExchangeFontProp, CResetPropExchange::ExchangeFontProp, and CPropsetPropExchange::ExchangeFontProp override this pure virtual function.

Syntax

virtual BOOL ExchangeFontProp( LPCTSTR pszPropName, CFontHolder& font, const FONTDESC FAR* pFontDesc, LPFONTDISP pFontDispAmbient ) = 0;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Overview, CPropExchange Member Functions, Support Classes, COleControl::DoPropExchange, CPropExchange::ExchangeBlobProp, CPropExchange::ExchangePersistentProp, CPropExchange::ExchangeProp


CPropExchange::ExchangePersistentProp

Call this member function to exchange a property between the control and a file. The functions CArchivePropExchange::ExchangePersistentProp, CResetPropExchange::ExchangePersistentProp, and CPropsetPropExchange::ExchangePersistentProp override this pure virtual function.

Syntax

virtual BOOL ExchangePersistentProp( LPCTSTR pszPropName, LPUNKNOWN FAR* ppUnk, REFIID iid, LPUNKNOWN pUnkDefault ) = 0;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Overview, CPropExchange Member Functions, Support Classes, COleControl::DoPropExchange, CPropExchange::ExchangeBlobProp, CPropExchange::ExchangeFontProp, CPropExchange::ExchangeProp


CPropExchange::ExchangeProp

Call this member function to exchange a property between the control and a storage medium. The functions CArchivePropExchange::ExchangePersistentProp, CResetPropExchange::ExchangePersistentProp, and CPropsetPropExchange::ExchangePersistentProp override this pure virtual function.

Syntax

virtual BOOL ExchangeProp( LPCTSTR pszPropName, VARTYPE vtProp, void* pvProp, const void* pvDefault = NULL ) = 0;

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Overview, CPropExchange Member Functions, Support Classes, COleControl::DoPropExchange, CPropExchange::ExchangeBlobProp, CPropExchange::ExchangeFontProp, CPropExchange::ExchangePersistentProp


CPropExchange::ExchangeVersion

This member function is called by the framework to handle persistence of a version number.

Syntax

BOOL ExchangeVersion( DWORD& dwVersionLoaded, DWORD dwVersionDefault, BOOL bConvert );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Overview, CPropExchange Member Functions, Support Classes, COleControl::ExchangeVersion


CPropExchange::GetVersion

Call this member function to retrieve the version number of the control.

Syntax

DWORD GetVersion( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Overview, CPropExchange Member Functions, Support Classes


CPropExchange::IsLoading

Call this member function to determine whether properties are being loaded to the control or stored from it.

Syntax

BOOL IsLoading( );

At a Glance

Header file: Afxctl.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CPropExchange Overview, CPropExchange Member Functions, Support Classes, COleControl::DoPropExchange


CPtrArray

The CPtrArray class supports arrays of void pointers.

The member functions of CPtrArray are similar to the member functions of class CObArray. Because of this similarity, you can use the CObArray reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Array Classes, CObArray


CPtrArray Class Members

Construction
CPtrArray Constructs an empty array for void pointers.

Bounds
GetSize | Gets number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.

Operations
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.

Element Access
GetAt | Returns the value at a given index.
SetAt | Sets the value for a given index; array is not allowed to grow.
ElementAt | Returns a temporary reference to the element pointer within the array.
GetData | Allows access to elements in the array. Can be NULL.

Growing the Array
SetAtGrow | Sets the value for a given index; grows the array if necessary.
Add | Adds an element to the end of the array; grows the array if necessary.
Append | Appends another array to the array; grows the array if necessary.
Copy | Copies another array to the array; grows the array if necessary.

Insertion/Removal
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.

Operators
operator [] Sets or gets the element at the specified index.

See Also

CPtrArray Overview, Array Classes


CPtrList

The CPtrList class supports lists of void pointers.

The member functions of CPtrList are similar to the member functions of class CObList. Because of this similarity, you can use the CObList reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, List Classes, CObList


CPtrList Class Members

Construction
CPtrList Constructs an empty list for void pointers.

Head/Tail Access
GetHead | Returns the head element of the list (cannot be empty).
GetTail | Returns the tail element of the list (cannot be empty).

Operations
RemoveHead | Removes the element from the head of the list.
RemoveTail | Removes the element from the tail of the list.
AddHead | Adds an element (or all the elements in another list) to the head of the list (makes a new head).
AddTail | Adds an element (or all the elements in another list) to the tail of the list (makes a new tail).
RemoveAll | Removes all the elements from this list.

Iteration
GetHeadPosition | Returns the position of the head element of the list.
GetTailPosition | Returns the position of the tail element of the list.
GetNext | Gets the next element for iterating.
GetPrev | Gets the previous element for iterating.

Retrieval/Modification
GetAt | Gets the element at a given position.
SetAt | Sets the element at a given position.
RemoveAt | Removes an element from this list, specified by position.

Insertion
InsertBefore | Inserts a new element before a given position.
InsertAfter | Inserts a new element after a given position.

Searching
Find | Gets the position of an element specified by pointer value.
FindIndex | Gets the position of an element specified by a zero-based index.

Status
GetCount | Returns the number of elements in this list.
IsEmpty | Tests for the empty list condition (no elements).

See Also

CPtrList Overview, List Classes


CRecentFileList

CRecentFileList is a CObject class that supports control of the most recently used (MRU) file list. Files can be added to or deleted from the MRU file list, the file list can be read from or written to the registry or an .INI file, and the menu displaying the MRU file list can be updated.

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Member Functions, CRecentFileList Operators, File Service Classes


CRecentFileList Member Functions

Construction
CRecentFileList Constructs a CRecentFileList object.

Attributes
GetSize Retrieves the number of files in the MRU file list.

Operations
Remove | Removes a file from the MRU file list.
Add | Adds a file to the MRU file list.
GetDisplayName | Provides a display name for menu display of an MRU filename.
UpdateMenu | Updates the menu display of the MRU file list.
ReadList | Reads the MRU file list from the registry or .INI file.
WriteList | Writes the MRU file list from the registry or .INI file.

See Also

CRecentFileList Overview, CRecentFileList Operators, File Service Classes


CRecentFileList::Add

Call this member function to add the file whose path is given in lpszPathName to the most recently used (MRU) file list. The file name will be added to the top of the MRU list. If the file name already exists in the MRU list, it will be moved to the top.

Syntax

virtual void Add( LPCTSTR lpszPathName );

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes, CRecentFileList::Remove, CRecentFileList::UpdateMenu


CRecentFileList::CRecentFileList

Use this member function to construct an object of class CRecentFileList.

Syntax

CRecentFileList( UINT nStart, LPCTSTR lpszSection, LPCTSTR lpszEntryFormat, int nSize, int nMaxDispLen = AFX_ABBREV_FILENAME_LEN );

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes


CRecentFileList::GetDisplayName

Call this member function to obtain the display name for a file in the most recently used (MRU) file list.

Syntax

BOOL GetDisplayName( CString& strName, int nIndex, LPCTSTR lpszCurDir, int nCurDir, BOOL bAtLeastName = TRUE) const;

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes, CRecentFileList::ReadList, CRecentFileList::WriteList


CRecentFileList::GetSize

Call this member function to retrieve the number of files in the most recently used (MRU) file list.

Syntax

int GetSize( ) const;

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes, CRecentFileList::Add, CRecentFileList::Remove


CRecentFileList::ReadList

Call this member function to read the most recently used (MRU) file list from the registry or the application's .INI file.

Syntax

virtual void ReadList( );

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes, CRecentFileList::WriteList


CRecentFileList::Remove

Call this member function to remove a file from the most recently used (MRU) file list.

Syntax

virtual void Remove( int nIndex );

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes, CRecentFileList::Add, CRecentFileList::UpdateMenu


CRecentFileList::UpdateMenu

Call this member function to update the menu display of the most recently used (MRU) file list.

Syntax

virtual void UpdateMenu( CCmdUI* pCmdUI );

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes, CRecentFileList::Add, CRecentFileList::Remove


CRecentFileList::WriteList

Call this member function to write the most recently used (MRU) file list into the registry or the application's .INI file.

Syntax

virtual void WriteList( );

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes, CRecentFileList::ReadList


CRecentFileList Operators

Operators
operator[] Returns a Cstring object at a given position.

See Also

CRecentFileList Overview, CRecentFileList Member Functions, File Service Classes


CRecentFileList::operator[ ]

Use the overloaded subscript ([]) operator to retrieve a single CString, specified by the zero-based index in nIndex, from the most recently used (MRU) file list.

CString& operator[ ]( int nIndex );

At a Glance

Header file: Afxadv.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRecentFileList Overview, CRecentFileList Operators, File Service Classes


CRect

The CRect class is similar to a Windows RECT structure. CRect also includes member functions to manipulate CRect objects and Windows RECT structures.

A CRect object can be passed as a function parameter wherever a RECT structure, LPCRECT, or LPRECT can be passed.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Member Functions, CRect Operators, Simple Value Types, CPoint, CSize, RECT


CRect Member Functions

Construction
CRect Constructs a CRect object.

Operations
Width | Calculates the width of CRect.
Height | Calculates the height of CRect.
Size | Calculates the size of CRect.
TopLeft | Returns the top-left point of CRect.
BottomRight | Returns the bottom-right point of CRect.
IsRectEmpty | Determines whether CRect is empty. CRect is empty if the width and/or height are 0.
IsRectNull | Determines whether the top, bottom, left, and right member variables are all equal to 0.
PtInRect | Determines whether the specified point lies within CRect.
SetRect | Sets the dimensions of CRect.
SetRectEmpty | Sets CRect to an empty rectangle (all coordinates equal to 0).
CopyRect | Copies the dimensions of a source rectangle to CRect.
EqualRect | Determines whether CRect is equal to the given rectangle.
InflateRect | Increases the width and height of CRect.
DeflateRect | Decreases the width and height of CRect.
NormalizeRect | Standardizes the height and width of CRect.
OffsetRect | Moves CRect by the specified offsets.
SubtractRect | Subtracts one rectangle from another.
IntersectRect | Sets CRect equal to the intersection of two rectangles.
UnionRect | Sets CRect equal to the union of two rectangles.

See Also

CRect Overview, CRect Operators, Simple Value Types


CRect::BottomRight

Call this member function to obtain a reference to a CPoint object that represents the coordinates of the bottom right corner of a CRect object.

You can use this function to either get or set the bottom right corner of the rectangle. Set the corner by using this function on the left side of the assignment operator.

Syntax

CPoint& BottomRight( );

const CPoint& BottomRight( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::TopLeft, CPoint


CRect::CopyRect

Call this member function to copy the lpSrcRect rectangle into a CRect object.

Syntax

void CopyRect( LPCRECT lpSrcRect );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::CRect, CRect::operator =, CRect::SetRect, CRect::SetRectEmpty


CRect::CRect

Use this constructor to construct a CRect object. If no arguments are given, left, top, right, and bottom members are not initialized.

Syntax

CRect( );

CRect( int l, int t, int r, int b );

CRect( const RECT& srcRect );

CRect( LPCRECT lpSrcRect );

CRect( POINT point, SIZE size );

CRect( POINT topLeft, POINT bottomRight );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::SetRect, CRect::CopyRect, CRect::operator =, CRect::SetRectEmpty


CRect::DeflateRect

Call this member function to deflate a CRect object by moving its sides toward its center.

Syntax

void DeflateRect( int x, int y );

void DeflateRect( SIZE size );

void DeflateRect( LPCRECT lpRect );

void DeflateRect( int l, int t, int r, int b );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::InflateRect, CRect::operator -, CRect::operator -=


CRect::EqualRect

Call this member function to determine whether two normalized rectangles have the same top, left, bottom, and right values.

Syntax

BOOL EqualRect( LPCRECT lpRect ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::operator ==, CRect::operator !=, CRect::NormalizeRect


CRect::Height

Call this member function to calculate the height of CRect by subtracting the top value from the bottom value. The resulting value can be negative.

Syntax

int Height( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::Width, CRect::Size, CRect::IsRectEmpty, CRect::IsRectNull, CRect::NormalizeRect


CRect::InflateRect

Call this member function to inflate a CRect object by moving its sides away from its center.

Syntax

void InflateRect( int x, int y );

void InflateRect( SIZE size );

void InflateRect( LPCRECT lpRect );

void InflateRect( int l, int t, int r, int b );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::DeflateRect, CRect::operator +, CRect::operator +=


CRect::IntersectRect

Call this member function to make a CRect object equal to the intersection of two existing rectangles. The intersection is the largest rectangle contained in both existing rectangles.

Syntax

BOOL IntersectRect( LPCRECT lpRect1, LPCRECT lpRect2 );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::operator &=, CRect::operator &, CRect::UnionRect, CRect::SubtractRect, CRect::NormalizeRect


CRect::IsRectEmpty

Call this member function to determine whether a CRect object is empty. A rectangle is empty if the width and/or height are 0 or negative. Differs from IsRectNull, which determines whether all coordinates of the rectangle are zero.

Syntax

BOOL IsRectEmpty( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::IsRectNull, CRect::SetRectEmpty, CRect::NormalizeRect


CRect::IsRectNull

Call this member function to determine whether the top, left, bottom, and right values of CRect are all equal to zero. This function differs from IsRectEmpty, which determines whether the rectangle is empty.

Syntax

BOOL IsRectNull( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::IsRectEmpty, CRect::SetRectEmpty


CRect::NormalizeRect

Call this member function to normalize a CRect object so both the height and width are positive. The function does a comparison of the top and bottom values, swapping them if the bottom is greater than the top. The same action is performed on the left and right values. This function is useful when dealing with different mapping modes and inverted rectangles.

Syntax

void NormalizeRect( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types


CRect::OffsetRect

Call this member function to move a CRect object by the specified offsets. Moves CRect x units along the x-axis and y units along the y-axis. The x and y parameters are signed values, so CRect can be moved left or right and up or down.

Syntax

void OffsetRect( int x, int y );

void OffsetRect( POINT point );

void OffsetRect( SIZE size );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::operator +, CRect::operator +=, CRect::operator -, CRect::operator -=


CRect::PtInRect

Call this member function to determine whether the specified point lies within the CRect object. A point is within CRect if it lies on the left or top side or is within all four sides. A point on the right or bottom side is outside CRect.

Syntax

BOOL PtInRect( POINT point ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::NormalizeRect


CRect::SetRect

Call this member function to set the dimensions of a CRect object to the specified coordinates.

Syntax

void SetRect( int x1, int y1, int x2, int y2 );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::CRect, CRect::operator =, CRect::CopyRect, CRect::SetRectEmpty


CRect::SetRectEmpty

Call this member function to make a CRect object a null rectangle by setting all coordinates to zero.

Syntax

void SetRectEmpty( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::CRect, CRect::SetRect, CRect::CopyRect, CRect::operator =, CRect::IsRectEmpty, CRect::IsRectNull


CRect::Size

Call this member function to retrieve the size of a CRect object. The cx and cy members of the return value contain the height and width of the CRect object. Either the height or width can be negative.

Syntax

CSize Size( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::Height, CRect::Width, CRect::IsRectEmpty, CRect::IsRectNull, CRect::NormalizeRect


CRect::SubtractRect

Call this member function to make the dimensions of the lpRectSrc1 rectangle equal to the subtraction of lpRectSrc2 from lpRectSrc1. The subtraction is the smallest rectangle that contains all of the points in lpRectScr1 that are not in the intersection of lpRectScr1 and lpRectScr2.

Syntax

BOOL SubtractRect( LPCRECT lpRectSrc1, LPCRECT lpRectSrc2 );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::operator -, CRect::operator -=, CRect::IntersectRect, CRect::UnionRect, CRect::NormalizeRect


CRect::TopLeft

Call this member function to obtain a reference to a CPoint object that represents the coordinates of the top left corner of a CRect object.

You can use this function to either get or set the top left corner of the rectangle. Set the corner by using this function on the left side of the assignment operator.

Syntax

CPoint& TopLeft( );

const CPoint& TopLeft( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::BottomRight, CPoint


CRect::UnionRect

Call this member function to make the dimensions of a CRect object equal to the union of the two source rectangles. The union is the smallest rectangle that contains both source rectangles.

Syntax

BOOL UnionRect( LPCRECT lpRect1, LPCRECT lpRect2 );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::operator |=, CRect::operator |, CRect::IntersectRect, CRect::SubtractRect, CRect::NormalizeRect


CRect::Width

Call this member function to calculate the width of a CRect object by subtracting the left value from the right value. The width can be negative.

Syntax

int Width( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Member Functions, Simple Value Types, CRect::Height, CRect::Size, CRect::IsRectEmpty, CRect::IsRectNull, CRect::NormalizeRect


CRect Operators

Operators
operator LPCRECT | Converts a CRect to an LPCRECT.
operator LPRECT | Converts a CRect to an LPRECT.
operator = | Copies the dimensions of a rectangle to CRect.
operator == | Determines whether CRect is equal to a rectangle.
operator != | Determines whether CRect is not equal to a rectangle.
operator += | Adds the specified offsets to CRect or inflates CRect.
operator –= | Subtracts the specified offsets from CRect or deflates CRect.
operator &= | Sets CRect equal to the intersection of CRect and a rectangle.
operator |= | Sets CRect equal to the union of CRect and a rectangle.
operator + | Adds the given offsets to CRect or inflates CRect and returns the resulting CRect.
operator – | Subtracts the given offsets from CRect or deflates CRect and returns the resulting CRect.
operator & | Creates the intersection of CRect and a rectangle and returns the resulting CRect.
operator | | Creates the union of CRect and a rectangle and returns the resulting CRect.

See Also

CRect Overview, CRect Member Functions, Simple Value Types


CRect::operator LPCRECT

Use this operator to convert a CRect object to an LPCRECT. When you use this function, you don't need the address-of (&) operator. This operator will be automatically used when you pass a CRect object to a function that expects an LPCRECT.

operator LPCRECT( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator LPRECT


CRect::operator LPRECT

Use this operator to convert a CRect object to an LPRECT. When you use this function, you don't need the address-of (&) operator. This operator will be automatically used when you pass a CRect object to a function that expects an LPRECT.

operator LPRECT( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator


CRect::operator =

Use this operator to assign the srcRect rectangle to a CRect object.

void operator =( const RECT& srcRect );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::CRect, CRect::SetRect, CRect::CopyRect, CRect::SetRectEmpty


CRect::operator ==

Use this operator to determine whether rect is equal to the CRect object by comparing the coordinates of their upper-left and lower-right corners.

BOOL operator ==( const RECT& rect ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator !=, CRect::NormalizeRect


CRect::operator !=

Use this operator to determine whether rect is not equal to the CRect object by comparing the coordinates of their upper-left and lower-right corners.

BOOL operator !=( const RECT& rect ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator ==, CRect::NormalizeRect


CRect::operator +=

Use this operator to move a CRect object by the specified offsets. The parameter's x and y (or cx and cy) values are added to CRect.

Use the third overloaded version of this operator to inflate CRect by the number of units specified in each member of the parameter.

void operator +=( POINT point );

void operator +=( SIZE size );

void operator +=( LPCRECT lpRect );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::OffsetRect, CRect::InflateRect, CRect::operator +, CRect::operator -=


CRect::operator -=

Use this operator to move a CRect object by the specified offsets. The parameter's x and y (or cx and cy) values are subtracted from CRect.

Use the third overloaded operator to deflate a CRect object by the number of units specified in each member of the parameter.

void operator –=( POINT point );

void operator –=( SIZE size );

void operator –=( LPCRECT lpRect );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::OffsetRect, CRect::DeflateRect, CRect::SubtractRect, CRect::operator -, CRect::operator +=


CRect::operator &=

Use this operator to set a CRect object equal to the intersection of itself and the argument passed in the rect parameter. The intersection is the largest rectangle that is contained in both rectangles.

void operator &=( const RECT& rect );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator &, CRect::operator |=, CRect::IntersectRect, CRect::NormalizeRect


CRect::operator |=

Use this operator to set a CRect object equal to the union of itself and the argument passed in the rect parameter. The union is the smallest rectangle that contains both source rectangles.

void operator |=( const RECT& rect );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator |, CRect::operator &=, CRect::UnionRect, CRect::NormalizeRect


CRect::operator +

Use this operator to obtain a CRect object that is equal to this CRect, but displaced by the specified offsets. The parameter's x and y (or cx and cy) parameters are added to CRect's position.

Use the third overloaded version of this function to obtain a new CRect object that is equal to this CRect object, but inflated by the number of units specified in each member of the size parameter.

CRect operator +( POINT point ) const;

CRect operator +( LPCRECT lpRect ) const;

CRect operator +( SIZE size ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator +=, CRect::operator -, CRect::OffsetRect, CRect::InflateRect


CRect::operator -

Use this operator to obtain a CRect object that is equal to this CRect, but displaced by the specified offsets. The parameter's x and y (or cx and cy) parameters are subtracted from CRect's position.

Use the third overloaded version of this function to obtain a new CRect object that is equal to this CRect object, but deflated by the number of units specified in each member of the lpRect parameter.

CRect operator –( POINT point ) const;

CRect operator –( SIZE size ) const;

CRect operator –( LPCRECT lpRect ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::operator -=, CRect::operator +, CRect::OffsetRect, CRect::DeflateRect, CRect::SubtractRect


CRect::operator &

Use this operator to obtain a CRect object that is the intersection of this CRect object and rect2. The intersection is the largest rectangle that is contained in both rectangles.

CRect operator &( const RECT& rect2 ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::IntersectRect, CRect::operator &=, CRect::operator |, CRect::NormalizeRect


CRect::operator |

Use this operator to obtain a CRect object that is the union of CRect and rect2. The union is the smallest rectangle that contains both rectangles.

CRect operator |( const RECT& rect2 ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CRect Overview, CRect Operators, Simple Value Types, CRect::UnionRect, CRect::operator |=, CRect::operator &, CRect::NormalizeRect


CRectTracker

The CRectTracker class allows an item to be displayed, moved, and resized in various ways.

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE does not support the SetCursor member function of the CRectTracker class.

See Also

CRectTracker Member Functions, CRectTracker Data Members, Support Classes, CRect, CRectTracker::GetHandleMask


CRectTracker Member Functions

Construction
CRectTracker Constructs a CRectTracker object.

Operations
Draw | Renders the rectangle.
GetTrueRect | Returns width and height of rectangle, including resize handles.
HitTest | Returns the current position of the cursor related to the CRectTracker object.
NormalizeHit | Normalizes a hit-test code.
Track | Allows the user to manipulate the rectangle.
TrackRubberBand | Allows the user to "rubber-band" the selection.

Overridables
AdjustRect | Called when the rectangle is resized.
DrawTrackerRect | Called when drawing the border of a CRectTracker object.
OnChangedRect | Called when the rectangle has been resized or moved.
GetHandleMask | Called to get the mask of a CRectTracker item's resize handles.

See Also

CRectTracker Overview, CRectTracker Data Members, Support Classes


CRectTracker::AdjustRect

This member function is called by the framework when the tracking rectangle is resized by using a resize handle. The default behavior of this function allows the rectangle's orientation to change only when Track and TrackRubberBand are called with inverting allowed.

Syntax

virtual void AdjustRect( int nHandle, LPRECT lpRect );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::Track, CRectTracker::TrackRubberBand, CRectTracker::OnChangedRect


CRectTracker::CRectTracker

Use this constructor to construct and initialize a CRectTracker object.

The default constructor initializes the CRectTracker object with the values from lpSrcRect and initializes other sizes to system defaults. If the object is created with no parameters, the m_rect and m_nStyle data members are uninitialized.

Syntax

CRectTracker( );

CRectTracker( LPCRECT lpSrcRect, UINT nStyle );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRect::CRect


CRectTracker::Draw

Call this member function to draw the rectangle's outer lines and inner region. The style of the tracker determines how the drawing is done.

Syntax

void Draw( CDC* pDC ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::DrawTrackerRect, CRectTracker::CRectTracker, CRect::NormalizeRect


CRectTracker::DrawTrackerRect

This member function is called by the framework whenever the position of the tracker has changed while inside the Track or TrackRubberBand member function. The default implementation makes a call to CDC::DrawFocusRect, which draws a dotted rectangle.

Override this function to provide different feedback during the tracking operation.

Syntax

virtual void DrawTrackerRect( LPCRECT lpRect, CWnd* pWndClipTo, CDC* pDC, CWnd* pWnd );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::Track, CRectTracker::TrackRubberBand, CDC::DrawFocusRect


CRectTracker::GetHandleMask

This member function is called by the framework to retrieve the mask for a rectangle's resize handles.

The resize handles appear on the sides and corners of the rectangle and allow the user to control the shape and size of the rectangle.

Syntax

virtual UINT GetHandleMask( ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::AdjustRect


CRectTracker::GetTrueRect

Call this member function to retrieve the coordinates of the rectangle. The dimensions of the rectangle include the height and width of any resize handles located on the outer border. Upon returning, *lpTrueRect is always a normalized rectangle in device coordinates.

Syntax

void GetTrueRect( LPRECT lpTrueRect ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRect::NormalizeRect


CRectTracker::HitTest

Call this member function to find out whether the user has grabbed a resize handle.

Syntax

int HitTest( CPoint point ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::NormalizeHit


CRectTracker::NormalizeHit

Call this member function to convert a potentially inverted handle.

Syntax

int NormalizeHit( int nHandle ) const;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::HitTest, CRectTracker::Track, CRectTracker::TrackRubberBand


CRectTracker::OnChangedRect

This member function is called by the framework whenever the tracker rectangle has changed during a call to Track. At the time this function is called, all feedback drawn with DrawTrackerRect has been removed. The default implementation of this function does nothing.

Syntax

virtual void OnChangedRect( const CRect& rectOld );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::AdjustRect, CRectTracker::Track, CRectTracker::TrackRubberBand


CRectTracker::Track

Call this member function to display the user interface for resizing the rectangle. This is usually called from inside the function of your application that handles the WM_LBUTTONDOWN message (typically OnLButtonDown).

This function will capture the mouse until the user releases the left mouse button, presses the ESC key, or presses the right mouse button. As the user moves the mouse cursor, the feedback is updated by calling DrawTrackerRect and OnChangedRect.

Syntax

BOOL Track( CWnd* pWnd, CPoint point, BOOL bAllowInvert = FALSE, CWnd* pWndClipTo = NULL );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::DrawTrackerRect, CRectTracker::OnChangedRect, CRectTracker::CRectTracker, CRectTracker::TrackRubberBand


CRectTracker::TrackRubberBand

Call this member function to do rubber-band selection. It is usually called from inside the function of your application that handles the WM_LBUTTONDOWN message (typically OnLButtonDown).

This function will capture the mouse until the user releases the left mouse button, presses the ESC key, or presses the right mouse button. As the user moves the mouse cursor, the feedback is updated by calling DrawTrackerRect and OnChangedRect.

Syntax

BOOL TrackRubberBand( CWnd* pWnd, CPoint point, BOOL bAllowInvert = TRUE );

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Member Functions, Support Classes, CRectTracker::DrawTrackerRect, CRectTracker::OnChangedRect, CRectTracker::CRectTracker


CRectTracker Data Members

Data Members
m_nHandleSize | Determines size of resize handles.
m_rect | Current position (in pixels) of the rectangle.
m_sizeMin | Determines minimum rectangle width and height.
m_nStyle | Current style(s) of the tracker.

CRectTracker Overview, CRectTracker Member Functions, Support Classes


CRectTracker::m_nHandleSize

This data member contains an integer that represents the size, in pixels, of the CRectTracker resize handles.

int m_nHandleSize;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Data Members, Support Classes


CRectTracker::m_rect

This data member contains a CRect object that represents the current position of the rectangle in client coordinates (pixels).

CRect m_rect;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Data Members, Support Classes, CRectTracker::CRectTracker, CRectTracker::Track, CRectTracker::TrackRubberBand, CRect


CRectTracker::m_sizeMin

This data member contains a CSize object that represents the minimum size of the rectangle. This data member is used only by the AdjustRect member function.

CSize m_sizeMin;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Data Members, Support Classes, CRectTracker::Track, CRectTracker::TrackRubberBand, CRectTracker::AdjustRect, CSize


CRectTracker::m_nStyle

This data member contains a constant that represents the current style of the rectangle. See CRectTracker::CRectTracker for a list of possible styles.

UINT m_nStyle;

At a Glance

Header File | Afxext.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRectTracker Overview, CRectTracker Data Members, Support Classes, CRectTracker::CRectTracker, CRectTracker::Draw


CResourceException

A CResourceException object is generated when Windows cannot find or allocate a requested resource. No further qualification is necessary or possible.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CResourceException Member Functions, Exception Classes


CResourceException Member Functions

Construction
CResourceException Constructs a CResourceException object.

See Also

CResourceException Overview, Exception Classes


CResourceException::CResourceException

Use this member function to construct a CResourceException object.

Syntax

CResourceException( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CResourceException Overview, CResourceException Member Functions, Exception Classes


CRgn

The CRgn class encapsulates a Windows graphics device interface (GDI) region. A region is an elliptical or polygonal area within a window.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE supports the following member functions of the CRgn class differently than the standard MFC library does.

CRgn::CreateRectRgnIndirect

CRgn::GetRegionData

CRgn::SetRectRgn

Windows CE doesn't support the following member functions of the CRgn class.

CreateEllipticRgn

CreateEllipticRgnIndirect

CreatePolygonRgn

CreatePolyPolygonRgn

CreateRoundRectRgn

CreateFromPath

CreateFromData

Note Windows CE version 1.0 represents regions using 16-bit values.

See Also

CRgn Member Functions, CRgn Operators, Graphical Drawing Object Classes


CRgn Member Functions

Construction
CRgn Constructs a CRgn object.

Initialization
CreateRectRgn | Initializes a CRgn object with a rectangular region.
CreateRectRgnIndirect | Initializes a CRgn object with a rectangular region defined by a RECT structure.
CombineRgn | Sets a CRgn object so that it is equivalent to the union of two specified CRgn objects.
CopyRgn | Sets a CRgn object so that it is a copy of a specified CRgn object.

Operations
EqualRgn | Checks two CRgn objects to determine whether they are equivalent.
FromHandle | Returns a pointer to a CRgn object when given a handle to a Windows region.
GetRegionData | Fills the specified buffer with data describing the given region.
GetRgnBox | Retrieves the coordinates of the bounding rectangle of a CRgn object.
OffsetRgn | Moves a CRgn object by the specified offsets.
PtInRegion | Determines whether a specified point is in the region.
RectInRegion | Determines whether any part of a specified rectangle is within the boundaries of the region.
SetRectRgn | Sets the CRgn object to the specified rectangular region.

See Also

CRgn Overview, CRgn Operators, Graphical Drawing Object Classes


CRgn::CombineRgn

Call this member function to create a new GDI region by combining two existing regions.

Syntax

int CombineRgn( CRgn* pRgn1, CRgn* pRgn2, int nCombineMode );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes, CRgn::CopyRgn


CRgn::CopyRgn

Call this member function to copy the region defined by pRgnSrc into the CRgn object.

Syntax

int CopyRgn( CRgn* pRgnSrc );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes, CRgn::CombineRgn


CRgn::CreateRectRgn

Call this member function to create a rectangular region that is stored in the CRgn object.

Syntax

BOOL CreateRectRgn( int x1, int y1, int x2, int y2 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes, CRgn::CreateRectRgnIndirect


CRgn::CreateRectRgnIndirect

Call this member function to create a rectangular region that is stored in the CRgn object.

Syntax

BOOL CreateRectRgnIndirect ( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE version 1.0 represents regions using 16-bit values.

In Windows CE versions 2.0 and later, this function is exactly the same as it is in the standard MFC library.

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes, CRgn::CreateRectRgn


CRgn::CRgn

Use this constructor to construct a CRgn object.

Syntax

CRgn( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::EqualRgn

Call this member function to determine whether the given region is equivalent to the region stored in the CRgn object.

Syntax

BOOL EqualRgn( CRgn* pRgn ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::FromHandle

Call this member function to obtain a pointer to a CRgn object when you have a handle to a Windows region.

Syntax

static CRgn* PASCAL FromHandle( HRGN hRgn );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::GetRegionData

Call this member function to fill the specified buffer with data describing the region. The data includes the dimensions of the rectangles that make up the region.

Syntax

Int GetRegionData ( LPRGNDATA lpRgnData, int nCount ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE version 1.0 represents regions differently than other platforms. A Windows CE 1.0 implementation of CRgn::GetRegionData may return a greater number of rectangles representing a region than Windows 95 and Windows NT.

In Windows CE versions 2.0 and later, this function is exactly the same as it is in the standard MFC library.

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::GetRgnBox

Call this member function to retrieve the coordinates of the bounding rectangle of the CRgn object.

Syntax

int GetRgnBox( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::OffsetRgn

Call this member function to move the region stored in the CRgn object by the specified offsets.

Syntax

int OffsetRgn( int x, int y );

int OffsetRgn( POINT point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::PtInRegion

Call this member function to check whether the point given by x and y is in the region stored in the CRgn object.

Syntax

BOOL PtInRegion( int x, int y ) const;

BOOL PtInRegion( POINT point ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::RectInRegion

Call this member function to determine whether any part of the rectangle specified by lpRect is within the boundaries of the region stored in the CRgn object.

Syntax

BOOL RectInRegion( LPCRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::SetRectRgn

Call this member function to create a rectangular region. The CRgn object must already have been initialized before calling SetRectRgn.

Syntax

void SetRectRgn ( int x1, int y1, int x2, int y2 );

void SetRectRgn( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The CRgn::SetRectRgn memeber function is included for compatibility with existing code. The CRgn::SetRectRgn member function in Windows CE just calls CRgn::CreateRectRgn; you don't save a memory allocation by using this function.

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes, CRgn::CreateRectRgn


CRgn Operators

Operators
operator HRGN Returns the Windows handle contained in the CRgn object.

See Also

CRgn Overview, CRgn Member Functions, Graphical Drawing Object Classes


CRgn::operator HRGN

Use this operator to get the attached Windows GDI handle to the CRgn object.

operator HRGN( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CRgn Overview, CRgn Operators, Graphical Drawing Object Classes


CRuntimeClass

CRuntimeClass is a structure you can use to obtain information about an object or its base class at run time. The ability to determine the class of an object at run time is useful when extra type checking of function arguments is needed, or when you must write special-purpose code based on the class of an object. Each class derived from CObject is associated with a CRuntimeClass structure.

Syntax

struct CRuntimeClass
{
LPCSTR m_lpszClassName;
int m_nObjectSize;
UINT m_wSchema
CObject* (PASCAL* m_pfnCreateObject)( );
CRuntimeClass* (PASCAL* m_pfnGetBaseClass)( );
CRuntimeClass* m_pBaseClass;
CObject* CreateObject( );
BOOL IsDerivedFrom(const CRuntimeClass* pBaseClass) const;
};

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Run-Time Object Model Support, CObject::GetRuntimeClass, CObject::IsKindOf


CScrollBar

The CScrollBar class encapsulates the functionality of a Windows scroll bar, which is a rectangular control that contains a scroll box (or thumb) and has direction arrows at both ends. A user can scroll through a document by tapping the arrows with the stylus or by dragging the scroll box.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Member Functions, Control Classes, CWnd, CButton, CComboBox, CEdit, CListBox, CStatic, CDialog


CScrollBar Member Functions

Construction
CScrollBar Constructs a CScrollBar object.

Initialization
Create Creates the Windows scroll bar and attaches it to the CScrollBar object.

Operations
GetScrollPos | Retrieves the current position of a scroll box.
SetScrollPos | Sets the current position of a scroll box.
GetScrollRange | Retrieves the current minimum and maximum scroll-bar positions for the given scroll bar.
SetScrollRange | Sets minimum and maximum position values for the given scroll bar.
ShowScrollBar | Shows or hides a scroll bar.
EnableScrollBar | Enables or disables one or both arrows of a scroll bar.
SetScrollInfo | Sets information about the scroll bar.
GetScrollInfo | Retrieves information about the scroll bar.
GetScrollLimit | Retrieves the limit of the scroll bar

See Also

CScrollBar Overview, Control Classes


CScrollBar::Create

Call this member function to create and initializes a Windows scroll bar and attach it to the CScrollBar object

You construct a CScrollBar object in two steps. First call the constructor, which constructs the CScrollBar object; then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the SBS_SIZEGRIP style. For more information on scrollbar styles, see Scroll Bar Styles.

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::CScrollBar


CScrollBar::CScrollBar

Call this member function to construct a CScrollBar object. After constructing the object, call the Create member function to create and initialize the Windows scroll bar.

Syntax

CScrollBar( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::Create


CScrollBar::EnableScrollBar

Call this member function to enable or disable one or both arrows of a scroll bar.

Syntax

BOOL EnableScrollBar( UINT nArrowFlags = ESB_ENABLE_BOTH );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes


CScrollBar::GetScrollInfo

Call this member function to retrieve the information that the SCROLLINFO structure maintains about a scroll bar. GetScrollInfo enables applications to use 32-bit scroll positions.

Syntax

BOOL GetScrollInfo( LPSCROLLINFO lpScrollInfo, UINT nMask );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::SetScrollInfo, CWnd::SetScrollInfo, CWnd::SetScrollPos, CWnd::OnVScroll, CWnd::OnHScroll, SCROLLINFO


CScrollBar::GetScrollLimit

Call this member function to retrieve the maximum scrolling position of the scroll bar.

Syntax

int GetScrollLimit( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CWnd::GetScrollLimit


CScrollBar::GetScrollPos

Call this member function to retrieve the current position of a scroll box. The current position is a relative value that depends on the current scrolling range. For example, if the scrolling range is 100 to 200 and the scroll box is in the middle of the bar, the current position is 150.

Syntax

int GetScrollPos( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::SetScrollPos, CScrollBar::GetScrollRange, CScrollBar::SetScrollRange


CScrollBar::GetScrollRange

Call this member function to copy the current minimum and maximum scroll-bar positions for the given scroll bar to the locations specified by lpMinPos and lpMaxPos.

The default range for a scroll-bar control is empty (both values are 0).

Syntax

void GetScrollRange( LPINT lpMinPos, LPINT lpMaxPos ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, ::GetScrollRange, CScrollBar::SetScrollRange, CScrollBar::GetScrollPos, CScrollBar::SetScrollPos


CScrollBar::SetScrollInfo

Call this member function to set the information that the SCROLLINFO structure maintains about a scroll bar. You must provide the values required by the SCROLLINFO structure parameters, including the flag values.

Syntax

BOOL SetScrollInfo( LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::GetScrollInfo, CWnd::SetScrollInfo, CWnd::SetScrollPos, CWnd::OnVScroll, CWnd::OnHScroll, CWnd::GetScrollInfo, SCROLLINFO


CScrollBar::SetScrollPos

Call this member function to set the current position of a scroll box to that specified by nPos, and redraw the scroll bar to reflect the new position.

Set bRedraw to FALSE whenever the scroll bar will be redrawn by a subsequent call to another function to avoid having the scroll bar redrawn twice within a short interval.

Syntax

int SetScrollPos( int nPos, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::GetScrollPos, CScrollBar::GetScrollRange, CScrollBar::SetScrollRange


CScrollBar::SetScrollRange

Call this member function to set minimum and maximum position values for the given scroll bar. Set nMinPos and nMaxPos to 0 to hide standard scroll bars.

Do not Call this member function to hide a scroll bar while processing a scroll-bar notification message.

Syntax

void SetScrollRange( int nMinPos, int nMaxPos, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::GetScrollPos, CScrollBar::SetScrollPos, CScrollBar::GetScrollRange


CScrollBar::ShowScrollBar

Call this member function to show or hide a scroll bar.

An application should not Call this member function to hide a scroll bar while processing a scroll-bar notification message.

Syntax

void ShowScrollBar( BOOL bShow = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CScrollBar Overview, CScrollBar Member Functions, Control Classes, CScrollBar::GetScrollPos, CScrollBar::GetScrollRange, CWnd::ScrollWindow, CScrollBar::SetScrollPos, CScrollBar::SetScrollRange


CScrollView

The CScrollView class is a CView with scrolling capabilities.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Member Functions, View Classes, CView, CSplitterWnd


CScrollView Member Functions

Construction
CScrollView Constructs a CScrollView object.

Operations
FillOutsideRect | Fills the area of a view outside the scrolling area.
GetDeviceScrollPosition | Gets the current scroll position in device units.
GetDeviceScrollSizes | Gets the current mapping mode, the total size, and the line and page sizes of the scrollable view. Sizes are in device units.
GetScrollPosition | Gets the current scroll position in logical units.
GetTotalSize | Gets the total size of the scroll view in logical units.
ResizeParentToFit | Causes the size of the view to dictate the size of its frame.
ScrollToPosition | Scrolls the view to a given point, specified in logical units.
SetScaleToFitSize | Puts the scroll view into scale-to-fit mode.
SetScrollSizes | Sets the scroll view's mapping mode, total size, and horizontal and vertical scroll amounts.

See Also

CScrollView Overview, View Classes


CScrollView::CScrollView

Use this constructor to construct a CScrollView object. You must call either SetScrollSizes or SetScaleToFitSize before the scroll view is usable.

Syntax

CScrollView( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::SetScrollSizes, CScrollView::SetScaleToFitSize


CScrollView::FillOutsideRect

Call this member function to fill the area of the view that appears outside of the scrolling area. Use FillOutsideRect in your scroll view's OnEraseBkgnd handler function to prevent excessive background repainting.

Syntax

void FillOutsideRect( CDC* pDC, CBrush* pBrush );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CWnd::OnEraseBkgnd


CScrollView::GetDeviceScrollPosition

Call this member function to retrieve the current horizontal and vertical positions of the scroll boxes in the scroll bars.

Syntax

CPoint GetDeviceScrollPosition( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::GetScrollPosition


CScrollView::GetDeviceScrollSizes

Call this member function to retrieve the current mapping mode, the total size, and the line and page sizes of the scrollable view.

Syntax

void GetDeviceScrollSizes( int& nMapMode, SIZE& sizeTotal, SIZE& sizePage, SIZE& sizeLine ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::SetScrollSizes, CScrollView::GetTotalSize


CScrollView::GetScrollPosition

Call this member function to retrieve the current horizontal and vertical positions of the scroll boxes in the scroll bars.

Syntax

CPoint GetScrollPosition( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::GetDeviceScrollPosition


CScrollView::GetTotalSize

Call this member function to retrieve the current horizontal and vertical sizes of the scroll view.

Syntax

CSize GetTotalSize( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::GetDeviceScrollSizes, CScrollView::SetScrollSizes


CScrollView::ResizeParentToFit

Call this member function to allow the size of your view to dictate the size of its frame window.

Syntax

void ResizeParentToFit( BOOL bShrinkOnly = TRUE );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CView::OnInitialUpdate, CScrollView::SetScrollSizes


CScrollView::ScrollToPosition

Call this member function to scroll to a given point in the view. The view is scrolled so that this point is at the upper-left corner of the window. This member function must not be called if the view is scaled to fit.

Syntax

void ScrollToPosition( POINT pt );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::GetDeviceScrollPosition, CScrollView::SetScaleToFitSize, CScrollView::SetScrollSizes


CScrollView::SetScaleToFitSize

Call this member function to scale the viewport size to the current window size automatically.

Syntax

void SetScaleToFitSize( SIZE sizeTotal );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::SetScrollSizes, CView::OnInitialUpdate


CScrollView::SetScrollSizes

Call this member function when the view is about to be updated. Call it in your override of the OnUpdate member function to adjust scrolling characteristics when, for example, the document is initially displayed or when it changes size.

Syntax

void SetScrollSizes( int nMapMode, SIZE sizeTotal, const SIZE& sizePage = sizeDefault, const SIZE& sizeLine = sizeDefault );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CScrollView Overview, CScrollView Member Functions, View Classes, CScrollView::SetScaleToFitSize, CScrollView::GetDeviceScrollSizes, CScrollView::GetTotalSize


CSingleDocTemplate

The CSingleDocTemplate class defines a document template that implements the single document interface (SDI). An SDI application uses the main frame window to display a document; only one document can be open at a time.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSingleDocTemplate Class Members, Application Architecture Classes, CDocTemplate, CDocument, CFrameWnd, CView, CWinApp


CSingleDocTemplate Class Members

Construction
CSingleDocTemplate Constructs a CSingleDocTemplate object.

See Also

CSingleDocTemplate Overview, Application Architecture Classes


CSingleDocTemplate::CSingleDocTemplate

Call this member function to construct a CSingleDocTemplate object. You dynamically allocate a CSingleDocTemplate object, and pass it to CWinApp::AddDocTemplate from within the CWinApp::InitInstance member function of your application class.

Syntax

CSingleDocTemplate( UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSingleDocTemplate Overview, CSingleDocTemplate Class Members, Application Architecture Classes, CDocTemplate::GetDocString, CWinApp::AddDocTemplate, CWinApp::InitInstance, CRuntimeClass


CSingleLock

An object of class CSingleLock represents the access-control mechanism used in controlling access to a resource in a multithreaded program.

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSingleLock Member Functions, Synchronization Support


CSingleLock Member Functions

Construction
CSingleLock Constructs a CSingleLock object.

Methods
IsLocked | Determines if the object is locked.
Lock | Waits on a synchronization object.
Unlock | Releases a synchronization object.

See Also

CSingleLock Overview, Synchronization Support


CSingleLock::CSingleLock

Use this constructor to construct a CSingleLock object. This function is generally called from within an access member function of the controlled resource.

Syntax

CSingleLock( CSyncObject* pObject, BOOL bInitialLock = FALSE );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSingleLock Overview, CSingleLock Member Functions, Synchronization Support


CSingleLock::IsLocked

Call this member function to determine whether the object associated with the CSingleLock object is nonsignaled (unavailable).

Syntax

BOOL IsLocked( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSingleLock Overview, CSingleLock Member Functions, Synchronization Support


CSingleLock::Lock

Call this member function to gain access to the resource controlled by the synchronization object supplied to the CSingleLock constructor.

Syntax

BOOL Lock( DWORD dwTimeOut = INFINITE );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSingleLock Overview, CSingleLock Member Functions, Synchronization Support


CSingleLock::Unlock

Call this member function to release the synchronization object owned by CSingleLock. This function is called by CSingleLock's destructor. If you need to release more than one access count of a semaphore, use the second form of Unlock and specify the number of accesses to release.

Syntax

BOOL Unlock( );

BOOL Unlock( LONG lCount, LPLONG lPrevCount = NULL );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSingleLock Overview, CSingleLock Member Functions, Synchronization Support


CSize

The CSize class is similar to the Windows SIZE structure, which implements a relative coordinate or position.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Member Functions, CSize Operators, Simple Value Types, CRect, CPoint


CSize Member Functions

Construction
CSize Constructs a CSize object.

See Also

CSize Overview, CSize Operators, Simple Value Types


CSize::CSize

Use this constructor to construct a CSize object. If no arguments are given, cx and cy members are not initialized.

Syntax

CSize( );

CSize( int initCX, int initCY );

CSize( SIZE initSize );

CSize( POINT initPt );

CSize( DWORD dwSize );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Overview, CSize Member Functions, Simple Value Types


CSize Operators

Operators
operator == | Checks for equality between CSize and a size.
operator != | Checks for inequality between CSize and a size.
operator += | Adds a size to CSize.
operator –= | Subtracts a size from CSize.

Operators Returning CSize Values
operator + | Adds two sizes.
operator – | Subtracts two sizes.

See Also

CSize Overview, CSize Member Functions, Simple Value Types


CSize::operator ==

Use this operator to check for equality between two sizes.

BOOL operator ==( SIZE size ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Overview, CSize Operators, Simple Value Types, CSize::operator !=


CSize::operator !=

Use this operator to check for inequality between two sizes.

BOOL operator !=( SIZE size ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Overview, CSize Operators, Simple Value Types, CSize::operator ==


CSize::operator +=

Use this operator to add a size to this CSize object.

void operator +=( SIZE size );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Overview, CSize Operators, Simple Value Types, CSize::operator +


CSize::operator -=

Use this operator to subtract a size from this CSize object.

void operator –=( SIZE size );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Overview, CSize Operators, Simple Value Types, CSize::operator -


CSize::operator +

Use these operators to add to the value of parameter to this CSize object.

CSize operator +( SIZE size ) const;

CPoint operator +( POINT point ) const;

CRect operator +( const RECT* lpRect ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Overview, CSize Operators, Simple Value Types, CPoint::operator +, CRect::operator +


CSize::operator -

Use these operators to subtract the value of parameter from this CSize object. Use the fourth operator, the unary minus, to change the sign of the CSize value.

CSize operator –( SIZE size ) const;

CPoint operator –( POINT point ) const;

CRect operator –( const RECT* lpRect ) const;

CSize operator –( ) const;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSize Overview, CSize Operators, Simple Value Types, CPoint::operator -, CRect::operator -


CSliderCtrl

A slider control (also known as a trackbar) is a window containing a slider and optional tick marks. When the user moves the slider, using either the mouse or the direction keys, the control sends notification messages to indicate the change.

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Member Functions, Control Classes, CProgressCtrl


CSliderCtrl Member Functions

Construction
CSliderCtrl | Constructs a CSliderCtrl object.
Create | Creates a slider control and attaches it to a CSliderCtrl object.

Attributes
GetLineSize | Retrieves the line size of a slider control.
SetLineSize | Sets the line size of a slider control.
GetPageSize | Retrieves the page size of a slider control.
SetPageSize | Sets the page size of a slider control.
GetRangeMax | Retrieves the maximum position for a slider.
GetRangeMin | Retrieves the minimum position for a slider.
GetRange | Retrieves the minimum and maximum positions for a slider.
SetRangeMin | Sets the minimum position for a slider.
SetRangeMax | Sets the maximum position for a slider.
SetRange | Sets the minimum and maximum positions for a slider.
GetSelection | Retrieves the range of the current selection.
SetSelection | Sets the range of the current selection.
GetChannelRect | Retrieves the size of the slider control's channel.
GetThumbRect | Retrieves the size of the slider control's thumb.
GetPos | Retrieves the current position of the slider.
SetPos | Sets the current position of the slider.
GetNumTics | Retrieves the number of tick marks in a slider control.
GetTicArray | Retrieves the array of tick mark positions for a slider control.
GetTic | Retrieves the position of the specified tick mark.
GetTicPos | Retrieves the position of the specified tick mark, in client coordinates.
SetTic | Sets the position of the specified tick mark.
SetTicFreq | Sets the frequency of tick marks per slider control increment.

Operations
ClearSel | Clears the current selection in a slider control.
VerifyPos | Verifies that the position of a slider control is zero.
ClearTics | Removes the current tick marks from a slider control.

See Also

CSliderCtrl Overview, Control Classes


CSliderCtrl::ClearSel

Call this member function to clear the current selection in a slider control.

Syntax

void ClearSel( BOOL bRedraw = FALSE );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetSelection, CSliderCtrl::SetSelection


CSliderCtrl::ClearTics

Call this member function to remove the current tick marks from a slider control.

Syntax

void ClearTics( BOOL bRedraw = FALSE );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetTicArray, CSliderCtrl::GetTic, CSliderCtrl::GetNumTics


CSliderCtrl::Create

Call this member function to create a slider control and attach it to the CSliderCtrl object.

You construct a CSliderCtrl in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::CSliderCtrl


CSliderCtrl::CSliderCtrl

Use this constructor to construct a CSliderCtrl object.

Syntax

CSliderCtrl( );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::Create


CSliderCtrl::GetChannelRect

Call this member function to retrieve the size and position of the bounding rectangle for a slider control's channel. The channel is the area over which the slider moves and which contains the highlight when a range is selected.

Syntax

void GetChannelRect( LPRECT lprc ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetThumbRect


CSliderCtrl::GetLineSize

Call this member function to retrieve the size of the line for a slider control. The line size affects how much the slider moves for the TB_LINEUP and TB_LINEDOWN notifications. The default setting for the line size is 1.

Syntax

int GetLineSize( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetLineSize, CSliderCtrl::GetPageSize


CSliderCtrl::GetNumTics

Call this member function to retrieve the number of tick marks in a slider control.

Syntax

UINT GetNumTics( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetTicArray, CSliderCtrl::GetTic, CSliderCtrl::GetTicPos, CSliderCtrl::SetTicFreq, CSliderCtrl::ClearTics


CSliderCtrl::GetPageSize

Call this member function to retrieve the size of the page for a slider control. The page size affects how much the slider moves for the TB_PAGEUP and TB_PAGEDOWN notifications.

Syntax

int GetPageSize( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetLineSize, CSliderCtrl::SetPageSize


CSliderCtrl::GetPos

Call this member function to retrieve the current position of the slider in a slider control.

Syntax

int GetPos( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetPos, CSliderCtrl::GetTicPos


CSliderCtrl::GetRange

Call this member function to retrieve the maximum and minimum positions for the slider in a slider control. This function copies the values into the integers referenced by nMin and nMax.

Syntax

void GetRange( int& nMin, int& nMax ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetRangeMin, CSliderCtrl::GetRangeMax, CSliderCtrl::SetRange


CSliderCtrl::GetRangeMax

Call this member function to retrieve the maximum position for the slider in a slider control.

Syntax

int GetRangeMax( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetRangeMin, CSliderCtrl::GetRange, CSliderCtrl::SetRange


CSliderCtrl::GetRangeMin

Call this member function to retrieve the minimum position for the slider in a slider control.

Syntax

int GetRangeMin( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetRange, CSliderCtrl::GetRangeMax, CSliderCtrl::SetRange


CSliderCtrl::GetSelection

Call this member function to retrieve the starting and ending positions of the current selection in a slider control.

Syntax

void GetSelection( int& nMin, int& nMax ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetSelection, CSliderCtrl::ClearSel


CSliderCtrl::GetThumbRect

Call this member function to retrieve the size and position of the bounding rectangle for the slider (thumb) in a slider control.

Syntax

void GetThumbRect( LPRECT lprc ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetChannelRect


CSliderCtrl::GetTic

Call this member function to retrieve the position of a tick mark in a slider control.

Syntax

int GetTic( int nTic ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetTic, CSliderCtrl::GetTicArray, CSliderCtrl::GetTicPos, CSliderCtrl::SetTicFreq, CSliderCtrl::ClearTics


CSliderCtrl::GetTicArray

Call this member function to retrieve the address of the array containing the positions of tick marks for a slider control.

Syntax

DWORD* GetTicArray( ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetTic, CSliderCtrl::GetTic, CSliderCtrl::GetTicPos, CSliderCtrl::SetTicFreq, CSliderCtrl::ClearTics


CSliderCtrl::GetTicPos

Call this member function to retrieve the current physical position of a tick mark in a slider control.

Syntax

int GetTicPos( int nTic ) const;

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetTic, CSliderCtrl::GetTic, CSliderCtrl::SetTicFreq, CSliderCtrl::ClearTics


CSliderCtrl::SetLineSize

Call this member function to set the size of the line for a slider control. The line size affects how much the slider moves for the TB_LINEUP and TB_LINEDOWN notifications.

Syntax

int SetLineSize( int nSize );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetLineSize, CSliderCtrl::SetPageSize


CSliderCtrl::SetPageSize

Call this member function to set the size of the page for a slider control. The page size affects how much the slider moves for the TB_PAGEUP and TB_PAGEDOWN notifications.

Syntax

int SetPageSize( int nSize );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetPageSize, CSliderCtrl::GetLineSize


CSliderCtrl::SetPos

Call this member function to set the current position of the slider in a slider control.

Syntax

void SetPos( int nPos );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetPos, CSliderCtrl::SetTic, CSliderCtrl::VerifyPos


CSliderCtrl::SetRange

Call this member function to set the range (minimum and maximum positions) for the slider in a slider control.

Syntax

void SetRange( int nMin, int nMax, BOOL bRedraw = FALSE );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetRange, CSliderCtrl::SetRangeMax, CSliderCtrl::SetRangeMin


CSliderCtrl::SetRangeMax

Call this member function to set the maximum range for the slider in a slider control.

Syntax

void SetRangeMax( int nMax, BOOL bRedraw = FALSE );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetRange, CSliderCtrl::GetRangeMax, CSliderCtrl::SetRangeMin


CSliderCtrl::SetRangeMin

Call this member function to set the minimum range for the slider in a slider control.

Syntax

void SetRangeMin( int nMin, BOOL bRedraw = FALSE );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::SetRange, CSliderCtrl::GetRangeMin, CSliderCtrl::SetRangeMax


CSliderCtrl::SetSelection

Call this member function to set the starting and ending positions for the current selection in a slider control.

Syntax

void SetSelection( int nMin, int nMax );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetSelection, CSliderCtrl::ClearSel


CSliderCtrl::SetTic

Call this member function to set the position of a tick mark in a slider control.

Syntax

BOOL SetTic( int nTic );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetTic, CSliderCtrl::GetTicArray, CSliderCtrl::GetTicPos, CSliderCtrl::SetTicFreq, CSliderCtrl::ClearTics


CSliderCtrl::SetTicFreq

Call this member function to set the frequency with which tick marks are displayed in a slider.

Syntax

void SetTicFreq( int nFreq );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::Create, CSliderCtrl::SetTic, CSliderCtrl::GetTicArray


CSliderCtrl::VerifyPos

Call this member function to verify that the current position of the slider in a slider control is between the minimum and maximum values.

Syntax

void VerifyPos( );

At a Glance

Header file: Afxcmn.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSliderCtrl Overview, CSliderCtrl Member Functions, Control Classes, CSliderCtrl::GetRange, CSliderCtrl::SetPos, CSliderCtrl::GetTicPos


CSocket

The CSocket class derives from CAsyncSocket and inherits its encapsulation of the Windows Sockets API. A CSocket object represents a higher level of abstraction of the Windows Sockets API than that of a CAsyncSocket object. CSocket works with classes CSocketFile and CArchive to manage the sending and receiving of data.

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

Remarks

Use the new CCeSocket class, instead of CSocket, when writing applications for Windows CE.

See Also

CSocket Member Functions, Windows Sockets Classes, CArchive, CAsyncSocket, CSocketFile


CSocket Member Functions

Construction
CSocket | Constructs a CSocket object.
Create | Creates a socket.

Attributes
Attach | Attaches a SOCKET handle to a CSocket object.
FromHandle | Returns a pointer to a CSocket object, given a SOCKET handle.
IsBlocking | Determines whether a blocking call is in progress.

Operations
CancelBlockingCall Cancels a blocking call currently in progress.

Overridables
OnMessagePending Processes pending messages while waiting for a blocking call to complete.

See Also

CSocket Overview, Windows Sockets Classes


CSocket::Attach

Call this member function to attach an hSocket handle to a CSocket object. The SOCKET handle is stored in the object's m_hSocket data member.

Syntax

BOOL Attach( SOCKET hSocket );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocket Overview, CSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Attach, CAsyncSocket::m_hSocket


CSocket::CancelBlockingCall

Call this member function to cancel a blocking call currently in progress. The original blocking call will terminate as soon as possible with the error WSAEINTR.

Syntax

void CancelBlockingCall( );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocket Overview, CSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Accept, CAsyncSocket::Close, CAsyncSocket::Connect, CSocket::IsBlocking


CSocket::Create

Call this member function after constructing a socket object to create the Windows socket and attach it. Create then calls Bind to bind the socket to the specified address.

Syntax

BOOL Create( UINT nSocketPort = 0, int nSocketType = SOCK_STREAM, LPCTSTR lpszSocketAddress = NULL );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocket Overview, CSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Create, CAsyncSocket::Bind


CSocket::CSocket

Use this constructor to construct a synchronous socket object. After construction, you must call the Create member function.

Syntax

CSocket( );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocket Overview, CSocket Member Functions, Windows Sockets Classes, CSocket::Create


CSocket::FromHandle

Call this member function to obtain a pointer to a CSocket object, when you have a SOCKET handle. If a CSocket object is not attached to the handle passed in the hSocket parameter, this function returns NULL. It does not create a temporary object.

Syntax

static CSocket* PASCAL FromHandle( SOCKET hSocket );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocket Overview, CSocket Member Functions, Windows Sockets Classes, CAsyncSocket::FromHandle


CSocket::IsBlocking

Call this member function to determine whether a blocking call is in progress.

Syntax

BOOL IsBlocking( );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocket Overview, CSocket Member Functions, Windows Sockets Classes, CSocket::CancelBlockingCall


CSocket::OnMessagePending

Override this member function to look for particular messages from Windows and respond to them in your socket. This is an advanced overridable.

Syntax

virtual BOOL OnMessagePending( );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocket Overview, CSocket Member Functions, Windows Sockets Classes, CSocket::CancelBlockingCall, CSocket::IsBlocking


CSocketFile

A CSocketFile object is a CFile object used for sending and receiving data across a network via Windows Sockets. You can attach the CSocketFile object to a CSocket object for this purpose. You generally attach the CSocketFile object to a CArchive object to simplify sending and receiving data using MFC serialization.

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocketFile Member Functions, File Service Classes, CArchive , CAsyncSocket, CSocket


CSocketFile Member Functions

Construction
CSocketFile Constructs a CSocketFile object.

See Also

CSocketFile Overview, File Service Classes


CSocketFile::CSocketFile

Use this member function to construct a socket file object.

Syntax

CSocketFile( CSocket* pSocket, BOOL bArchiveCompatible = TRUE );

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CSocketFile Overview, CSocketFile Member Functions, File Service Classes, CArchive , CAsyncSocket, CFile::CFile, CFile::Read, CSocket


CSpinButtonCtrl

The CSpinButtonCtrl class provides the functionality of the Windows common spin button control. A spin button control, also known as an up-down control, is a pair of arrow buttons that a user can tap with the stylus to increment or decrement a value. An up-down control is most often used with a companion control, called a buddy window, in which the current value is displayed.

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, spin button controls can only be "buddies" with edit controls.

See Also

CSpinButtonCtrl Member Functions, Control Classes, CSliderCtrl, CSpinButtonCtrl::SetBuddy


CSpinButtonCtrl Member Functions

Construction
CSpinButtonCtrl | Constructs a CSpinButtonCtrl object.
Create | Creates a spin button control and attaches it to a CSpinButtonCtrl object.

Attributes
SetAccel | Sets the acceleration for a spin button control.
GetAccel | Retrieves acceleration information for a spin button control.
SetBase | Sets the base for a spin button control.
GetBase | Retrieves the current base for a spin button control.
SetBuddy | Sets the buddy window for a spin button control.
GetBuddy | Retrieves a pointer to the current buddy window.
SetPos | Sets the current position for the control.
GetPos | Retrieves the current position of a spin button control.
SetRange | Sets the upper and lower limits (range) for a spin button control.
GetRange | Retrieves the upper and lower limits (range) for a spin button control.

See Also

CSpinButtonCtrl Overview, Control Classes


CSpinButtonCtrl::Create

Call this member function to create a spin button control and attach it to the CSpinButtonCtrl object.

You construct a CSpinButtonCtrl object in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

For information about supported tree control styles, see Up-down Control Styles.

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::CSpinButtonCtrl


CSpinButtonCtrl::CSpinButtonCtrl

Call this member function to construct a CSpinButtonCtrl object.

Syntax

CSpinButtonCtrl( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::Create


CSpinButtonCtrl::GetAccel

Call this member function to retrieve acceleration information for a spin button control.

Syntax

UINT GetAccel( int nAccel, UDACCEL* pAccel ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::SetAccel


CSpinButtonCtrl::GetBase

Call this member function to retrieve the current base for a spin button control.

Syntax

UINT GetBase( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::SetBase


CSpinButtonCtrl::GetBuddy

Call this member function to retrieve a pointer to the current buddy window.

Syntax

CWnd* GetBuddy( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::SetBuddy


CSpinButtonCtrl::GetPos

Call this member function to retrieve the current position of a spin button control.

Syntax

int GetPos( ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::SetPos


CSpinButtonCtrl::GetRange

Call this member function to retrieve the upper and lower limits (range) for a spin button control.

Syntax

DWORD GetRange( ) const;

void GetRange( int &lower, int& upper ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::SetRange


CSpinButtonCtrl::SetAccel

Call this member function to set the acceleration for a spin button control.

Syntax

BOOL SetAccel( int nAccel, UDACCEL* pAccel );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::GetAccel


CSpinButtonCtrl::SetBase

Call this member function to set the base for a spin button control.

Syntax

int SetBase( int nBase );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::GetBase


CSpinButtonCtrl::SetBuddy

Call this member function to set the buddy window for a spin button control.

Syntax

CWnd* SetBuddy ( CWnd* pWndBuddy );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, spin button controls can only be "buddies" with edit controls. The only values you can pass in the pWwndBuddy parameter to the CSpinButtonCtrl::SetBuddy member function are a pointer to an edit control or NULL.

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::GetBuddy


CSpinButtonCtrl::SetPos

Call this member function to set the current position for a spin button control.

Syntax

int SetPos( int nPos );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::SetRange, CSpinButtonCtrl::GetPos


CSpinButtonCtrl::SetRange

Call this member function to set the upper and lower limits (range) for a spin button control.

Syntax

void SetRange( int nLower, int nUpper );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CSpinButtonCtrl Overview, CSpinButtonCtrl Member Functions, Control Classes, CSpinButtonCtrl::GetRange, CSpinButtonCtrl::GetPos


CSplitterWnd

The CSplitterWnd class provides the functionality of a splitter window, which is a window that contains multiple panes.

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CView, CWnd


CSplitterWnd Member Functions

Construction
CSplitterWnd | Call to construct a CSplitterWnd object.
Create | Call to create a dynamic splitter window and attach it to the CSplitterWnd object.
CreateStatic | Call to create a static splitter window and attach it to the CSplitterWnd object.
CreateView | Call to create a pane in a splitter window.

Operations
GetRowCount | Returns the current pane row count.
GetColumnCount | Returns the current pane column count.
GetRowInfo | Returns information on the specified row.
SetRowInfo | Call to set the specified row information.
GetColumnInfo | Returns information on the specified column.
SetColumnInfo | Call to set the specified column information.
GetPane | Returns the pane at the specified row and column.
IsChildPane | Call to determine whether the window is currently a child pane of this splitter window.
IdFromRowCol | Returns the child window ID of the pane at the specified row and column.
RecalcLayout | Call to redisplay the splitter window after adjusting row or column size.
GetScrollStyle | Returns the shared scroll-bar style.
SetScrollStyle | Specifies the new scroll-bar style for the splitter window's shared scroll-bar support.

Overridables
OnDrawSplitter | Renders an image of a split window.
OnInvertTracker | Renders the image of a split window to be the same size and shape as the frame window.
CreateScrollBarCtrl | Creates a shared scroll bar control.
DeleteView | Deletes a view from the splitter window.
SplitRow | Indicates wheere a frame window splits horizontally.
SplitColumn | Indicated where a frame window splits vertically.
DeleteRow | Deletes a row from the splitter window.
DeleteColumn | Deletes a column from the splitter window.
GetActivePane | Determines the active pane from the focus or active view in the frame.
SetActivePane | Sets a pane to be the active one in the frame.
CanActivateNext | Checks to see if the Next Pane or Previous Pane command is currently possible.
ActivateNext | Performs the Next Pane or Previous Pane command.
DoKeyboardSplit | Performs the keyboard split command, usually "Window Split".
DoScroll | Performs synchronized scrolling of split windows.
DoScrollBy | Scrolls split windows by a given number of pixels.

See Also

CSplitterWnd Overview, Frame Windows and Splitter Windows


CSplitterWnd::ActivateNext

This member function is called by the framework to perform the Next Pane or Previous Pane command.

Syntax

virtual void ActivateNext( BOOL bPrev = FALSE );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CView, CSplitterWnd::CanActivateNext, CSplitterWnd::SetActivePane


CSplitterWnd::CanActivateNext

This member function is called by the framework to determine whether it's currently possible to invoke the Next Pane or Previous Pane command.

Syntax

virtual BOOL CanActivateNext( BOOL bPrev = FALSE );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::ActivateNext, CSplitterWnd::SetActivePane


CSplitterWnd::Create

Call this member function to create a dynamic splitter window.

Syntax

BOOL Create( CWnd* pParentWnd, int nMaxRows, int nMaxCols, SIZE sizeMin, CCreateContext* pContext, DWORD dwStyle = WS_CHILD | WS_VISIBLE |WS_HSCROLL | WS_VSCROLL | SPLS_DYNAMIC_SPLIT, UINT nID = AFX_IDW_PANE_FIRST );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::CreateStatic, CFrameWnd::OnCreateClient, CSplitterWnd::SetRowInfo, CSplitterWnd::SetColumnInfo, CSplitterWnd::CreateView


CSplitterWnd::CreateScrollBarCtrl

This member function is called by the framework to create a shared scroll bar control.

Syntax

virtual BOOL CreateScrollBarCtrl( DWORD dwStyle, UINT nID );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows


CSplitterWnd::CreateStatic

Call this member function to create a static splitter window.

Syntax

BOOL CreateStatic( CWnd* pParentWnd, int nRows, int nCols, DWORD dwStyle = WS_CHILD | WS_VISIBLE, UINT nID = AFX_IDW_PANE_FIRST );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::Create, CFrameWnd::OnCreateClient, CSplitterWnd::SetRowInfo, CSplitterWnd::SetColumnInfo, CSplitterWnd::CreateView


CSplitterWnd::CreateView

Call this member function to create the panes for a static splitter window.

Syntax

virtual BOOL CreateView( int row, int col, CRuntimeClass* pViewClass, SIZE sizeInit, CCreateContext* pContext );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::Create


CSplitterWnd::CSplitterWnd

Call this member function to create a splitter window and attach it to the CSplitterWnd object.

You construct a CSplitterWnd object in two steps. First, call the constructor, which creates the CSplitterWnd object, then call the Create function.

Syntax

CSplitterWnd( );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::Create


CSplitterWnd::DeleteColumn

This member function is called by the framework to implement the logic of the dynamic splitter window. It can be customized, along with the virtual function CreateView, to implement more advanced dynamic splitters.

Syntax

virtual void DeleteColumn( int colDelete );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::DeleteRow, CSplitterWnd::CreateView, CSplitterWnd::DeleteView


CSplitterWnd::DeleteRow

This member function is called by the framework to implement the logic of the dynamic splitter window . It can be customized, along with the virtual function CreateView, to implement more advanced dynamic splitters.

Syntax

virtual void DeleteRow( int rowDelete );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::DeleteColumn, CSplitterWnd::CreateView, CSplitterWnd::DeleteView


CSplitterWnd::DeleteView

This member function is called by the framework to implement the logic of the dynamic splitter window. It can be customized, along with the virtual function CreateView, to implement more advanced dynamic splitters.

Syntax

virtual void DeleteView( int row, int col );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CWnd::PostNcDestroy, CSplitterWnd::CreateView, CSplitterWnd::DeleteColumn, CSplitterWnd::DeleteRow


CSplitterWnd::DoKeyboardSplit

This member function is called by the framework to perform a keyboard split command, usually Window Split.

Syntax

virtual BOOL DoKeyboardSplit( );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CView


CSplitterWnd::DoScroll

This member function is called by the framework to perform synchronized scrolling of split windows when the view receives a scroll message.

Syntax

virtual BOOL DoScroll( CView* pViewFrom, UINT nScrollCode, BOOL bDoScroll = TRUE );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::DoScrollBy, CView::OnScroll


CSplitterWnd::DoScrollBy

This member function is called by the framework in response to a scroll message, to perform synchronized scrolling of the split windows by the amount, in pixels, indicated by sizeScroll. Positive values indicate scrolling down and to the right; negative values indicate scrolling up and to the left.

Syntax

virtual BOOL DoScrollBy( CView* pViewFrom, CSize sizeScroll, BOOL bDoScroll = TRUE );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::DoScroll, CView::OnScroll


CSplitterWnd::GetActivePane

This member function is called by the framework to determine the active pane in a splitter window.

Syntax

virtual CWnd* GetActivePane(int* pRow = NULL, int* pCol = NULL);

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::SetActivePane, CFrameWnd::GetActiveView, CWnd::GetParentFrame, CWnd::GetFocus


CSplitterWnd::GetColumnCount

Call this member function to retrieve the current number of columns in the splitter. For a static splitter, this will also be the maximum number of columns.

Syntax

int GetColumnCount( );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetRowCount


CSplitterWnd::GetColumnInfo

Call this member function to obtain information about the specified column.

Syntax

void GetColumnInfo( int col, int& cxCur, int& cxMin );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::SetColumnInfo, CSplitterWnd::GetRowInfo


CSplitterWnd::GetPane

Call this member function to retrieve the pane at the specified row and column. The returned pane is usually a CView-derived class.

Syntax

CWnd* GetPane( int row, int col );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetActivePane, CSplitterWnd::IdFromRowCol, CSplitterWnd::IsChildPane , CView


CSplitterWnd::GetRowCount

Call this member function to retrieve the current number of rows in the splitter window. For a static splitter window, this will also be the maximum number of rows.

Syntax

int GetRowCount( );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetColumnCount


CSplitterWnd::GetRowInfo

Call this member function to obtain information about the specified row.

Syntax

void GetRowInfo( int row, int& cyCur, int& cyMin );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::SetRowInfo, CSplitterWnd::GetColumnInfo


CSplitterWnd::GetScrollStyle

Call this member function to retrieve the shared scroll-bar style for the splitter window.

Syntax

DWORD GetScrollStyle( ) const;

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::SetScrollStyle


CSplitterWnd::IdFromRowCol

Call this member function to obtain the child window ID for the pane at the specified row and column. This member function is used for creating nonviews as panes and may be called before the pane exists.

Syntax

int IdFromRowCol( int row, int col );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetPane, CSplitterWnd::IsChildPane


CSplitterWnd::IsChildPane

Call this member function to determine whether pWnd is currently a child pane of this splitter window.

Syntax

BOOL IsChildPane( CWnd* pWnd, int& row, int& col );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetPane


CSplitterWnd::OnDrawSplitter

This member function is called by the framework to draw and specify the exact characteristics of a splitter window.

Syntax

virtual void OnDrawSplitter( CDC* pDC, ESplitType nType, const CRect& rect );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::OnInvertTracker


CSplitterWnd::OnInvertTracker

This member function is called by the framework during resizing of splitters.

Syntax

virtual void OnInvertTracker( const CRect& rect );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::OnDrawSplitter


CSplitterWnd::RecalcLayout

Call this member function to correctly redisplay the splitter window after you have adjusted row and column sizes by using the SetRowInfo and SetColumnInfo member functions.

Syntax

void RecalcLayout( );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::SetRowInfo, CSplitterWnd::SetColumnInfo


CSplitterWnd::SetActivePane

This member function is called by the framework to set a pane as active when the user changes the focus to a pane within the frame window.

Syntax

virtual void SetActivePane( int row, int col, CWnd* pWnd = NULL );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetActivePane, CSplitterWnd::GetPane, CFrameWnd::SetActiveView


CSplitterWnd::SetColumnInfo

Call this member function to set a new minimum width and ideal width for a column.

Syntax

void SetColumnInfo( int col, int cxIdeal, int cxMin );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetRowInfo, CSplitterWnd::RecalcLayout


CSplitterWnd::SetRowInfo

Call this member function to set a new minimum height and ideal height for a row.

Syntax

void SetRowInfo( int row, int cyIdeal, int cyMin );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetRowInfo, CSplitterWnd::SetColumnInfo, CSplitterWnd::RecalcLayout


CSplitterWnd::SetScrollStyle

Call this member function to specify the new scroll style for the splitter window's shared scroll-bar support.

Syntax

void SetScrollStyle( DWORD dwStyle );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::GetScrollStyle


CSplitterWnd::SplitColumn

This member function is called by the framework to implement the logic of the dynamic splitter window. It can be customized, along with the virtual function CreateView, to implement more advanced dynamic splitters.

Syntax

virtual BOOL SplitColumn( int cxBefore );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::CreateView, CSplitterWnd::SplitRow, CSplitterWnd::RecalcLayout


CSplitterWnd::SplitRow

This member function is called by the framework to implement the logic of the dynamic splitter window. It can be customized, along with the virtual function CreateView, to implement more advanced dynamic splitters.

Syntax

virtual BOOL SplitRow( int cyBefore );

At a Glance

Header file: Afxext.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSplitterWnd Overview, CSplitterWnd Member Functions, Frame Windows and Splitter Windows, CSplitterWnd::SplitColumn, CSplitterWnd::CreateView, CSplitterWnd::RecalcLayout


CStatic

The CStatic class provides the functionality of a Windows static control. A static control is a control used to display text, to draw frames or lines separating other controls, or to display icons. A static control doesn't accept user input, but it can notify its parent of stylus taps if it's created with SS_NOTIFY style.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the following member functions of the CStatic class.

GetCursor

GetEnhMetaFile

GetIcon

SetCursor

SetEnhMetaFile

SetIcon

Windows CE does not support owner-drawn static controls, so you cannot specify ODT_STATIC in the CtlType field of the DRAWITEMSTRUCT structure.

See Also

CStatic Member Functions, Control Classes, CWnd, CButton, CComboBox, CEdit, CListBox, CScrollBar, CDialog


CStatic Member Functions

Construction
CStatic Constructs a CStatic object.

Initialization
Create Creates the Windows static control and attaches it to the CStatic object.

Operations
SetBitmap | Specifies a bitmap to be displayed in the static control.
GetBitmap | Retrieves the handle to the bitmap previously set with SetBitmap.

See Also

CStatic Overview, Control Classes


CStatic::Create

Call this member function to create a Windows static control and attach it to the CStatic object.

You construct a CStatic object in two steps. First call the constructor CStatic, then call Create.

Syntax

BOOL Create( LPCTSTR lpszText, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID = 0xffff );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE doesn't support the SS_ENHMETAFILE, SS_METAPICT, SS_RIGHTIMAGE or SS_SIMPLE static control styles. Use SS_LEFT or SS_LEFTNOWORDWRAP to emulate the SS_SIMPLE style. Windows CE also doesn't support the SS_BLACKFRAME, SS_BLACKRECT, SS_GRAYFRAME, SS_GRAYRECT, SS_OWNERDRAW, SS_WHITEFRAME, SS_WHITERECT styles but you can use the WM_PAINT message to achieve the same results. For information on supported static control styles, see Static Control Styles.

See Also

CStatic Overview, CStatic Member Functions, Control Classes, CStatic::CStatic


CStatic::CStatic

Call this member function to construct a CStatic object.

Syntax

CStatic( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CStatic Overview, CStatic Member Functions, Control Classes, CStatic::Create


CStatic::GetBitmap

Call this member function to retrieve the handle to the bitmap, previously set with SetBitmap, that is associated with this CStatic object.

Syntax

HBITMAP GetBitmap( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CStatic Overview, CStatic Member Functions, Control Classes, CStatic::SetBitmap


CStatic::SetBitmap

Call this member function to associate a new bitmap with the static control.

The bitmap will be automatically drawn in the static control. By default, it will be drawn in the upper-left corner and the static control will be resized to the size of the bitmap.

Syntax

HBITMAP SetBitmap( HBITMAP hBitmap );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CStatic Overview, CStatic Member Functions, Control Classes, CStatic::GetBitmap


CString

A CString object consists of a variable-length sequence of characters. CString provides functions and operators using a syntax similar to that of Basic. Concatenation and comparison operators, together with simplified memory management, make CString objects easier to use than ordinary character arrays.

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the following member functions of the CString class.

AnsiToOem

Collate

FormatMessage

OemToAnsi

See Also

CString Member Functions, CString Operators, Simple Value Types


CString Member Functions

Construction
CString Constructs CString objects in various ways.

The String as an Array
GetLength | Returns the number of characters in a CString object.
IsEmpty | Tests whether a CString object contains no characters.
Empty | Forces a string to have 0 length.
GetAt | Returns the character at a given position.
SetAt | Sets a character at a given position.

Comparison
Compare | Compares two strings (case sensitive).
CompareNoCase | Compares two strings (case insensitive).

Extraction
Mid | Extracts the middle part of a string (like the Basic MID$ function).
Left | Extracts the left part of a string (like the Basic LEFT$ function).
Right | Extracts the right part of a string (like the Basic RIGHT$ function).
SpanIncluding | Extracts a substring that contains only the characters in a set.
SpanExcluding | Extracts a substring that contains only the characters not in a set.

Other Conversions
MakeUpper | Converts all the characters in this string to uppercase characters.
MakeLower | Converts all the characters in this string to lowercase characters.
MakeReverse | Reverses the characters in this string.
Format | Format the string as sprintf does.
TrimLeft | Trim leading whitespace characters from the string.
TrimRight | Trim trailing whitespace characters from the string.

Searching
Find | Finds a character or substring inside a larger string.
ReverseFind | Finds a character inside a larger string; starts from the end.
FindOneOf | Finds the first matching character from a set.

Buffer Access
GetBuffer | Returns a pointer to the characters in the CString.
GetBufferSetLength | Returns a pointer to the characters in the CString, truncating to the specified length.
ReleaseBuffer | Releases control of the buffer returned by GetBuffer.
FreeExtra | Removes any overhead of this string object by freeing any extra memory previously allocated to the string.
LockBuffer | Disables reference counting and protects the string in the buffer.
UnlockBuffer | Enables reference counting and releases the string in the buffer.

Windows-Specific
AllocSysString | Allocates a BSTR from CString data.
SetSysString | Sets an existing BSTR object with data from a CString object.
LoadString | Loads an existing CString object from a Windows resource.

See Also

CString Overview, CString Operators, Simple Value Types


CString::AllocSysString

Call this member function to allocate a new Automation–compatible string of the type BSTR and copy the contents of the CString object into it, including the terminating null character. A CMemoryException is thrown if insufficient memory exists. This function is normally used to return strings for Automation.

Syntax

BSTR AllocSysString ( ) const;
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, ::SysAllocString, ::SysFreeString, CMemoryException


CString::Compare

Call this member function to compare this CString object with another string using the Windows function lstrcmp. It is not locale-sensitive.

Syntax

int Compare( LPCTSTR lpsz ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::CompareNoCase


CString::CompareNoCase

Call this member function to ompare this CString object with another string using the function lstrcmpi.

The current locale is used to get the correct language-specific sort ordering.

Syntax

int CompareNoCase( LPCTSTR lpsz ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::Compare


CString::CString

Use these constructors to initialize a new CString object with the specified data.

Because the constructors copy the input data into new allocated storage, you should be aware that memory exceptions may result. Note that some of these constructors act as conversion functions. This allows you to substitute, for example, an LPTSTR where a CString object is expected.

Syntax

CString( );

CString( const CString& stringSrc );
throw( CMemoryException );

CString( TCHAR ch, int nRepeat = 1 );
throw( CMemoryException );

CString( LPCTSTR lpch, int nLength );
throw( CMemoryException );

CString( const unsigned char* psz );
throw( CMemoryException );

CString( LPCWSTR lpsz );
throw( CMemoryException );

CString( LPCSTR lpsz );
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::operator =


CString::Empty

Call this member function to make this CString object an empty string and free memory as appropriate.

Syntax

void Empty( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::IsEmpty


CString::Find

Call this member function to search this string for the first match of a substring. The function is overloaded to accept both single characters (similar to the run-time function strchr) and strings (similar to strstr).

Syntax

int Find( TCHAR ch ) const;

int Find( LPCTSTR lpszSub ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::ReverseFind, CString::FindOneOf


CString::FindOneOf

Call this member function to search this string for the first character that matches any character contained in lpszCharSet.

Syntax

int FindOneOf( LPCTSTR lpszCharSet ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::Find


CString::Format

Call this member function to write formatted data to a CString in the same way that sprintf formats data into a C-style character array. This function formats and stores a series of characters and values in the CString. Each optional argument (if any) is converted and output according to the corresponding format specification in lpszFormat or from the string resource identified by nFormatID.

Syntax

void Format( LPCTSTR lpszFormat, ... );

void Format( UINT nFormatID, ... );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::GetBuffer


CString::FreeExtra

Call this member function to free any extra memory previously allocated by the string but no longer needed. This should reduce the memory overhead consumed by the string object. The function reallocates the buffer to the exact length returned by GetLength.

Syntax

void FreeExtra( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types


CString::GetAt

Call this member function to retrieve a single character specified by an index number. The overloaded subscript ([]) operator is a convenient alias for GetAt.

Syntax

TCHAR GetAt( int nIndex ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::GetAt, CString::GetLength, CString::operator []


CString::GetBuffer

Call this member function to retrieve a pointer to the internal character buffer for the CString object. The returned LPTSTR is not const and thus allows direct modification of CString contents.

Syntax

LPTSTR GetBuffer( int nMinBufLength );
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::GetBufferSetLength, CString::ReleaseBuffer


CString::GetBufferSetLength

Call this member function to retrieve a pointer to the internal character buffer for the CString object, truncating or growing its length if necessary to exactly match the length specified in nNewLength. The returned LPTSTR pointer is not const and thus allows direct modification of CString contents.

Syntax

LPTSTR GetBufferSetLength( int nNewLength );
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::GetBuffer, CString::ReleaseBuffer


CString::GetLength

Call this member function to retrieve a count of the characters in this CString object. The count does not include a null terminator.

Syntax

int GetLength( ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::IsEmpty


CString::IsEmpty

Call this member function to determine whether a CString object is empty.

Syntax

BOOL IsEmpty( ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::GetLength


CString::Left

Call this member function to extract the first (leftmost) nCount characters from this CString object and obtain a copy of the extracted substring. If nCount exceeds the string length, then the entire string is extracted. Left is similar to the Basic LEFT$ function (except that indexes are zero-based).

Syntax

CString Left( int nCount ) const;
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::Mid, CString::Right


CString::LoadString

Call this member function to read a Windows string resource, identified by nID, into an existing CString object.

Syntax

BOOL LoadString( UINT nID );
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types


CString::LockBuffer

Call this member function to lock a string in the buffer.

Syntax

LPTSTR LockBuffer( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::UnlockBuffer, CString::GetBuffer, CString::ReleaseBuffer


CString::MakeLower

Call this member function to convert this CString object to a lowercase string.

Syntax

void MakeLower( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::MakeUpper


CString::MakeReverse

Call this member function to reverse the order of the characters in this CString object.

Syntax

void MakeReverse( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types


CString::MakeUpper

Call this member function to convert this CString object to an uppercase string.

Syntax

void MakeUpper( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::MakeLower


CString::Mid

Call this member function to extract a substring of length nCount characters from this CString object, starting at position nFirst (zero-based). The function returns a copy of the extracted substring. Mid is similar to the Basic MID$ function (except that indexes are zero-based).

Syntax

CString Mid( int nFirst ) const;
throw( CMemoryException );

CString Mid( int nFirst, int nCount ) const;
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::Left, CString::Right


CString::ReleaseBuffer

Call this member function to release a buffer allocated by GetBuffer. If you know that the string in the buffer is null-terminated, you can omit the nNewLength argument. If your string is not null-terminated, then use nNewLength to specify its length. The address returned by GetBuffer is invalid after the call to ReleaseBuffer or any other CString operation.

Syntax

void ReleaseBuffer( int nNewLength = –1 );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::GetBuffer


CString::ReverseFind

Call this member function to search this CString object for the last match of a substring. The function is similar to the run-time function strrchr.

Syntax

int ReverseFind( TCHAR ch ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::Find, CString::FindOneOf


CString::Right

Call this member function to extract the last (rightmost) nCount characters from this CString object and retrieve a copy of the extracted substring. If nCount exceeds the string length, then the entire string is extracted. Right is similar to the Basic RIGHT$ function (except that indexes are zero-based).

Syntax

CString Right( int nCount ) const;
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::Mid, CString::Left


CString::SetAt

Call this member function to overwrite a single character specified by an index number. SetAt will not enlarge the string if the index exceeds the bounds of the existing string.

Syntax

void SetAt( int nIndex, TCHAR ch );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::GetAt, CString::operator [ ]


CString::SetSysString

Call this member function to reallocate the BSTR referenced by pbstr, and copy the contents of the CString object into it, including the NULL character. The value of the BSTR referenced by pbstr may change. The function throws a CMemoryException if insufficient memory exists.

Syntax

BSTR SetSysString( BSTR* pbstr ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, ::SysReallocStringLen, ::SysFreeString, CMemoryException


CString::SpanExcluding

Call this member function to search the string for the first occurrence of any character in the specified set lpszCharSet. SpanExcluding extracts and returns all characters preceding the specified character set (in other words, the specified character set, and all characters following it in the string, are not returned). If the specified character set is not found in the string, then SpanExcluding returns an empty string.

Syntax

CString SpanExcluding( LPCTSTR lpszCharSet ) const;
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::SpanIncluding


CString::SpanIncluding

Call this member function to extract characters from the string, starting with the first character, which are in the set of characters identified by lpszCharSet. If the first character of the string is not in the character set, then SpanIncluding returns an empty string. Otherwise, it returns a sequence of consecutive characters which are in the set.

Syntax

CString SpanIncluding( LPCTSTR lpszCharSet ) const;
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::SpanExcluding


CString::TrimLeft

Call this member function to trim leading white space characters from the string. This function removes new line, space, and tab characters.

Syntax

void TrimLeft( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::TrimRight, CString::Mid, CString::Left, CString::Right, CString::MakeUpper, CString::MakeLower, CString::MakeReverse, CString::Format


CString::TrimRight

Call this member function to trim trailing white space characters from the string. This function removes trailing new line, space, and tab characters from the string.

Syntax

void TrimRight( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::TrimLeft, CString::Mid, CString::Left, CString::Right, CString::MakeUpper, CString::MakeLower, CString::MakeReverse, CString::Format


CString::UnlockBuffer

Call this member function to unlock the buffer that was previously secured by calling LockBuffer. UnlockBuffer resets the reference count to 1.

The CString destructor implies UnlockBuffer to ensure that you do not leave the buffer locked when the destructor is called.

Syntax

void UnlockBuffer( );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::LockBuffer, CString::GetBuffer, CString::ReleaseBuffer


CString Operators

The String as an Array
operator [] | Returns the character at a given position — operator substitution for GetAt.
operator LPCTSTR | Directly accesses characters stored in a CString object as a C-style string.

Assignment/Concatenation
operator = | Assigns a new value to a CString object.
operator + | Concatenates two strings and returns a new string.
operator += | Concatenates a new string to the end of an existing string.

Comparison
operator == <, etc. Comparison operators (case sensitive).

Archive/Dump
operator << | Inserts a CString object to an archive or dump context.
operator >> | Extracts a CString object from an archive.

See Also

CString Overview, CString Member Functions, Simple Value Types


CString::operator =

Use the CString assignment (=) operator to reinitialize an existing CString object with new data. If the destination string (that is, the left side) is already large enough to store the new data, no new memory allocation is performed. You should be aware that memory exceptions may occur whenever you use the assignment operator because new storage is often allocated to hold the resulting CString object.

Syntax

const CString& operator =( const CString& stringSrc );
throw( CMemoryException );

const CString& operator =( TCHAR ch );
throw( CMemoryException );

const CString& operator =( const unsigned char* psz );
throw( CMemoryException );

const CString& operator =( LPCWSTR lpsz );
throw( CMemoryException );

const CString& operator =( LPCSTR lpsz );
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Operators, Simple Value Types, CString::CString


CString::operator LPCTSTR

Use this casting operator to access the null-terminated C string contained in a CString object. No characters are copied; only a pointer is returned. Be careful with this operator. If you change a CString object after you have obtained the character pointer, you may cause a reallocation of memory that invalidates the pointer.

Syntax

operator LPCTSTR ( ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Operators, Simple Value Types


CString::operator <<, >>

Use the CString insertion (<<) operator for diagnostic dumping and storing to an archive.

Use the extraction (>>) operator for loading from an archive.

The CDumpContext operators are valid only in the Debug version of the MFC for Windows CE.

Syntax

friend CArchive& operator <<( CArchive& ar, const CString& string );
throw( CArchiveException );

friend CArchive& operator >>( CArchive& ar, CString& string );
throw( CArchiveException );

friend CDumpContext& operator <<( CDumpContext& dc, const CString& string );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Operators, Simple Value Types, CDumpContext


CString::operator +

Use this concatenation operator to join two strings and retrieve the resulting CString object. One of the two argument strings must be a CString object. The other can be a character pointer or a character. You should be aware that memory exceptions may occur whenever you use the concatenation operator since new storage may be allocated to hold temporary data.

Syntax

friend CString operator +( const CString& string1, const CString& string2 );
throw( CMemoryException );

friend CString operator +( const CString& string, TCHAR ch );
throw( CMemoryException );

friend CString operator +( TCHAR ch, const CString& string );
throw( CMemoryException );

friend CString operator +( const CString& string, LPCTSTR lpsz );
throw( CMemoryException );

friend CString operator +( LPCTSTR lpsz, const CString& string );
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Operators, Simple Value Types, CString::operator +=


CString::operator +=

Use this concatenation operator to add characters onto the end of this string. The operator accepts another CString object, a character pointer, or a single character. You should be aware that memory exceptions may occur whenever you use this concatenation operator because new storage may be allocated for characters added to this CString object.

Syntax

const CString& operator +=( const CString& string );
throw( CMemoryException );

const CString& operator +=( TCHAR ch );
throw( CMemoryException );

const CString& operator +=( LPCTSTR lpsz );
throw( CMemoryException );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Operators, Simple Value Types, CString::operator +


CString Comparison Operators

Use these comparison operators to compare two strings. The operators are a convenient substitute for the case-sensitive Compare member function.

Syntax

BOOL operator ==( const CString& s1, const CString& s2 );

BOOL operator ==( const CString& s1, LPCTSTR s2 );

BOOL operator ==( LPCTSTR s1, const CString& s2 );

BOOL operator !=( const CString& s1, const CString& s2 );

BOOL operator !=( const CString& s1, LPCTSTR s2 );

BOOL operator !=( LPCTSTR s1, const CString& s2 );

BOOL operator <( const CString& s1, const CString& s2 );

BOOL operator <( const CString& s1, LPCTSTR s2 );

BOOL operator <( LPCTSTR s1, const CString& s2 );

BOOL operator >( const CString& s1, const CString& s2 );

BOOL operator >( const CString& s1, LPCTSTR s2 );

BOOL operator >( LPCTSTR s1, const CString& s2 );

BOOL operator <=( const CString& s1, const CString& s2 );

BOOL operator <=( const CString& s1, LPCTSTR s2 );

BOOL operator <=( LPCTSTR s1, const CString& s2 );

BOOL operator >=( const CString& s1, const CString& s2 );

BOOL operator >=( const CString& s1, LPCTSTR s2 );

BOOL operator >=( LPCTSTR s1, const CString& s2 );

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Operators, Simple Value Types, Compare


CString::operator [ ]

Use the overloaded subscript ([]) operator to retireve a single character specified by the zero-based index in nIndex. This operator is a convenient substitute for the GetAt member function.

Important You can use the subscript ([]) operator to get the value of a character in a CString, but you cannot use it to change the value of a character in a CString.

Syntax

TCHAR operator []( int nIndex ) const;

At a Glance

Header File | Afx.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CString Overview, CString Operators, Simple Value Types, CString::GetAt, CString::SetAt


CStringArray

The CStringArray class supports arrays of CString objects.

The member functions of CStringArray are similar to the member functions of class CObArray. Because of this similarity, you can use the CObArray reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Array Classes, CObArray


CStringArray Class Members

Construction
CStringArray Constructs an empty array for CString objects.

Bounds
GetSize | Gets number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.

Operations
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.

Element Access
GetAt | Returns the value at a given index.
SetAt | Sets the value for a given index; array not allowed to grow.
ElementAt | Returns a temporary reference to the element pointer within the array.
GetData | Allows access to elements in the array. Can be NULL.

Growing the Array
SetAtGrow | Sets the value for a given index; grows the array if necessary.
Add | Adds an element to the end of the array; grows the array if necessary.
Append | Appends another array to the array; grows the array if necessary.
Copy | Copies another array to the array; grows the array if necessary.

Insertion/Removal
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.

Operators
operator [] Sets or gets the element at the specified index.

See Also

CStringArray Overview, Array Classes


CStringList

The CStringList class supports lists of CString objects.

The member functions of CStringList are similar to the member functions of class CObList. Because of this similarity, you can use the CObList reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, List Classes, CObList


CStringList Class Members

Construction
CStringList Constructs an empty list for CString objects.

Head/Tail Access
GetHead | Returns the head element of the list (cannot be empty).
GetTail | Returns the tail element of the list (cannot be empty).

Operations
RemoveHead | Removes the element from the head of the list.
RemoveTail | Removes the element from the tail of the list.
AddHead | Adds an element (or all the elements in another list) to the head of the list (makes a new head).
AddTail | Adds an element (or all the elements in another list) to the tail of the list (makes a new tail).
RemoveAll | Removes all the elements from this list.

Iteration
GetHeadPosition | Returns the position of the head element of the list.
GetTailPosition | Returns the position of the tail element of the list.
GetNext | Gets the next element for iterating.
GetPrev | Gets the previous element for iterating.

Retrieval/Modification
GetAt | Gets the element at a given position.
SetAt | Sets the element at a given position.
RemoveAt | Removes an element from this list as specified by position.

Insertion
InsertBefore | Inserts a new element before a given position.
InsertAfter | Inserts a new element after a given position.

Searching
Find | Gets the position of an element specified by string value.
FindIndex | Gets the position of an element specified by a zero-based index.

Status
GetCount | Returns the number of elements in this list.
IsEmpty | Tests for the empty list condition (no elements).

See Also

CStringList Overview, List Classes


CSyncObject

The CSyncObject class is a pure virtual class that provides common functionality common to the synchronization objects in Windows CE.

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

Remarks

MFC for Windows CE currently only supports two of the classes derived from CSyncObject, CEvent, and CCriticalSection. It does not currently support CMutex or CSemaphore.

See Also

CSyncObject Member Functions, Synchronization Classes, CEvent, CCriticalSection


CSyncObject Member Functions

Construction
CSyncObject Constructs a CSyncObject object.

Methods
Lock | Gains access to the synchronization object.
Unlock | Releases access to the synchronization object.

See Also

CSyncObject Overview, Synchronization Classes


CSyncObject::CSyncObject

Use this constructor to construct a synchronization object with the speicfied name.

Syntax

CSyncObject( LPCTSTR pstrName );

virtual ~CSyncObject( );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSyncObject Overview, CSyncObject Member Functions, Synchronization Classes


CSyncObject::Lock

Call this member function to gain access to the resource controlled by the synchronization object.

Syntax

virtual BOOL Lock( DWORD dwTimeout = INFINITE );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSyncObject Overview, CSyncObject Member Functions, Synchronization Classes


CSyncObject::Unlock

Call this member function to release access to the synchronization object owned by the calling thread.

The declaration of Unlock with no parameters is a pure virtual function, and must be overridden by all classes deriving from CSyncObject.

Syntax

virtual BOOL Unlock( ) = 0;

virtual BOOL Unlock( LONG lCount, LPLONG lpPrevCount = NULL );

At a Glance

Header file: Afxmt.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CSyncObject Overview, CSyncObject Member Functions, Synchronization Classes


CTabCtrl

The CTabCtrl class provides the functionality of a Windows tab control. A tab control is analogous to the dividers in a notebook or the labels in a file cabinet. A tab control is used in a property sheet to provide a way for a user to move from one property page to another.

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE defines two new tab control styles, called TCS_FLIP and TCS_VERTICAL. The TCS_VERTICAL style specifies vertical tabs down the left side of the page. The TCS_FLIP style "flips" the tabs. If they were on top, it puts them on the bottom. If they were on the left, it puts them on the right.

Windows CE does not support the TCM_SETTOOLTIPS message, because it currently only supports tool tips for command bar buttons.

Windows CE does not support tool tips for any controls except command bar buttons, so it doesn't support the GetTooltips and SetTooltips member functions of the CTabCtrl class.

MFC for Windows CE also does not support the obsolete SetItemExtra member function.

Tip Windows CE does not support vertical text. If you create vertical tabs, and want to use vertical text, you have to create a text bitmap and rotate it. Then you can add it to an image list and attach it to the tab by specifying its image list index in the iImage member of the TC_ITEM or TC_ITEMHEADER structure that you pass in the pTabCtrlItem parameter to the SetItem or InsertItem member function.

See Also

CTabCtrl Member Functions, Control Classes, CHeaderCtrl, CListCtrl, TC_ITEM, TC_ITEMHEADER


CTabCtrl Member Functions

Construction
CTabCtrl | Constructs a CTabCtrl object.
Create | Creates a tab control and attaches it to an instance of a CTabCtrl object.

Attributes
GetImageList | Retrieves the image list associated with a tab control.
SetImageList | Assigns an image list to a tab control.
GetItemCount | Retrieves the number of tabs in the tab control.
GetItem | Retrieves information about a tab in a tab control.
SetItem | Sets some or all of a tab's attributes.
GetItemRect | Retrieves the bounding rectangle for a tab in a tab control.
GetCurSel | Determines the currently selected tab in a tab control.
SetCurSel | Selects a tab in a tab control.
SetItemSize | Sets the width and height of an item.
SetPadding | Sets the amount of space (padding) around each tab's icon and label in a tab control.
GetRowCount | Retrieves the current number of rows of tabs in a tab control.
GetCurFocus | Retrieves the tab with the current focus of a tab control.

Operations
InsertItem | Inserts a new tab in a tab control.
DeleteItem | Removes an item from a tab control.
DeleteAllItems | Removes all items from a tab control.
AdjustRect | Calculates a tab control's display area given a window rectangle, or calculates the window rectangle that would correspond to a given display area.
RemoveImage | Removes an image from a tab control's image list.
HitTest | Determines which tab, if any, is at a specified screen position.

Overridables
DrawItem Draws a specified item of a tab control.

See Also

CTabCtrl Overview, Control Classes


CTabCtrl::AdjustRect

Call this member function to calculate a tab control's display area given a window rectangle, or to calculate the window rectangle that would correspond to a given display area.

Syntax

void AdjustRect( BOOL bLarger, LPRECT lpRect );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::SetItemSize, CTabCtrl::GetItemRect, CTabCtrl::AdjustRect


CTabCtrl::Create

Call this member function to create a tab control and attach it to the CTabCtrl object.

You construct a CTabCtrl object in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::CTabCtrl


CTabCtrl::CTabCtrl

Call this member function to construct a CTabCtrl object.

Syntax

CTabCtrl( );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::Create


CTabCtrl::DeleteAllItems

Call this member function to remove all items from a tab control.

Syntax

BOOL DeleteAllItems( );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::DeleteItem


CTabCtrl::DeleteItem

Call this member function to remove the specified item from a tab control.

Syntax

BOOL DeleteItem( int nItem );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::DeleteAllItems


CTabCtrl::DrawItem

This member function is called by the framework when a visual aspect of an owner-draw tab control changes. The itemAction member of the DRAWITEMSTRUCT structure defines the drawing action that is to be performed.

Syntax

void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CWnd::OnDrawItem


CTabCtrl::GetCurFocus

Call this member function to retrieve the index of the tab with the current focus.

Syntax

int GetCurFocus( ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::GetCurSel


CTabCtrl::GetCurSel

Call this member function to retrieve the currently selected tab in a tab control.

Syntax

int GetCurSel( ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::SetCurSel, CTabCtrl::GetCurFocus


CTabCtrl::GetImageList

Call this member function to retrieve the image list associated with a tab control.

Syntax

HIMAGELIST GetImageList( ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::SetImageList, CImageList


CTabCtrl::GetItem

Call this member function to retrieve information about a tab in a tab control.

When the message is sent, the mask member specifies which attributes to return. If the mask member specifies the TCIF_TEXT value, the pszText member must contain the address of the buffer that receives the item text and the cchTextMax member must specify the size of the buffer.

Syntax

BOOL GetItem( int nItem, TC_ITEM* pTabCtrlItem ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::InsertItem, CTabCtrl::SetItem


CTabCtrl::GetItemCount

Call this member function to retrieve the number of tabs in the tab control.

Syntax

int GetItemCount( ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::GetItem, CTabCtrl::SetItem


CTabCtrl::GetItemRect

Call this member function to retrieve the bounding rectangle for the specified tab in a tab control.

Syntax

BOOL GetItemRect( int nItem, LPRECT lpRect ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::SetItemSize, CTabCtrl::AdjustRect


CTabCtrl::GetRowCount

Call this member function to retrieve the current number of rows in a tab control. Only tab controls that have the TCS_MULTILINE style can have multiple rows of tabs.

Syntax

int GetRowCount( ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::Create


CTabCtrl::HitTest

Call this member function to determine which tab, if any, is at the specified screen position.

Syntax

int HitTest( TC_HITTESTINFO* pHitTestInfo ) const;

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes


CTabCtrl::InsertItem

Call this member function to insert a new tab in an existing tab control.

Syntax

BOOL InsertItem( int nItem, TC_ITEM* pTabCtrlItem );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::GetItem, CTabCtrl::SetItem


CTabCtrl::RemoveImage

Call this member function to remove the specified image from a tab control's image list. The tab control updates each tab's image index so that each tab remains associated with the same image.

Syntax

void RemoveImage( int nImage );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::GetImageList, CTabCtrl::SetImageList


CTabCtrl::SetCurSel

Call this member function to select a tab in a tab control. A tab control does not send a TCN_SELCHANGING or TCN_SELCHANGE notification message when a tab is selected using this function. These notifications are sent, using WM_NOTIFY, when the user clicks or uses the keyboard to change tabs.

Syntax

int SetCurSel( int nItem );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::GetCurSel, CTabCtrl::GetCurFocus


CTabCtrl::SetImageList

Call this member function to assign an image list to a tab control.

Syntax

CImageList * SetImageList( CImageList * pImageList );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::GetImageList, CImageList


CTabCtrl::SetItem

Call this member function to set some or all of a tab's attributes.

Syntax

BOOL SetItem( int nItem, TC_ITEM* pTabCtrlItem );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::InsertItem, CTabCtrl::GetItem


CTabCtrl::SetItemSize

Call this member function to set the width and height of the tab control items.

Syntax

CSize SetItemSize( CSize size );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes, CTabCtrl::AdjustRect, CTabCtrl::GetItemRect, CTabCtrl::SetItemSize


CTabCtrl::SetPadding

Call this member function to set the amount of space (padding) around each tab's icon and label in a tab control.

Syntax

void SetPadding( CSize size );

At a Glance

Header File | Afxcoll.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTabCtrl Overview, CTabCtrl Member Functions, Control Classes


CTime

A CTime object represents an absolute time and date, based on coordinated universal time (UTC).

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE does not support the following member functions of the CTime class.

GetGmtTm

GetLocalTm

Format

FormatGmt

See Also

CTime Member Functions, CTime Operators, Simple Value Types


CTime Member Functions

Construction
CTime | Constructs CTime objects in various ways.
GetCurrentTime | Creates a CTime object that represents the current time (static member function).

Extraction
GetTime | Returns a time_t that corresponds to this CTime object.
GetYear | Returns the year that this CTime object represents.
GetMonth | Returns the month that this CTime object represents (1 through 12).
GetDay | Returns the day that this CTime object represents (1 through 31).
GetHour | Returns the hour that this CTime object represents (0 through 23).
GetMinute | Returns the minute that this CTime object represents (0 through 59).
GetSecond | Returns the second that this CTime object represents (0 through 61).
GetDayOfWeek | Returns the day of the week (1 for Sunday, 2 for Monday, and so forth).

See Also

CTime Overview, CTime Operators, Simple Value Types


CTime::CTime

Use these constructors to create a new CTime object initialized with the specified absolute time, based on the current time zone.

Syntax

CTime( );

CTime( const CTime& timeSrc );

CTime( time_t time );

CTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST = -1) );

CTime( WORD wDosDate, WORD wDosTime, int nDST = -1 );

CTime( const SYSTEMTIME& sysTime, int nDST = -1 );

CTime( const FILETIME& fileTime, int nDST = -1 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types, CTime::GetTime, GetCurrentTime, operator =


CTime::GetCurrentTime

Call this member function to obtain a CTime object that represents the current time.

Syntax

static CTime PASCAL GetCurrentTime( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types


CTime::GetDay

Call this member function to retrieve the day of the month, based on local time, in the range 1 through 31. This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Syntax

int GetDay( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types, CTime::GetDayOfWeek


CTime::GetDayOfWeek

Call this member function to retrieve the day of the week based on local time; 1 = Sunday, 2 = Monday, ..., 7 = Saturday. This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Syntax

int GetDayOfWeek( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types


CTime::GetHour

Call this member function to retrieve the hour, based on local time, in the range 0 through 23. This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Syntax

int GetHour( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types


CTime::GetMinute

Call this member function to retrieve the minute, based on local time, in the range 0 through 59. This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Syntax

int GetMinute( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types


CTime::GetMonth

Call this member function to retrieve the month, based on local time, in the range 1 through 12 (1 = January). This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Syntax

int GetMonth( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types


CTime::GetSecond

Call this member function to retrieve the second, based on local time, in the range 0 through 59. This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Syntax

int GetSecond( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types


CTime::GetTime

Call this member function to retrieve a time_t value for the given CTime object.

Syntax

time_t GetTime( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types, CTime::CTime


CTime::GetYear

Call this member function to retrieve the year, based on local time, in the range 1970 to 2038. This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Syntax

int GetYear( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Member Functions, Simple Value Types, CTime::CTime


CTime Operators

Operators
operator = | Assigns new time values.
operator + | Add CTimeSpan and CTime objects.
operator – | Subtract CTimeSpan and CTime objects.
operator += | Add a CTimeSpan object to this CTime object.
operator –= | Subtract a CTimeSpan object from this CTime object.
operator ==, < , etc. | Compare two absolute times.

Archive/Dump
operator << | Outputs a CTime object to CArchive or CDumpContext.
operator >> | Inputs a CTime object from CArchive.

See Also

CTime Overview, CTime Member Functions, Simple Value Types


CTime::operator =

Use these overloaded assignment operators copy the source time into this CTime object.

The internal time storage in a CTime object is independent of time zone. Time-zone conversion is not necessary during assignment.

Syntax

const CTime& operator =( const CTime& timeSrc );

const CTime& operator =( time_t t );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Operators, Simple Value Types, CTime::CTime


CTime::operator +, -

Use these operators to add and subtract CTimeSpan objects to and from CTime objects.

Use the third overloaded operator to subtract one CTime object from another to yield a CTimeSpan object.

CTime objects represent absolute time. CTimeSpan objects represent relative time.

Syntax

CTime operator +( CTimeSpan timeSpan ) const;

CTime operator –( CTimeSpan timeSpan ) const;

CTimeSpan operator –( CTime time ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Operators, Simple Value Types


CTime::operator +=, -=

CTime::operators +=, -=

Use these operators to add and subtract a CTimeSpan object to and from this CTime object.

Syntax

const CTime& operator +=( CTimeSpan timeSpan );

const CTime& operator –=( CTimeSpan timeSpan );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Operators, Simple Value Types


CTime Comparison Operators

Use these operators to compare two absolute times and return nonzero if the condition is true; otherwise zero.

Syntax

BOOL operator ==( CTime time ) const;

BOOL operator !=( CTime time ) const;

BOOL operator <( CTime time ) const;

BOOL operator >( CTime time ) const;

BOOL operator <=( CTime time ) const;

BOOL operator >=( CTime time ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Operators, Simple Value Types


CTime::operators <<, >>

Use the CTime insertion (<<) operator supports diagnostic dumping and storing to an archive.

Use the extraction (>>) operator supports loading from an archive.

When you send a CTime object to the dump context, the local time is displayed in readable date-time format.

Syntax

friend CDumpContext& AFXAPI operator<<( CDumpContext& dc, CTime time );

friend CArchive& AFXAPI operator<<( CArchive& ar, CTime time );

friend CArchive& AFXAPI operator>>( CArchive& ar, CTime& rtime );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTime Overview, CTime Operators, Simple Value Types, CArchive, CDumpContext


CTimeSpan

A CTimeSpan object represents a relative time span. The CTimeSpan class incorporates the ANSI time_t data type and its associated run-time functions.

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimeSpan Member Functions, CTimeSpan Operators, Simple Value Types


CTimeSpan Member Functions

Construction
CTimeSpan Constructs CTimeSpan objects in various ways.

Extraction
GetDays | Returns the number of complete days in this CTimeSpan.
GetHours | Returns the number of hours in the current day (–23 through 23).
GetTotalHours | Returns the total number of complete hours in this CTimeSpan.
GetMinutes | Returns the number of minutes in the current hour (–59 through 59).
GetTotalMinutes | Returns the total number of complete minutes in this CTimeSpan.
GetSeconds | Returns the number of seconds in the current minute (–59 through 59).
GetTotalSeconds | Returns the total number of complete seconds in this CTimeSpan.

Conversion
Format Converts a CTimeSpan into a formatted string.

See Also

CTimespan Overview, CTimeSpan Operators, Simple Value Types


CTimeSpan::CTimeSpan

Use these constructors to create a new CTimeSpan object initialized with the specified relative time.

Syntax

CTimeSpan( );

CTimeSpan( const CTimeSpan& timeSpanSrc );

CTimeSpan( time_t time );

CTimeSpan( LONG lDays, int nHours, int nMins, int nSecs );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::Format

Call this member function to generate a formatted string that corresponds to this CTimeSpan.

The Debug version of the library checks the formatting codes and asserts if the code is not in the list above.

Syntax

CString Format( LPCSTR pFormat ) const;

CString Format( LPCTSTR pFormat ) const;

CString Format( UINT nID ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::GetDays

Call this member function to retrieve the number of complete days represented by this CTimeSpan object. This value may be negative if the time span is negative.

Syntax

LONG GetDays( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::GetHours

Call this member function to retrieve the number of hours in the current day represented by this CTimeSpan object. The range is –23 through 23.

Syntax

int GetHours( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::GetMinutes

Call this member function to retrieve the number of minutes in the current hour represented by this CTimeSpan object. The range is –59 through 59.

Syntax

int GetMinutes( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::GetSeconds

Call this member function to retrieve the number of seconds in the current minute represented by this CTimeSpan object. The range is –59 through 59.

Syntax

int GetSeconds( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::GetTotalHours

Call this member function to retrieve the total number of complete hours in this CTimeSpan object.

Syntax

LONG GetTotalHours( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::GetTotalMinutes

Call this member function to retrieve the total number of complete minutes in this CTimeSpan object.

Syntax

LONG GetTotalMinutes( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::GetTotalSeconds

Call this member function to retrieve the total number of complete seconds in this CTimeSpan object.

Syntax

LONG GetTotalSeconds( ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan Operators

Operators
operator = | Assigns new time-span values.
operator + | Adds CTimeSpan objects.
operator – | Subtracts CTimeSpan objects.
operator += | Adds a CTimeSpan object to this CTimeSpan.
operator –= | Subtracts a CTimeSpan object from this CTimeSpan.
operator == < etc. | Compares two relative time values.

Archive/Dump
operator << | Outputs a CTimeSpan object to CArchive or CDumpContext.
operator >> | Inputs a CTimeSpan object from CArchive.

See Also

CTimespan Overview, CTimeSpan Member Functions, Simple Value Types


CTimeSpan::operator =

Use the overloaded assignment operator to copy the source CTimeSpan timeSpanSrc object into this CTimeSpan object.

const CTimeSpan& operator =( const CTimeSpan& timeSpanSrc );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Operators, Simple Value Types, CTimeSpan::CTimeSpan


CTimeSpan::operator +, -

Use these two operators to add and subtract CTimeSpan objects to and from each other.

CTimeSpan operator +( CTimeSpan timeSpan ) const;

CTimeSpan operator –( CTimeSpan timeSpan ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Operators, Simple Value Types


CTimeSpan::operator +=, -=

Use these operators to add and subtract a CTimeSpan object to and from this CTimeSpan.

const CTimeSpan& operator +=( CTimeSpan timeSpan );

const CTimeSpan& operator –=( CTimeSpan timeSpan );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Operators, Simple Value Types


CTimeSpan Comparison Operators

Use these operators to compare two relative time values. They return nonzero if the condition is true; otherwise zero.

BOOL operator ==( CTimeSpan timeSpan ) const;

BOOL operator !=( CTimeSpan timeSpan ) const;

BOOL operator <( CTimeSpan timeSpan ) const;

BOOL operator >( CTimeSpan timeSpan ) const;

BOOL operator <=( CTimeSpan timeSpan ) const;

BOOL operator >=( CTimeSpan timeSpan ) const;

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Operators, Simple Value Types


CTimeSpan::operators <<, >>

Use the CTimeSpan insertion (<<) operator for diagnostic dumping and storing to an archive.

Use the extraction (>>) operator for loading from an archive.

friend CDumpContext& AFXAPI operator<<( CDumpContext& dc, CTimeSpan timeSpan );

friend CArchive& AFXAPI operator<<( CArchive& ar, CTimeSpan timeSpan );

friend CArchive& AFXAPI operator>>( CArchive& ar, CTimeSpan& rtimeSpan );

At a Glance

Header file: Afx.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTimespan Overview, CTimeSpan Operators, Simple Value Types


CTreeCtrl

The CTreeCtrl class provides the functionality of the Windows common tree view control. A tree view control is a window that displays a hierarchical list of items, such as the headings in a document, the entries in an index, or the directories and files on a disk. Each item consists of a label and an optional bitmapped image, and each item can have a list of subitems associated with it. By clicking an item, the user can expand and collapse the associated list of subitems.

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Member Functions, Control Classes, CImageList


CTreeCtrl Member Functions

Construction
CTreeCtrl | Constructs a CTreeCtrl object.
Create | Creates a tree view control and attaches it to a CTreeCtrl object.

Attributes
GetCount | Retrieves the number of tree items associated with a tree view control.
GetIndent | Retrieves the offset (in pixels) of a tree view item from its parent.
SetIndent | Sets the offset (in pixels) of a tree view item from its parent.
GetImageList | Retrieves the handle to the image list associated with a tree view control.
SetImageList | Sets the handle to the image list associated with a tree view control.
GetNextItem | Retrieves the next tree view item that matches a specified relationship.
ItemHasChildren | Returns nonzero if the specified item has child items.
GetChildItem | Retrieves the child of a specified tree view item.
GetNextSiblingItem | Retrieves the next sibling of the specified tree view item.
GetPrevSiblingItem | Retrieves the previous sibling of the specified tree view item.
GetParentItem | Retrieves the parent of the specified tree view item.
GetFirstVisibleItem | Retrieves the first visible item of the specified tree view item.
GetNextVisibleItem | Retrieves the next visible item of the specified tree view item.
GetPrevVisibleItem | Retrieves the previous visible item of the specified tree view item.
GetSelectedItem | Retrieves the currently selected tree view item.
GetDropHilightItem | Retrieves the target of a drag-and-drop operation.
GetRootItem | Retrieves the root of the specified tree view item.
GetItem | Retrieves the attributes of a specified tree view item.
SetItem | Sets the attributes of a specified tree view item.
GetItemState | Returns the state of an item.
SetItemState | Sets the state of an item.
GetItemImage | Retrieves the images associated with an item.
SetItemImage | Associates images with an item.
GetItemText | Returns the text of an item.
SetItemText | Sets the text of an item.
GetItemData | Returns the 32-bit application-specific value associated with an item.
SetItemData | Sets the 32-bit application-specific value associated with an item.
GetItemRect | Retrieves the bounding rectangle of a tree view item.
GetEditControl | Retrieves the handle to the edit control used to edit the specified tree view item.
GetVisibleCount | Retrieves the number of visible tree items associated with a tree view control.

Operations
InsertItem | Inserts a new item in a tree view control.
DeleteItem | Deletes a new item in a tree view control.
DeleteAllItems | Deletes all items in a tree view control.
Expand | Expands, or collapses, the child items of the specified tree view item.
Select | Selects, scrolls into view, or redraws a specified tree view item.
SelectDropTarget | Redraws the tree item as the target of a drag-and-drop operation.
SelectItem | Selects a specified tree view item.
SelectSetFirstVisible | Selects a specified tree view item as the first visible item.
EditLabel | Edits a specified tree view item in-place.
HitTest | Returns the current position of the cursor related to the CTreeCtrl object.
CreateDragImage | Creates a dragging bitmap for the specified tree view item.
SortChildren | Sorts the children of a given parent item.
EnsureVisible | Ensures that a tree view item is visible in its tree view control.
SortChildrenCB | Sorts the children of a given parent item using an application-defined sort function.

See Also

CTreeCtrl Overview, Control Classes


CTreeCtrl::Create

Call this member function to create a tree view control and attach it to the CTreeCtrl object.

You construct a CTreeCtrl in two steps. First call the constructor, then call Create.

Syntax

BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

For information about supported tree control styles, see Tree View Styles.

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::CTreeCtrl


CTreeCtrl::CreateDragImage

Call this member function to create a dragging bitmap for the given item in a tree view control, create an image list for it, and add the bitmap to the image list.

Syntax

CImageList* CreateDragImage( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SelectDropTarget, CTreeCtrl::GetDropHilightItem, CTreeCtrl::SetImageList


CTreeCtrl::CTreeCtrl

Use this constructor to construct a CTreeCtrl object.

Syntax

CTreeCtrl( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::Create


CTreeCtrl::DeleteAllItems

Call this member function to delete all items from the tree view control.

Syntax

BOOL DeleteAllItems( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::DeleteItem, CTreeCtrl::InsertItem


CTreeCtrl::DeleteItem

Call this member function to delete an item from the tree view control.

Syntax

BOOL DeleteItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::DeleteAllItems, CTreeCtrl::InsertItem


CTreeCtrl::EditLabel

Call this member function to begin in-place editing of the specified item's text. The editing is accomplished by replacing the text of the item with a single-line edit control containing the text.

Syntax

CEdit* EditLabel( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetEditControl


CTreeCtrl::EnsureVisible

Call this member function to ensure that a tree view item is visible. If necessary, the function expands the parent item or scrolls the tree view control so that the item is visible.

Syntax

BOOL EnsureVisible( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetFirstVisibleItem, CTreeCtrl::GetVisibleCount


CTreeCtrl::Expand

Call this member function to expand or collapse the list of child items, if any, associated with the given parent item.

Syntax

BOOL Expand( HTREEITEM hItem, UINT nCode );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::EnsureVisible


CTreeCtrl::GetChildItem

Call this member function to retrieve the tree view item that is the child of the item specified by hItem.

Syntax

HTREEITEM GetChildItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItem, CTreeCtrl::GetParentItem, CTreeCtrl::SortChildren


CTreeCtrl::GetCount

Call this member function to retrieve a count of the items in a tree view control.

Syntax

UINT GetCount( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetVisibleCount


CTreeCtrl::GetDropHilightItem

Call this member function to retrieve the item that is the target of a drag-and-drop operation.

Syntax

HTREEITEM GetDropHilightItem( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SelectDropTarget


CTreeCtrl::GetEditControl

Call this member function to retrieve the handle to the edit control being used to edit a tree view item's text.

Syntax

CEdit* GetEditControl( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::EditLabel


CTreeCtrl::GetFirstVisibleItem

Call this member function to retrieve the first visible item of the tree view control.

Syntax

HTREEITEM GetFirstVisibleItem( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetNextVisibleItem, CTreeCtrl::GetPrevVisibleItem, CTreeCtrl::EnsureVisible, CTreeCtrl::GetVisibleCount


CTreeCtrl::GetImageList

Call this member function to retrieve the handle to the image list associated with the tree view control. Each item in a tree view control can have a pair of bitmapped images associated with it. One image is displayed when the item is selected, and the other is displayed when the item is not selected. For example, an item might display an open folder when it is selected and a closed folder when it is not selected.

Syntax

CImageList* GetImageList( UINT nImage );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CImageList, CTreeCtrl::SetImageList


CTreeCtrl::GetIndent

Call this member function to retrieve the amount, in pixels, that child items are indented relative to their parent items.

Syntax

UINT GetIndent( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SetIndent


CTreeCtrl::GetItem

Call this member function to retrieve the attributes of the specified tree view item.

Syntax

BOOL GetItem( TV_ITEM* pItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SetItem, CTreeCtrl::GetChildItem, CTreeCtrl::GetNextItem, CTreeCtrl::SelectItem


CTreeCtrl::GetItemData

Call this member function to retrieve the 32-bit application-specific value associated with the specified item.

Syntax

DWORD GetItemData( HTREEITEM hItem ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SetItemData


CTreeCtrl::GetItemImage

Call this member function to retrieve the index of the item's image and its selected image within the tree view control's image list.

Syntax

BOOL GetItemImage( HTREEITEM hItem, int& nImage, int& nSelectedImage ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SetItemImage, CImageList


CTreeCtrl::GetItemRect

Call this member function to retrieve the bounding rectangle for hItem and determine whether it is visible or not.

Syntax

BOOL GetItemRect( HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetVisibleCount, CTreeCtrl::GetNextVisibleItem, CTreeCtrl::GetPrevVisibleItem, CTreeCtrl::EnsureVisible


CTreeCtrl::GetItemState

Call this member function to retrieve the state of the item specified by hItem.

Syntax

UINT GetItemState( HTREEITEM hItem, UINT nStateMask ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItem


CTreeCtrl::GetItemText

Call this member function to retrieve the text of the item specified by hItem.

Syntax

CString GetItemText( HTREEITEM hItem ) const;

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SetItemText


CTreeCtrl::GetNextItem

Call this member function to retrieve the tree view item that has the specified relationship, indicated by the nCode parameter, to hItem.

Syntax

HTREEITEM GetNextItem( HTREEITEM hItem, UINT nCode );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SetItem, CTreeCtrl::GetChildItem, CTreeCtrl::GetItem, CTreeCtrl::SelectItem, CTreeCtrl::GetPrevSiblingItem


CTreeCtrl::GetNextSiblingItem

Call this member function to retrieve the next sibling of hItem.

Syntax

HTREEITEM GetNextSiblingItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetPrevSiblingItem, CTreeCtrl::GetChildItem, CTreeCtrl::GetItem, CTreeCtrl::SelectItem, CTreeCtrl::GetParentItem


CTreeCtrl::GetNextVisibleItem

Call this member function to retrieve the next visible item of hItem.

Syntax

HTREEITEM GetNextVisibleItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetPrevVisibleItem, CTreeCtrl::GetFirstVisibleItem, CTreeCtrl::EnsureVisible, CTreeCtrl::GetParentItem


CTreeCtrl::GetParentItem

Call this member function to retrieve the parent of hItem.

Syntax

HTREEITEM GetParentItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetChildItem, CTreeCtrl::GetRootItem, CTreeCtrl::GetItem, CTreeCtrl::GetPrevSiblingItem


CTreeCtrl::GetPrevSiblingItem

Call this member function to retrieve the previous sibling of hItem.

Syntax

HTREEITEM GetPrevSiblingItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetNextSiblingItem, CTreeCtrl::GetParentItem, CTreeCtrl::GetChildItem


CTreeCtrl::GetPrevVisibleItem

Call this member function to retrieve the previous visible item of hItem.

Syntax

HTREEITEM GetPrevVisibleItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetNextVisibleItem, CTreeCtrl::GetFirstVisibleItem, CTreeCtrl::EnsureVisible, CTreeCtrl::GetVisibleCount


CTreeCtrl::GetRootItem

Call this member function to retrieve the root item of the tree view control.

Syntax

HTREEITEM GetRootItem( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItem, CTreeCtrl::GetChildItem, CTreeCtrl::GetParentItem


CTreeCtrl::GetSelectedItem

Call this member function to retrieve the currently selected item of the tree view control.

Syntax

HTREEITEM GetSelectedItem( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::Select, CTreeCtrl::SelectDropTarget, CTreeCtrl::GetDropHilightItem


CTreeCtrl::GetVisibleCount

Call this member function to retrieve a count of the visible items in a tree view control.

Syntax

UINT GetVisibleCount( );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetCount, CTreeCtrl::EnsureVisible


CTreeCtrl::HitTest

Call this member function to determine the location of the specified point relative to the client area of a tree view control.

Syntax

HTREEITEM HitTest( CPoint pt, UINT* pFlags );

HTREEITEM HitTest( TV_HITTESTINFO* pHitTestInfo );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItemRect


CTreeCtrl::InsertItem

Call this member function to insert a new item in a tree view control.

Syntax

HTREEITEM InsertItem( LPTV_INSERTSTRUCT lpInsertStruct );

HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, HTREEITEM hParent, HTREEITEM hInsertAfter );

HTREEITEM InsertItem( LPCTSTR lpszItem, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST );

HTREEITEM InsertItem( LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::DeleteItem, CTreeCtrl::HitTest, CTreeCtrl::SelectDropTarget, CTreeCtrl::GetItem


CTreeCtrl::ItemHasChildren

Call this member function to determine whether the tree item specified by hItem has child items. If so, you can then use CTreeCtrl::GetChildItem to retrieve those child items.

Syntax

BOOL ItemHasChildren( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetChildItem


CTreeCtrl::Select

Call this member function to select the given tree view item, scroll the item into view, or redraw the item in the style used to indicate the target of a drag-and-drop operation.

Syntax

HTREEITEM Select( HTREEITEM hItem, UINT nCode );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SelectItem, CTreeCtrl::GetSelectedItem, CTreeCtrl::SelectDropTarget


CTreeCtrl::SelectDropTarget

Call this member function to redraw the item in the style used to indicate the target of a drag-and-drop operation.

Syntax

HTREEITEM SelectDropTarget( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SelectItem, CTreeCtrl::GetDropHilightItem, CTreeCtrl::CreateDragImage


CTreeCtrl::SelectItem

Call this member function to select the given tree view item.

Syntax

BOOL SelectItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::Select, CTreeCtrl::GetSelectedItem, CTreeCtrl::SelectDropTarget


CTreeCtrl::SelectSetFirstVisible

Call this member function to scroll the tree view vertically so the specified item is the first visible item. The function sends a TVM_SELECTITEM message to the window with the TVGN_FIRSTVISIBLE parameter.

Syntax

HTREEITEM SelectItem( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::Select, CTreeCtrl::GetSelectedItem, CTreeCtrl::SelectDropTarget, TVM_SELECTITEM


CTreeCtrl::SetImageList

Call this member function to set the normal or state image list for a tree view control and redraw the control using the new images.

Syntax

CImageList* SetImageList( CImageList * pImageList, int nImageListType );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CImageList, CTreeCtrl::GetImageList


CTreeCtrl::SetIndent

Call this member function to set the width of indentation for a tree view control and redraw the control to reflect the new width.

Syntax

void SetIndent( UINT nIndent );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetIndent, CTreeCtrl::GetItemRect


CTreeCtrl::SetItem

Call this member function to set the attributes of the specified tree view item.

Syntax

BOOL SetItem( TV_ITEM* pItem );

BOOL SetItem( HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItem


CTreeCtrl::SetItemData

Call this member function to set the 32-bit application-specific value associated with the specified item.

Syntax

BOOL SetItemData( HTREEITEM hItem, DWORD dwData );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItemData


CTreeCtrl::SetItemImage

Call this member function to set the index of the item's image and its selected image within the tree view control's image list.

Syntax

BOOL SetItemImage( HTREEITEM hItem, int nImage, int nSelectedImage );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItemImage, CImageList


CTreeCtrl::SetItemState

Call this member function to set the state of the item specified by hItem. For information on states, see CTreeCtrl::GetItem.

Syntax

BOOL SetItemState( HTREEITEM hItem, UINT nState, UINT nStateMask );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItem, CTreeCtrl::GetItemState


CTreeCtrl::SetItemText

Call this member function to set the text of the item specified by hItem.

Syntax

BOOL SetItemText( HTREEITEM hItem, LPCTSTR lpszItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::GetItemText


CTreeCtrl::SortChildren

Call this member function to sort the child items of the given parent item in a tree view control. If hItem is NULL, the entire tree control is sorted.

Syntax

BOOL SortChildren( HTREEITEM hItem );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SortChildrenCB


CTreeCtrl::SortChildrenCB

Call this member function to sort tree view items using an application-defined callback function that compares the items.

Syntax

BOOL SortChildrenCB( LPTV_SORTCB pSort );

At a Glance

Header File | Afxcmn.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CTreeCtrl Overview, CTreeCtrl Member Functions, Control Classes, CTreeCtrl::SortChildren


CTreeView

The CTreeView class simplifies use of the tree control and of CTreeCtrl, the class that encapsulates tree-control functionality, with MFC's document-view architecture.

At a Glance

Header file: Afxcview.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTreeView Member Functions, View Classes, CView, CCtrlView, CTreeCtrl


CTreeView Member Functions

Construction
CTreeView Constructs a CTreeView object.

Attributes
GetTreeCtrl Returns the tree control associated with the view.

See Also

CTreeView Overview, View Classes


CTreeView::CTreeView

Call this member function to construct a CTreeView object.

Syntax

CTreeView( );

At a Glance

Header file: Afxcview.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTreeView Overview, CTreeView Member Functions, View Classes, CTreeCtrl


CTreeView::GetTreeCtrl

Call this member function to retrieve a reference to the tree control associated with the view.

Syntax

CTreeCtrl& GetTreeCtrl( ) const;

At a Glance

Header file: Afxcview.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTreeView Overview, CTreeView Member Functions, View Classes CTreeCtrl


CTypedPtrArray

The CTypedPtrArray class provides a type-safe wrapper for objects of class CPtrArray or CObArray. When you use CTypedPtrArray rather than CPtrArray or CObArray, the C++ type-checking facility helps eliminate errors caused by mismatched pointer types.

Syntax

template< class BASE_CLASS, class TYPE >
class CTypedPtrArray : public BASE_CLASS

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Member Functions, CTypedPtrArray Operators, Typed Template Collections, CPtrArray, CObArray


CTypedPtrArray Member Functions

Element Access
Add | Adds a new element to the end of an array. Grows the array if necessary.
Append | Adds the contents of one array to the end of another. Grows the array if necessary.
Copy | Copies another array to the array; grows the array if necessary.
ElementAt | Returns a temporary reference to the element pointer within the array.
GetAt | Returns the value at a given index.
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
SetAt | Sets the value for a given index; the array is not allowed to grow.
SetAtGrow | Sets the value for a given index; grows the array if necessary.

See Also

CTypedPtrArray Overview, CTypedPtrArray Operators, Typed Template Collections


CTypedPtrArray::Add

Call this member function to add a new element to the end of an array, growing the array by one.

Syntax

int Add( TYPE newElement );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CObArray::Add


CTypedPtrArray::Append

Call this member function to add the contents of another array to the end of the given array. The arrays must be of the same type.

If necessary, Append may allocate extra memory to accommodate the elements appended to the array.

Syntax

int Append( const CTypedPtrArray<BASE_CLASS, TYPE>& src );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CObArray::Append


CTypedPtrArray::Copy

Call this member function to retrieve a temporary reference to the specified element within the array. This function is used to implement the left-side assignment operator for arrays.

Syntax

void Copy( const CTypedPtrArray<BASE_CLASS, TYPE>& src );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CObArray::Copy


CTypedPtrArray::ElementAt

Call this member function to retrieve a temporary reference to the specified element within the array. This function is used to implement the left-side assignment operator for arrays.

Syntax

TYPE& ElementAt( int nIndex );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CObArray::ElementAt, CObArray::GetUpperBound


CTypedPtrArray::GetAt

Call this member function to retrieve the CObject pointer associated with a given position.

Syntax

TYPE GetAt( int nIndex ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CObArray::GetAt, CObArray::GetUpperBound


CTypedPtrArray::InsertAt

Call this member function to insert one or more elements at a specified index in an array.

The first version of InsertAt inserts one element (or multiple copies of an element) at a specified index in an array. In the process, it shifts up (by incrementing the index) the existing element at this index, and it shifts up all the elements above it.

The second version inserts all the elements from another CObArray collection, starting at the nStartIndex position.

Syntax

void InsertAt( int nIndex, TYPE newElement, int nCount = 1 );

void InsertAt( int nStartIndex, CTypedPtrArray<BASE_CLASS, TYPE>* pNewArray );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CObArray::InsertAt


CTypedPtrArray::SetAt

Call this member function to set the array element at the specified index. SetAt will not cause the array to grow. Use CTypedPtrArray::SetAtGrow if you want the array to grow automatically.

You must ensure that your index value represents a valid position in the array. If it is out of bounds, then the Debug version of the library asserts.

Syntax

TYPE GetAt( int nIndex ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CTypedPtrArray::SetAtGrow, CObArray::SetAt


CTypedPtrArray::SetAtGrow

Call this member function to set the array element at the specified index. The array grows automatically if necessary (that is, the upper bound is adjusted to accommodate the new element).

Syntax

void SetAtGrow( int nIndex, TYPE newElement );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections, CObArray::SetAtGrow


CTypedPtrArray Operators

Operators
operator[] Sets or gets the element at the specified index.

See Also

CTypedPtrArray Overview, CTypedPtrArray Member Functions, Typed Template Collections


CTypedPtrArray::operator [ ]

Use these subscript operators as a convenient substitute for the SetAt and GetAt functions.

The first operator, called for arrays that are not const, can be used on either the right (r-value) or the left (l-value) of an assignment statement. The second, invoked for const arrays, can be used only on the right.

TYPE& operator[ ]( int nIndex );

TYPE operator[ ]( int nIndex ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrArray Overview, CTypedPtrArray Operators, Typed Template Collections, CObArray::operator []


CTypedPtrList

The CTypedPtrList class provides a type-safe wrapper for objects of class CPtrList or CObList. When you use CTypedPtrList rather than CPtrList or CObList, the C++ type-checking facility helps eliminate errors caused by mismatched pointer types.

Syntax

template< class BASE_CLASS, class TYPE >
class CTypedPtrList : public BASE_CLASS

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Member Functions, Typed Template Collections, CPtrList, CObList


CTypedPtrList Member Functions

Head/Tail Access
GetHead | Returns the head element of the list (cannot be empty).
GetTail | Returns the tail element of the list (cannot be empty).

Operations
RemoveHead | Removes the element from the head of the list.
RemoveTail | Removes the element from the tail of the list.
AddHead | Adds an element (or all the elements in another list) to the head of the list (makes a new head).
AddTail | Adds an element (or all the elements in another list) to the tail of the list (makes a new tail).

Iteration
GetNext | Gets the next element for iterating.
GetPrev | Gets the previous element for iterating.

Retrieval/Modification
GetAt | Gets the element at a given position.
SetAt | Sets the element at a given position.

See Also

CTypedPtrList Overview, Typed Template Collections


CTypedPtrList::AddHead

Call this member function to add elements to the head of the list. The first version adds a new element before the head of the list. The second version adds another list of elements before the head.

Syntax

POSITION AddHead( TYPE newElement );

void AddHead( CTypedPtrList<BASE_CLASS, TYPE> *pNewList );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections


CTypedPtrList::AddTail

Call this member function to add elements to the head of the list. The first version adds a new element after the tail of the list. The second version adds another list of elements after the tail.

Syntax

POSITION AddTail( TYPE newElement );

void AddTail( CTypedPtrList<BASE_CLASS, TYPE> *pNewList );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections


CTypedPtrList::GetAt

Call this member function to retrieve the CObject pointer associated with a given position.

Syntax

TYPE& GetAt( POSITION position );

TYPE GetAt( POSITION position ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CObList::GetAt


CTypedPtrList::GetHead

Call this member function to retrieve the pointer that represents the head element of this list.

Syntax

TYPE& GetHead( );

TYPE GetHead( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CPtrList::IsEmpty, CTypedPtrList::GetTail, CTypedPtrList::GetNext, CTypedPtrList::GetPrev


CTypedPtrList::GetNext

Call this member function to retrieve the list element identified by rPosition, and then set rPosition to the POSITION value of the next entry in the list.

Syntax

TYPE& GetNext( POSITION& rPosition );

TYPE GetNext( POSITION& rPosition ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CObList::Find, CObList::GetHeadPosition, CObList::GetTailPosition, CTypedPtrList::GetPrev, CTypedPtrList::GetHead, CTypedPtrList::GetTail


CTypedPtrList::GetPrev

Call this member function to retrieve the list element identified by rPosition, and then set rPosition to the POSITION value of the previous entry in the list.

Syntax

TYPE& GetPrev(POSITION& rPosition );

TYPE GetPrev( POSITION& rPosition ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CPtrList::Find, CPtrList::GetTailPosition, CPtrList::GetHeadPosition, CTypedPtrList::GetNext, CTypedPtrList::GetHead, CTypedPtrList::GetTail


CTypedPtrList::GetTail

Call this member function to retrieve the pointer that represents the last element of this list.

Syntax

TYPE& GetTail( );

TYPE GetTail( ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CPtrList::IsEmpty, CPtrList::Find, CPtrList::GetTailPosition, CPtrList::GetHeadPosition, CTypedPtrList::GetPrev, CTypedPtrList::GetNext, CTypedPtrList::GetHead


CTypedPtrList::RemoveHead

Call this member function to remove the element from the head of the list. This function returns the item that was removed.

You must ensure that the list is not empty before calling RemoveHead. If the list is empty, then the Debug version of the MFC for Windows CE asserts. Use CTypedPtrList::IsEmpty to verify that the list contains elements.

Syntax

TYPE RemoveHead( );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CTypedPtrList::RemoveTail, CPtrList::IsEmpty, CPtrList::GetHead, CPtrList::AddHead


CTypedPtrList::RemoveTail

Call this member function to remove the element from the tail of the list and returns it.

Syntax

TYPE RemoveTail( );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CTypedPtrList::RemoveHead, CPtrList::IsEmpty, CPtrList::GetTail, CPtrList::AddTail


CTypedPtrList::SetAt

Call this member function to write the object pointer to the specified position in the list. The pos parameter is a key for the list. It is not the same as an index, and you cannot operate on its value yourself.

Syntax

void SetAt( POSITION pos, TYPE newElement );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrList Overview, CTypedPtrList Member Functions, Typed Template Collections, CObList::SetAt


CTypedPtrMap

The CTypedPtrMap class provides a type-safe wrapper for objects of class CPtrMap or CObMap. When you use CTypedPtrMap rather than CPtrList or CObMap, the C++ type-checking facility helps eliminate errors caused by mismatched pointer types.

template< class BASE_CLASS, class KEY, class VALUE >
class CTypedPtrMap : public BASE_CLASS

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrMap Member Functions, CTypedPtrMap Operators, Typed Template Collections, CMapPtrToPtr, CMapPtrToWord, CMapWordToPtr, CMapStringToPtr


CTypedPtrMap Member Functions

Element Access
Lookup | Returns a KEY based on a VALUE.
GetNextAssoc | Gets the next element for iterating.
RemoveKey | Removes an element specified by a key.
SetAt | Inserts an element into the map; replaces an existing element if a matching key is found.

See Also

CTypedPtrMap Overview, CTypedPtrMap Operators, Typed Template Collections


CTypedPtrMap::GetNextAssoc

Call this member function to retrieve the map element at rNextPosition, and then update rNextPosition to refer to the next element in the map. This function is most useful for iterating through all the elements in the map.

Syntax

void GetNextAssoc( POSITION& rPosition, KEY& rKey, VALUE& rValue ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrMap Overview, CTypedPtrMap Member Functions, Typed Template Collections, CMapStringToOb::GetNextAssoc, CMapStringToOb::GetStartPosition


CTypedPtrMap::Lookup

Call this member function to quickly find the map element with a key that matches exactly. Lookup uses a hashing algorithm to find the element.

Syntax

BOOL Lookup( BASE_CLASS::BASE_ARG_KEY key, VALUE& rValue ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrMap Overview, CTypedPtrMap Member Functions, Typed Template Collections, CMapStringToOb::Lookup


CTypedPtrMap::RemoveKey

Call this member function to look up the map entry corresponding to the supplied key and, if the key is found, remove the entry.

Syntax

BOOL RemoveKey( ARG_KEY key );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrMap Overview, CTypedPtrMap Member Functions, Typed Template Collections


CTypedPtrMap::SetAt

Call this member function to insert an element in a map. First, the key is looked up. If the key is found, then the corresponding value is changed; otherwise a new key-value element is created.

Syntax

void SetAt( LPCTSTR key, CObject* newValue );
throw( CMemoryException );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrMap Overview, CTypedPtrMap Member Functions, Typed Template Collections


CTypedPtrMap Operators

Operators
operator[] Inserts an element into the map.

See Also

CTypedPtrMap Overview, CTypedPtrMap Member Functions, Typed Template Collections


CTypedPtrMap::operator [ ]

Use this operator on the left side of an assignment statement (an l-value) to retrieve a map element. If there is no map element with the specified key, then a new element is created. There is no "right side" (r-value) equivalent to this operator because there is a possibility that a key may not be found in the map.

VALUE& operator [ ]( BASE_CLASS::BASE_ARG_KEY key );

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CTypedPtrMap Overview, CTypedPtrMap Operators, Typed Template Collections, CTypedPtrMap::Lookup


CUIntArray

The CUIntArray class supports arrays of unsigned integers. The member functions of CUIntArray are similar to the member functions of class CObArray. Because of this similarity, you can use the CObArray reference documentation for member function specifics. Wherever you see a CObject pointer as a function parameter or return value, substitute a UINT.

CObject* CObArray::GetAt( int <nIndex> ) const;

for example, translates to

UINT CUIntArray::GetAt( int <nIndex> ) const;

At a Glance

Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Array Classes


CUIntArray Class Members

Construction
CUIntArray Constructs an empty array for unsigned integers.

Bounds
GetSize | Gets the number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.

Operations
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.

Element Access
GetAt | Returns the value at a given index.
SetAt | Sets the value for a given index; the array is not allowed to grow.
ElementAt | Returns a temporary reference to the element pointer within the array.

Growing the Array
SetAtGrow | Sets the value for a given index; grows the array if necessary.
Add | Adds an element to the end of the array; grows the array if necessary.

Insertion/Removal
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.

Operators
operator [ ] Sets or gets the element at the specified index.

See Also

CUIntArray Overview, Array Classes


CUserException

A CUserException is thrown to stop an end-user operation. Use CUserException when you want to use the throw/catch exception mechanism for application-specific exceptions.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Exception Classes, CException


CView

The CView class provides the basic functionality for user-defined view classes. A view is attached to a document and acts as an intermediary between the document and the user: the view renders an image of the document on the screen or printer and interprets user input as operations upon the document.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE does not support the following member functions of the CView class.

DoPreparePrinting

IsSelected

OnBeginPrinting

OnDragEnter

OnDragLeave

OnDragOver

OnDragScroll

OnDrop

OnDropEx

OnEndPrinting

OnEndPrintPreview

OnPreparePrinting

OnPrint

MFC for Windows CE does not support the following classes derived from CView in standard MFC.

CDaoRecordView

CRecordView

CRichEditView

See Also

CView Member Functions, View Classes, CWnd, CFrameWnd, CSplitterWnd, CDC, CDocTemplate, CDocument


CView Member Functions

Constructors
CView Constructs a CView object.

Operations
GetDocument Returns the document associated with the view.

Overridables
OnInitialUpdate | Called after a view is first attached to a document.
OnScrollBy | Called when a view containing active in-place OLE items is scrolled.
OnScroll | Called when OLE items are dragged beyond the borders of the view.
OnActivateView | Called when a view is activated.
OnActivateFrame | Called when the frame window containing the view is activated or deactivated.
OnDraw | Called to render an image of the document for screen display, printing, or print preview. Implementation required.
OnPrepareDC | Called before the OnDraw member function is called for screen display.
OnUpdate | Called to notify a view that its document has been modified.

See Also

CView Overview, View Classes


CView::CView

Use this constructor to construct a CView object. The framework calls the constructor when a new frame window is created or a window is split.

Syntax

CView( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CView::OnInitialUpdate


CView::GetDocument

Call this member function to retrieve a pointer to the view's document. This allows you to call the document's member functions.

Syntax

CDocument* GetDocument( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CDocument


CView::OnActivateFrame

This member function is called by the framework when the frame window containing the view is activated or deactivated.

Syntax

virtual void OnActivateFrame( UINT nState, CFrameWnd* pFrameWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CWnd::OnActivate, CFormView


CView::OnActivateView

This member function is called by the framework when a view is activated or deactivated. The default implementation of this function sets the focus to the view being activated.

Syntax

virtual void OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CWnd::OnActivate, CFrameWnd::SetActiveView, CFrameWnd::GetActiveView


CView::OnDraw

This member function is called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case.

Syntax

virtual void OnDraw( CDC* pDC ) = 0;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CWnd::OnCreate, CWnd::OnDestroy, CWnd::PostNcDestroy


CView::OnInitialUpdate

This member function is called by the framework after the view is first attached to the document, but before the view is initially displayed.

Syntax

virtual void OnInitialUpdate( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CView::OnUpdate


CView::OnPrepareDC

This member function is called by the framework before the OnDraw member function is called for screen display.

Syntax

virtual void OnPrepareDC( CDC* pDC, ConstVoid* * pUnused= NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CView::OnDraw


CView::OnScroll

This member function is called by the framework to determine whether scrolling is possible.

Syntax

virtual BOOL CView::OnScroll( UINT nScrollCode, UINT nPos, BOOL bDoScroll = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CView::OnScrollBy, COleClientItem


CView::OnScrollBy

This member function is called by the framework when the user views an area beyond the present view of the document, either by dragging an OLE item against the view's current borders or by manipulating the vertical or horizontal scrollbars.

Syntax

BOOL CView::OnScrollBy( CSize sizeScroll, BOOL bDoScroll = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CWnd::OnHScroll, CWnd::OnVScroll


CView::OnUpdate

This member function is called by the framework after the view's document has been modified. The default implementation invalidates the entire client area, marking it for painting when the next WM_PAINT message is received.

Syntax

virtual void OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CView Overview, CView Member Functions, View Classes, CDocument::UpdateAllViews, CView::OnInitialUpdate, CWnd::Invalidate, CWnd::InvalidateRect, WM_PAINT


CWaitCursor

The CWaitCursor class provides a one-line way to show a wait cursor, which is usually displayed as an hourglass, while you are doing a lengthy operation

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CWaitCursor Member Functions, Support Classes, CCmdTarget::BeginWaitCursor, CCmdTarget::EndWaitCursor, CCmdTarget::RestoreWaitCursor, CWinApp::DoWaitCursor


CWaitCursor Member Functions

Construction/Destruction
CWaitCursor Constructs a CWaitCursor object and displays the wait cursor.

Operations
Restore Restores the wait cursor after it has been changed.

See Also

CWaitCursor Overview, Support Classes


CWaitCursor::CWaitCursor

To display a wait cursor, just declare a CWaitCursor object before the code that performs the lengthy operation. The default constructor automatically causes the wait cursor to be displayed.

Syntax

CWaitCursor( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CWaitCursor Overview, CWaitCursor Member Functions, Support Classes, CWaitCursor::Restore, CCmdTarget::BeginWaitCursor, CCmdTarget::EndWaitCursor


CWaitCursor::Restore

Call this member function to restore the wait cursor after performing an operation, such as displaying a message box or dialog box, which might change the wait cursor to another cursor.

Syntax

void Restore( );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CWaitCursor Overview, CWaitCursor Member Functions, Support Classes, CCmdTarget::RestoreWaitCursor


CWinApp

The CWinApp class is the base class from which you derive a Windows application object. An application object provides member functions for initializing your application (and each instance of it) and for running the application.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The CWinApp constructor has been changed. In addition to providing the application's name, you can optionally provide the name of its help file as well.

Windows CE supports the CWinApp::LoadIcon member function differently than Windows 95 and Windows NT do.

MFC for Windows CE supports the CWinApp::ProcessMessageFilter member function for compatibility with existing code, but this function does not do anything in Windows CE.

Windows CE does not initialize the m_pszExeName property to the application's executable file name. If you use this data member, you must assign it a value, yourself.

MFC for Windows CE does not support the m_pActiveWnd property of the CWinApp class.

MFC for Windows CE does not support the following member functions of the CWinApp class.

CreatePrinterDC

EnableShellOpen

Enable3dControls

Enable3dControlsStatic

GetPrinterDeviceDefaults

LoadCursor

LoadOEMCursor

LoadStandardCursor

OnContextHelp

OnFilePrintSetup

OnHelpIndex

OnHelpFinder

OnHelpUsing

PreTranslateMessage

RegisterShellFileTypes

RunAutomated

RunEmbedded

SelectPrinter

See Also

CWinApp Member Functions, CWinApp Data Members, Application Architecture Classes, CWinApp::CWinApp, CWinApp::LoadIcon, CWinApp::ProcessMessageFilter, ,


CWinApp Member Functions

Construction
CWinApp Constructs a CWinApp object.

Operations
LoadIcon | Loads an icon resource.
LoadStandardIcon | Loads a Windows predefined icon that the IDI_ constants specify in WINDOWS.H.
LoadOEMIcon | Loads a Windows OEM predefined icon that the OIC_ constants specify in WINDOWS.H.
ParseCommandLine | Parses individual parameters and flags in the command line.
ProcessShellCommand | Handles command-line arguments and flags.
GetProfileInt | Retrieves an integer from an entry in the application's .INI file.
WriteProfileInt | Writes an integer to an entry in the application's .INI file.
GetProfileString | Retrieves a string from an entry in the application's .INI file.
WriteProfileString | Writes a string to an entry in the application's .INI file.
AddDocTemplate | Adds a document template to the application's list of available document templates.
GetFirstDocTemplatePosition | Retrieves the position of the first document template.
GetNextDocTemplate | Retrieves the position of a document template. Can be used recursively.
OpenDocumentFile | Called by the framework to open a document from a file.
AddToRecentFileList | Adds a filename to the most recently used (MRU) file list.

Overridables
InitApplication | Override to perform any application-level initialization.
InitInstance | Override to perform Windows instance initialization, such as creating your window objects.
Run | Runs the default message loop. Override to customize the message loop.
OnIdle | Override to perform application-specific idle-time processing.
ExitInstance | Override to clean up when your application terminates.
HideApplication | Hides the application before closing all documents.
CloseAllDocuments | Closes all open documents.
SaveAllModified | Prompts the user to save all modified documents.
DoMessageBox | Implements AfxMessageBox for the application.
ProcessMessageFilter | Intercepts certain messages before they reach the application.
ProcessWndProcException | Intercepts all unhandled exceptions thrown by the application's message and command handlers.
DoWaitCursor | Turns the wait cursor on and off.
OnDDECommand | Called by the framework in response to a dynamic data exchange (DDE) execute command.
WinHelp | Calls the WinHelp Windows function.

Initialization
LoadStdProfileSettings | Loads standard .INI file settings and enables the MRU file list feature.
SetDialogBkColor | Sets the default background color for dialog boxes and message boxes.
SetRegistryKey | Causes application settings to be stored in the registry instead of .INI files.

Command Handlers
OnFileNew | Implements the ID_FILE_NEW command.
OnFileOpen | Implements the ID_FILE_OPEN command.
OnHelp | Handles F1 Help within the application (using the current context).

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes


CWinApp::AddDocTemplate

Call this member function to add a document template to the list of available document templates that the application maintains.

Syntax

void AddDocTemplate( CDocTemplate* pTemplate );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::AddToRecentFileList

Call this member function to add the file specified by lpszPathName to the MRU file list.

Syntax

virtual void AddToRecentFileList( LPCTSTR lpszPathName );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::LoadStdProfileSettings


CWinApp::CloseAllDocuments

Call this member function to close all open documents before exiting. Call HideApplication before calling CloseAllDocuments.

Syntax

void CloseAllDocuments( BOOL bEndSession );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::SaveAllModified, CWinApp::HideApplication, HideApplication


CWinApp::CWinApp

Use3 this constructor to construct a CWinApp object and store the string in the lpszAppName parameter as the application name.

Syntax

CWinApp ( LPCTSTR lpszAppName, LPCTSTR lpszHelpName = _T("") );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Parameters

lpszAppName
A null-terminated string that contains the application name that Windows CE uses. Unlike Standard MFC, this argument is not optional. Also, the resource string AFX_IDS_APP_TITLE is not used.
lpszHelpName
A null-terminated string that contains the name of the help file that Windows CE uses. This argument is optional.

Remarks

A new parameter has been added to the CWinApp constructor. In addition to providing the application's name, you can optionally provide the name of its help file as well, in the lpszHelpName parameter.

You specify a help file to be used with the application as follows.

CWinApp(_T("My App"), _T("myApp.htc"));

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::DoMessageBox

This member function is called by the framework to implement a message box for the global function AfxMessageBox.

Syntax

virtual int DoMessageBox( LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::DoWaitCursor

This member function is called by the framework to implement CWaitCursor, CCmdTarget::BeginWaitCursor, CCmdTarget::EndWaitCursor, and CCmdTarget::RestoreWaitCursor.

Syntax

virtual void DoWaitCursor( int nCode );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CCmdTarget::BeginWaitCursor, CCmdTarget::EndWaitCursor, CCmdTarget::RestoreWaitCursor, CWaitCursor


CWinApp::ExitInstance

This member function is called by the framework from within the Run member function to exit this instance of the application.

Syntax

virtual int ExitInstance( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::Run, CWinApp::InitInstance


CWinApp::GetFirstDocTemplatePosition

Call this member function to retrieve the position of the first document template in the application.

Syntax

POSITION GetFirstDocTemplatePosition( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::AddDocTemplate, CWinApp::GetNextDocTemplate


CWinApp::GetNextDocTemplate

Call this member function to retrieve the document template identified by pos, then sets pos to the POSITION value.

Syntax

CDocTemplate* GetNextDocTemplate( POSITION& pos ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::AddDocTemplate, CWinApp::GetFirstDocTemplatePosition


CWinApp::GetProfileInt

Call this member function to retrieve the value of an integer from an entry within a specified section of the application's .INI file.

Syntax

UINT GetProfileInt( LPCTSTR lpszSection, LPCTSTR lpszEntry, int nDefault );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::GetProfileString, CWinApp::WriteProfileInt


CWinApp::GetProfileString

Call this member function to retrieve the string associated with an entry within the specified section in the application's .INI file.

Syntax

CString GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::GetProfileInt, CWinApp::WriteProfileString


CWinApp::HideApplication

Call this member function to hide an application before closing the open documents.

Syntax

void HideApplication( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::CloseAllDocuments


CWinApp::InitApplication

This member function is called by the version of WinMain that the framework provides. Override InitApplication to implement one-time initialization such as Windows class registration.

The InitApplication member function is obsolete in MFC. Any initialization that you would have done in InitApplication should be moved to InitInstance. If you override InitApplication, and do not call the base class function, you will leak the CDocTemplate objects that were added through CWinApp::AddDocTemplate.

Syntax

virtual BOOL InitApplication( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::InitInstance


CWinApp::InitInstance

Windows allows several copies of the same program to run at the same time. Application initialization is conceptually divided into two sections: one-time application initialization that is done the first time the program runs, and instance initialization that runs each time a copy of the program runs, including the first time. The framework's implementation of WinMain calls this member function.

Syntax

virtual BOOL InitInstance( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::InitApplication


CWinApp::LoadIcon

Call this member function to load the icon resource named by lpszResourceName or specified by nIDResource from the executable file.

Syntax

HICON LoadIcon( LPCTSTR lpszResourceName ) const;

HICON LoadIcon( UINT nIDResource ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE doesn't support any of the predefined icons (IDI_*).

In Windows CE 1.0, the icon must be a two bit per pixel (.ic2) icon or a monochrome icon.

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::LoadStandardIcon, CWinApp::LoadOEMIcon


CWinApp::LoadOEMIcon

Call this member function to load the Windows predefined icon resource specified by nIDIcon.

Syntax

HICON LoadOEMIcon( UINT nIDIcon ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::LoadStandardIcon, CWinApp::LoadIcon


CWinApp::LoadStandardIcon

Call this member function to load the Windows predefined icon resource that lpszIconName specifies.

Syntax

HICON LoadStandardIcon( LPCTSTR lpszIconName ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::LoadOEMIcon, CWinApp::LoadIcon


CWinApp::LoadStdProfileSettings

Call this member function from within the InitInstance member function to enable and load the list of most recently used (MRU) files and last preview state.

Syntax

void LoadStdProfileSettings( UINT nMaxMRU = _AFX_MRU_COUNT );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::AddToRecentFileList, CWinApp::InitInstance, CWinApp::OnFileOpen


CWinApp::OnDDECommand

This member function is called by the framework when the main frame window receives a DDE execute message.

Syntax

virtual BOOL OnDDECommand( LPTSTR lpszCommand );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::OnFileNew

If enabled, this function handles execution of the File New command.

Syntax

afx_msg void OnFileNew( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::OnFileOpen


CWinApp::OnFileOpen

If enabled, this function handles execution of the File Open command.

Syntax

afx_msg void OnFileOpen( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::OnFileNew


CWinApp::OnHelp

If enabled, called by the framework when the user presses the f1 key.

Syntax

afx_msg void OnHelp( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::WinHelp


CWinApp::OnIdle

This member function is called by the framework in the default message loop when the application's message queue is empty. Override this member function to perform idle-time processing. Use your override to call your own background idle-handler tasks.

Syntax

virtual BOOL OnIdle( LONG lCount );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::OpenDocumentFile

This member function is called by the framework to open the named CDocument file for the application.

Syntax

virtual CDocument* OpenDocumentFile( LPCTSTR lpszFileName );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CDocument


CWinApp::ParseCommandLine

Call this member function to parse the command line and send the parameters, one at a time, to CCommandLineInfo::ParseParam.

Syntax

void ParseCommandLine( CCommandLineInfo& rCmdInfo );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CCommandLineInfo, CWinApp::InitInstance, CCommandLineInfo::ParseParam, CWinApp::ProcessShellCommand, CCommandLineInfo::m_nShellCommand


CWinApp::ProcessMessageFilter

This member function doesn't do anything in Windows CE. MFC for Windows CE supports this function solely for compatibility with existing code.

virtual BOOL ProcessMessageFilter ( int code, LPMSG lpMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support hooking messages because the extra processing required by hooks could seriously degrade the performance of Windows CE-based devices. MFC for Windows CE supports the CWinApp::ProcessMessageFilter function for compatibility with existing code, but this function does not do anything. It just returns FALSE.

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::ProcessShellCommand

This member function is called by InitInstance to accept the parameters passed from the CCommandLineInfo object identified by rCmdInfo, and perform the indicated action.

Syntax

BOOL ProcessShellCommand( CCommandLineInfo& rCmdInfo );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::InitInstance, CWinApp::ParseCommandLine, CCommandLineInfo, CCommandLineInfo::ParseParam, CCommandLineInfo::m_nShellCommand


CWinApp::ProcessWndProcException

The framework calls this member function whenever the handler does not catch an exception thrown in one of your application's message or command handlers.

Syntax

virtual LRESULT ProcessWndProcException( CException* e, const MSG* pMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWnd::WindowProc, CException


CWinApp::Run

This function provides a default message loop. Run acquires and dispatches Windows messages until the application receives a WM_QUIT message.

Syntax

virtual int Run( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::SaveAllModified

This member function is called by the framework to save all documents when the application's main frame window is to be closed, or through a WM_QUERYENDSESSION message.

Syntax

virtual BOOL SaveAllModified( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::SetDialogBkColor

Call this member function from within the InitInstance member function to set the default background and text color for dialog boxes and message boxes within your application.

Syntax

void SetDialogBkColor( COLORREF clrCtlBk = RGB(192, 192, 192), COLORREF clrCtlText = RGB(0, 0, 0) );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::InitInstance


CWinApp::SetRegistryKey

Call this member function to cause application settings to be stored in the registry instead of INI files.

Syntax

void SetRegistryKey( LPCTSTR lpszRegistryKey );

void SetRegistryKey( UINT nIDRegistryKey );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::InitInstance, CWinApp::InitApplication, CWinApp::GetProfileInt, CWinApp::GetProfileString, CWinApp::WriteProfileInt, CWinApp::WriteProfileString


CWinApp::WinHelp

Call this member function to invoke the WinHelp application.

Syntax

virtual void WinHelp( DWORD dwData, UINT nCmd = HELP_CONTEXT );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::OnHelp


CWinApp::WriteProfileInt

Call this member function to write the specified value into the specified section of the application's .INI file.

Syntax

BOOL WriteProfileInt( LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::GetProfileInt, CWinApp::WriteProfileString


CWinApp::WriteProfileString

Call this member function to write the specified string into the specified section of the application's .INI file.

Syntax

BOOL WriteProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes, CWinApp::GetProfileString, CWinApp::WriteProfileInt


CWinApp Data Members

Data Members
m_pszAppName | Specifies the name of the application.
m_hInstance | Identifies the current instance of the application.
m_hPrevInstance | Set to NULL in a 32-bit application.
m_lpCmdLine | Points to a null-terminated string that specifies the command line for the application.
m_nCmdShow | Specifies how the window is to be shown initially.
m_bHelpMode | Indicates if the user is in Help context mode (typically invoked with SHIFT+F1).
m_pszExeName | The module name of the application. This data member is not initialized to the application's name in Windows CE.
m_pszHelpFilePath | The path to the application's Help file.
m_pszProfileName | The application's .INI filename.
m_pszRegistryKey | Used to determine the full registry key for storing application profile settings.

See Also

CWinApp Overview, CWinApp Member Functions, Application Architecture Classes


CWinApp::m_bHelpMode

This data member contains a boolean value that's set to TRUE if the application is in Help context mode (conventionally invoked with SHIFT + F1), and FALSE if not. Examine this flag if you want to implement special handling when in the Help mode.

BOOL m_bHelpMode;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes


CWinApp::m_hInstance

This data member contains a handle to the current instance of the application running under Windows. It corresponds to the hInstance parameter passed by Windows to WinMain. This member is returned by the global function AfxGetInstanceHandle.

HINSTANCE m_hInstance;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes


CWinApp::m_hPrevInstance

This data member corresponds to the hPrevInstance parameter passed by Windows to WinMain.

HINSTANCE m_hPrevInstance;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes


CWinApp::m_lpCmdLine

This data member contains a pointer to a null-terminated string that specifies the command line for the application. It corresponds to the lpCmdLine parameter passed by Windows to WinMain.

LPTSTR m_lpCmdLine;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes


CWinApp::m_nCmdShow

This data member corresponds to the nCmdShow parameter passed by Windows to WinMain. You pass m_nCmdShow as an argument when you call CWnd::ShowWindow for your application's main window.

int m_nCmdShow;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes, CWnd::ShowWindow


CWinApp::m_pszAppName

This data member specifies the name of the application. The application name can come from the parameter passed to the CWinApp constructor, or, if not specified, to the resource string with the identifier of AFX_IDS_APP_TITLE. If the application name is not found in the resource, it comes from the program's .EXE filename.

const char* m_pszAppName;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes, CWinApp


CWinApp::m_pszExeName

This data member contains the name of the application's executable file without an extension. Unlike m_pszAppName, this name cannot contain blanks.

const char* m_pszExeName;

Note If you assign a value to m_pszExeName, it must be dynamically allocated on the heap.

LPCTSTR m_pszExeName;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, this member is not initialized to the application's executable file name. If you use it, you must assign it a value, yourself.

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes


CWinApp::m_pszHelpFilePath

This data member contains the path to the application's Help file.

LPCTSTR m_pszHelpFilePath;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes


CWinApp::m_pszProfileName

This data member contains the name of the application's .INI file.

LPCTSTR m_pszProfileName;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes, CWinApp::GetProfileString, CWinApp::GetProfileInt, CWinApp::WriteProfileInt, CWinApp::WriteProfileString


CWinApp::m_pszRegistryKey

This data member is used to determine the full registry key for storing application profile settings. Normally, this data member is treated as read-only.

LPCTSTR m_pszRegistryKey;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinApp Overview, CWinApp Data Members, Application Architecture Classes, CWinApp::SetRegistryKey


CWindowDC

The CWindowDC class is derived from CDC. It calls the Windows functions GetWindowDC at construction time and ReleaseDC at destruction time.

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CWindowDC Member Functions, CWindowDC Data Members, Graphical Drawing Classes, CDC


CWindowDC Member Functions

Construction
CWindowDC Constructs a CWindowDC object.

See Also

CWindowDC Overview, CWindowDC Data Members, Graphical Drawing Classes


CWindowDC::CWindowDC

Use this constructor to construct a CWindowDC object that accesses the entire screen area (both client and nonclient) of the CWnd object pointed to by pWnd. The constructor calls the Windows function GetDC.

Syntax

CWindowDC( CWnd* pWnd );
throw( CResourceException );

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CWindowDC Overview, CWindowDC Member Functions, Graphical Drawing Classes, CDC, CClientDC, CWnd


CWindowDC Data Members

Data Members
m_hWnd The HWND to which this CWindowDC is attached.

See Also

CWindowDC Overview, CWindowDC Member Functions, Graphical Drawing Classes


CWindowDC::m_hWnd

This data member contains the window handle to the CWnd object used to construct the CWindowDC object. m_hWnd is a protected variable of type HWND.

HWND m_hWnd;

At a Glance

Header file: Afxwin.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

CWindowDC Overview, CWindowDC Data Members, Graphical Drawing Classes


CWinThread

A CWinThread object represents a thread of execution within an application. The main thread of execution is usually provided by an object derived from CWinApp, which is derived from CWinThread. Additional CWinThread objects allow multiple threads within a given application.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE supports thread priorities differently than Windows 95 and Windows NT do, so the CWinThread::SetThreadPriority and CWinThread::GetThreadPriority member functions accept and return different values than they do in those versions of Windows.

MFC for Windows CE supports the CWinThread::ProcessMessageFilter member function for compatibility with existing code, but this function does not do anything in Windows CE.

See Also

CWinThread Member Functions, CWinThread Data Members, Application Architecture Classes, CWinThread::SetThreadPriority, CWinThread::GetThreadPriority, CWinApp, CCmdTarget


CWinThread Member Functions

Construction
CWinThread | Constructs a CWinThread object.
CreateThread | Starts execution of a CWinThread object.

Operations
GetMainWnd | Retrieves a pointer to the main window for the thread.
GetThreadPriority | Gets the priority of the current thread.
ResumeThread | Decrements a thread's suspend count.
SetThreadPriority | Sets the priority of the current thread.
SuspendThread | Increments a thread's suspend count.

Overridables
ExitInstance | Override to clean up when your thread terminates.
InitInstance | Override to perform thread instance initialization.
OnIdle | Override to perform thread-specific idle-time processing.
PreTranslateMessage | Filters messages before they are dispatched to the Windows functions TranslateMessage and DispatchMessage.
IsIdleMessage | Checks for special messages.
ProcessWndProcException | Intercepts all unhandled exceptions thrown by the thread's message and command handlers.
ProcessMessageFilter | Intercepts certain messages before they reach the application.
Run | Controlling function for threads with a message pump. Override to customize the default message loop.

See Also

CWinThread Overview, CWinThread Data Members, Application Architecture Classes


CWinThread::CreateThread

Call this member function to create a thread to execute within the address space of the calling process.

Syntax

BOOL CreateThread( DWORD dwCreateFlags = 0, UINT nStackSize = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinThread::CWinThread


CWinThread::CWinThread

Use this constructor to construct a CWinThread object.

Syntax

CWinThread( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinThread::CreateThread


CWinThread::ExitInstance

This member function is called by the framework to exit this instance of the thread. It's called either from within the rarely overridden Run member function, or if a call to InitInstance fails.

Syntax

virtual int ExitInstance( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, InitInstance, Run, CWinApp::ExitInstance


CWinThread::GetMainWnd

Call this member function to retrieve a pointer to the active main window of the application, instead of directly referring to the m_pMainWnd member of the application object, if your application is an ActiveX server. For user-interface threads, this is equivalent to directly referring to the m_pActiveWnd member of your application object.

If your application is not an ActiveX server, then calling this function is equivalent to directly referring to the m_pMainWnd member of your application object.

Syntax

virtual CWnd * GetMainWnd( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes


CWinThread::GetThreadPriority

Call this member function to retrieve the current thread priority level of this thread.

Syntax

int GetThreadPriority( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinThread::SetThreadPriority


CWinThread::InitInstance

Overridde this function to initialize each new instance of a user-interface thread. Typically, you override InitInstance to perform tasks that must be completed when a thread is first created.

This member function is used only in user-interface threads. Perform initialization of worker threads in the controlling function passed to AfxBeginThread.

Syntax

virtual BOOL InitInstance( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinApp::InitInstance


CWinThread::IsIdleMessage

Override this function to keep OnIdle from being called after specific messages are generated.

Syntax

virtual BOOL IsIdleMessage( MSG* pMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes


CWinThread::OnIdle

Override this function to perform idle-time processing.

Syntax

virtual BOOL OnIdle( LONG lCount );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinApp::OnIdle


CWinThread::PreTranslateMessage

Override this function to filter window messages before they are dispatched to the Windows functions ::TranslateMessage and ::DispatchMessage.

Syntax

virtual BOOL PreTranslateMessage( MSG *pMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes


CWinThread::ProcessMessageFilter

This member function does not do anything in Windows CE. MFC for Windows CE supports this function solely for compatibility with existing code.

virtual BOOL ProcessMessageFilter ( int code, LPMSG lpMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support hooking messages because the extra processing required by hooks could seriously degrade the performance of Windows CE-based devices. MFC for Windows CE supports the CWinThread::ProcessMessageFilter function for compatibility with existing code, but this function does not do anything; it just returns FALSE.

See Also

CWinApp Overview, Application Architecture Classes


CWinThread::ProcessWndProcException

The framework calls this member function whenever the handler does not catch an exception thrown in one of your thread's message or command handlers.

Syntax

virtual LRESULT ProcessWndProcException( CException *e, const MSG *pMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinApp::ProcessWndProcException


CWinThread::ResumeThread

Call this member function to resume execution of a thread that was suspended by the SuspendThread member function, or of a thread that was created with the CREATE_SUSPENDED flag.

Syntax

DWORD ResumeThread( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinThread::SuspendThread


CWinThread::Run

This function provides a default message loop for user-interface threads. Run acquires and dispatches Windows messages until the application receives a WM_QUIT message. This function is rarely overridden.

Syntax

virtual int Run( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinApp::Run


CWinThread::SetThreadPriority

Call this member function to set the priority level of the current thread within its priority class.

Syntax

BOOL SetThreadPriority( int nPriority );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support priority classes. The order in which threads are scheduled is determined only by their thread priorities. A thread can have one of the following priority levels.

Priority | Meaning
THREAD_PRIORITY_TIME_CRITICAL | 3 points above normal priority.
THREAD_PRIORITY_HIGHEST | 2 points above normal priority.
THREAD_PRIORITY_ABOVE_NORMAL | 1 point above normal priority.
THREAD_PRIORITY_NORMAL | Normal priority.
THREAD_PRIORITY_BELOW_NORMAL | 1 point below normal priority.
THREAD_PRIORITY_LOWEST | 2 points below normal priority.
THREAD_PRIORITY_ABOVE_IDLE | 3 points below normal priority.
THREAD_PRIORITY_IDLE | 4 points below normal priority.

In Windows CE, a thread with a priority level of THREAD_PRIORITY_TIME_CRITICAL will execute until it explicitly yields processing to other threads. Processing of these threads is not yielded to other threads, even if another thread also has the THREAD_PRIORITY_TIME_CRITICAL priority level.

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinThread::GetThreadPriority


CWinThread::SuspendThread

Call this member function to increment the current thread's suspend count. If any thread has a suspend count above zero, that thread does not execute. The thread can be resumed by calling the ResumeThread member function.

Syntax

DWORD SuspendThread( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes, CWinThread::ResumeThread


CWinThread Data Members

Data Members
m_bAutoDelete | Specifies whether to destroy the object at thread termination.
m_hThread | Handle to the current thread.
m_nThreadID | ID of the current thread.
m_pMainWnd | Holds a pointer to the application's main window.
m_pActiveWnd | Pointer to the main window of the container application when an ActiveX object is in-place active.

See Also

CWinThread Overview, CWinThread Member Functions, Application Architecture Classes


CWinThread::m_bAutoDelete

Thisdata member contains a boolean value that specifies whether the CWinThread object should be automatically deleted at thread termination.

BOOL m_bAutoDelete;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Data Members, Application Architecture Classes


CWinThread::m_hThread

This data member contains the handle to the thread attached to this CWinThread. It is only valid if the underlying thread currently exists.

HANDLE m_hThread;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Data Members, Application Architecture Classes


CWinThread::m_nThreadID

This data member contains the identifier of the thread attached to this CWinThread.

DWORD m_nThreadID;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Data Members, Application Architecture Classes


CWinThread::m_pActiveWnd

This data member contains a pointer to a CWnd object. Use this data member to store a pointer to your thread's active window object.

CWnd* m_pActiveWnd;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Data Members, Application Architecture Classes, CWinThread::InitInstance, CWinThread::m_pMainWnd, CWnd


CWinThread::m_pMainWnd

This data member contains a pointer to a CWnd object. Use this data member to store a pointer to your thread's main window object.

CWnd* m_pMainWnd;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWinThread Overview, CWinThread Data Members, Application Architecture Classes, CWinThread::InitInstance, CWnd


CWnd

The CWnd class provides the base functionality of all window classes in MFC for Windows CE.

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE defines a new window style, called WS_EX_NODRAG. This style creates a stationary window. Specify this style when you want to prevent a user from dragging a window by its title bar.

MFC for Windows CE supports a new data member for the CWnd class. The m_hCommandBarMenu member is the menu handle to a window's command bar menu.

MFC for Windows CE supports the following member functions of the CWnd class differently than the standard MFC library does.

CWnd::Create

CWnd::CreateEx

CWnd::DestroyWindow

CWnd::MessageBox

CWnd::ShowWindow

GetCurrentMessage

CWnd::GetUpdateRgn

CWnd::GetWindow

CWnd::InvalidateRect

CWnd::MoveWindow

CWnd::OnInitMenuPopup

CWnd::OnMenuChar

CWnd::OnSize

CWnd::OnWinIniChange

CWnd::ScrollWindowEx

CWnd::SetForegroundWindow

CWnd::SetWindowPos

CWnd::ValidateRect

MFC for Windows CE does not support the following member functions of the CWnd class.

ArrangeIconicWindows | OnMouseActivate
CancelToolTips | OnMouseWheel
ChangeClipboardChain | OnMoving
CreateCaret | OnNcActivate
CreateGrayCaret | OnNcCalcSize
DlgDirList | OnNcCreate
DlgDirListComboBox | OnNcHitTest
DlgDirSelect | OnNcLButtonDblClk
DlgDirSelectComboBox | OnNcLButtonDown
DragAcceptFiles | OnNcLButtonUp
DrawMenuBar | OnNcMButtonDblClk
EnableScrollBar | OnNcMButtonDown
EnableToolTips | OnNcMButtonUp
FilterToolTipMessage | OnNcMouseMove
FlashWindow | OnNcPaint
GetClipboardViewer | OnNcRButtonDblClk
GetDCEx | OnNcRButtonDown
GetDSCCursor | OnNcRButtonUp
GetLastActivePopup | OnPaintClipboard
GetSystemMenu | OnPaletteChanged
GetWindowContextHelpId | OnPaletteIsChanging
GetWindowPlacement | OnParentNotify
GetWindowRgn | OnQueryDragIcon
HiliteMenuItem | OnQueryEndSession
InvalidateRgn | OnQueryNewPalette
IsZoomed | OnQueryOpen
LockWindowUpdate | OnRButtonDblClk
OnActivateApp | OnRButtonDown
OnAskCbFormatName | OnRButtonUp
OnChangeCbChain | OnRegisteredMouseWheel
OnChildActivate | OnSetCursor
OnCompacting | OnSizeClipboard
OnContextMenu | OnSizing
OnDeviceChange | OnSpoolerStatus
OnDevModeChange | OnStyleChanging
OnDrawClipboard | OnSysColorChange
OnDropFiles | OnTimeChange
OnDSCNotify | OnToolHitTest
OnEndSession | OnVScrollClipboard
OnEnterIdle | OnWindowPosChanging
OnEnterMenuLoop | Print
OnExitMenuLoop | PrintClient
OnGetMinMaxInfo | SetClipboardViewer
OnHScrollClipboard | SetMenu
OnIconEraseBkgnd | SetWindowContextHelpId
OnInitMenu | SetWindowPlacement
OnMButtonDblClk | SetWindowRgn
OnMButtonDown | ShowOwnedPopups
OnMButtonUp | ShowScrollBar
OnMDIActivate | UnockWindowUpdate
OnMenuSelect | ValidateRgn

For more information on window management in Windows CE, see Window Management.

See Also

CWnd Member Functions, CWnd Data Members, Window Class Categories, CWnd::m_hCommandBarMenu, CFrameWnd, CView


CWnd Member Functions

Construction/Destruction
CWnd | Constructs a CWnd object.
DestroyWindow | Destroys the attached Windows window.

Initialization
Create |  | Creates and initializes the child window associated with the CWnd object.
PreCreateWindow |  | Called before the creation of the Windows window attached to this CWnd object.
CalcWindowRect |  | Called to calculate the window rectangle from the client rectangle.
GetStyle |  | Returns the current window style.
GetExStyle |  | Returns the window's extended style.
Attach |  | Attaches a Windows handle to a CWnd object.
Detach |  | Detaches a Windows handle from a CWnd object and returns the handle.
PreSubclassWindow |  | Allows other necessary subclassing to occur before SubclassWindow is called.
SubclassWindow |  | Attaches a window to a CWnd object and makes it route messages through the CWnd's message map.
UnSubclassWindow |  | Detaches a window from a CWnd object
FromHandle |  | Returns a pointer to a CWnd object when given a handle to a window. If a CWnd object is not attached to the handle, a temporary CWnd object is created and attached.
FromHandlePermanent |  | Returns a pointer to a CWnd object when given a handle to a window. If a CWnd object is not attached to the handle, NULL is returned.
DeleteTempMap |  | Called automatically by the CWinApp idle-time handler and deletes any temporary CWnd objects created by FromHandle.
GetSafeHwnd |  | Returns NULL if the this pointer is NULL.
CreateEx | Creates a Windows overlapped, pop-up, or child window and attaches it to a CWnd object.
CreateControl | Creates an ActiveX control that will be represented in an MFC program by a CWnd object.

Window State Functions
IsWindowEnabled | Determines whether the window is enabled for mouse and keyboard input.
EnableWindow | Enables or disables mouse and keyboard input.
GetActiveWindow | Retrieves the active window.
SetActiveWindow | Activates the window.
GetCapture | Retrieves the CWnd that has the mouse capture.
SetCapture | Causes all subsequent mouse input to be sent to the CWnd.
GetFocus | Retrieves the CWnd that currently has the input focus.
SetFocus | Claims the input focus.
GetDesktopWindow | Retrieves the Windows desktop window.
GetForegroundWindow | Returns a pointer to the foreground window (the top-level window with which the user is currently working).
SetForegroundWindow | Puts the thread that created the window into the foreground and activates the window.
GetIcon | Retrieves the handle to an icon.
SetIcon | Sets the handle to a specific icon.
ModifyStyle |  | Modifies the current window style.
ModifyStyleEx |  | Modifies the window's extended style.

Window Size and Position
IsIconic | Determines whether CWnd is minimized (iconic).
MoveWindow | Changes the position and/or dimensions of CWnd.
SetWindowPos | Changes the size, position, and ordering of child, pop-up, and top-level windows.
BringWindowToTop | Brings CWnd to the top of a stack of overlapping windows.
GetWindowRect | Gets the screen coordinates of CWnd.
GetClientRect | Gets the dimensions of the CWnd client area.

Window Access Functions
ChildWindowFromPoint | Determines which, if any, of the child windows contains the specified point.
FindWindow | Returns the handle to the window, which is identified by its window name and window class.
GetNextWindow | Returns the next (or previous) window in the window manager's list.
GetOwner | Retrieves a pointer to the owner of a CWnd.
SetOwner | Changes the owner of a CWnd.
GetTopWindow | Returns the first child window that belongs to the CWnd.
GetWindow | Returns the window with the specified relationship to this window.
IsChild | Indicates whether CWnd is a child window or other direct descendant of the specified window.
GetParent | Retrieves the parent window of CWnd (if any).
GetSafeOwner | Retrieves the safe owner for the given window.
SetParent | Changes the parent window.
WindowFromPoint | Identifies the window that contains the given point.
GetDlgItem | Retrieves the control with the specified identifier from the specified dialog box.
GetDlgCtrlID | If the CWnd is a child window, calling this function returns its identifier value.
SetDlgCtrlID | Sets the window or control identifier for the window (which can be any child window, not only a control in a dialog box).
GetDescendantWindow | Searches all descendant windows and returns the window with the specified identifier.
GetParentFrame | Retrieves the CWnd object's parent frame window.
SendMessageToDescendants | Sends a message to all descendant windows of the window.
GetTopLevelParent | Retrieves the window's top-level parent.
GetTopLevelOwner | Retrieves the top-level window.
GetParentOwner | Returns a pointer to a child window's parent window.
GetTopLevelFrame | Retrieves the window's top-level frame window.
UpdateDialogControls | Call to update the state of dialog box buttons and other controls.
UpdateData | Initializes or retrieves data from a dialog box.
CenterWindow | Centers a window relative to its parent.

Update/Painting Functions
BeginPaint | Prepares CWnd for painting.
EndPaint | Marks the end of painting.
GetDC | Retrieves a display context for the client area.
RedrawWindow | Updates the specified rectangle or region in the client area.
GetWindowDC | Retrieves the display context for the whole window, including the caption bar, menus, and scroll bars.
ReleaseDC | Releases client and window device contexts, freeing them for use by other applications.
UpdateWindow | Updates the client area.
SetRedraw | Allows changes in CWnd to be redrawn or prevents changes from being redrawn.
GetUpdateRect | Retrieves the coordinates of the smallest rectangle that completely encloses the CWnd update region.
GetUpdateRgn | Retrieves the CWnd update region.
Invalidate | Invalidates the entire client area.
InvalidateRect | Invalidates the client area within the given rectangle by adding that rectangle to the current update region.
ValidateRect | Validates the client area within the given rectangle by removing the rectangle from the current update region.
ShowWindow | Shows or hides the window.
IsWindowVisible | Determines whether the window is visible.

Coordinate Mapping Functions
MapWindowPoints | Converts (maps) a set of points from the coordinate space of the CWnd to the coordinate space of another window.
ClientToScreen | Converts the client coordinates of a given point or rectangle on the display to screen coordinates.
ScreenToClient | Converts the screen coordinates of a given point or rectangle on the display to client coordinates.

Window Text Functions
SetWindowText | Sets the window text or caption title (if it has one) to the specified text.
GetWindowText | Returns the window text or caption title (if it has one).
GetWindowTextLength | Returns the length of the window's text or caption title.
SetFont | Sets the current font.
GetFont | Retrieves the current font.

Scrolling Functions
GetScrollPos | Retrieves the current position of a scroll box.
GetScrollRange | Copies the current minimum and maximum scroll-bar positions for the given scroll bar.
ScrollWindow | Scrolls the contents of the client area.
ScrollWindowEx | Scrolls the contents of the client area. Similar to ScrollWindow, with additional features.
GetScrollInfo | Retrieves the information that the SCROLLINFO structure maintains about a scroll bar.
GetScrollLimit | Retrieves the limit of the scroll bar.
SetScrollInfo | Sets information about the scroll bar.
SetScrollPos | Sets the current position of a scroll box and, if specified, redraws the scroll bar to reflect the new position.
SetScrollRange | Sets minimum and maximum position values for the given scroll bar.
GetScrollBarCtrl | Returns a sibling scroll-bar control.
RepositionBars | Repositions control bars in the client area.

Caret Functions
CreateSolidCaret | Creates a solid block for the system caret and gets ownership of the caret.
GetCaretPos | Retrieves the client coordinates of the caret's current position.
SetCaretPos | Moves the caret to a specified position.
HideCaret | Hides the caret by removing it from the display screen.
ShowCaret | Shows the caret on the display at the caret's current position. Once shown, the caret begins flashing automatically.

Dialog-Box Item Functions
CheckDlgButton | Places a check mark next to or removes a check mark from a button control.
CheckRadioButton | Checks the specified radio button and removes the check mark from all other radio buttons in the specified group of buttons.
GetCheckedRadioButton | Returns the identifier of the currently checked radio button in a group of buttons.
GetDlgItemInt | Translates the text of a control in the given dialog box to an integer value.
GetDlgItemText | Retrieves the caption or text associated with a control.
GetNextDlgGroupItem | Searches for the next (or previous) control within a group of controls.
GetNextDlgTabItem | Retrieves the first control with the WS_TABSTOP style that follows (or precedes) the specified control.
IsDlgButtonChecked | Determines whether a button control is checked.
IsDialogMessage | Determines whether the given message is intended for the modeless dialog box and, if so, processes it.
SendDlgItemMessage | Sends a message to the specified control.
SetDlgItemInt | Sets the text of a control to the string that represents an integer value.
SetDlgItemText | Sets the caption or text of a control in the specified dialog box.
SubclassDlgItem |  | Attaches a Windows control to a CWnd object and makes it route messages through the CWnd's message map.
ExecuteDlgInit |  | Initiates a dialog box resource.
RunModalLoop |  | Retrieves, translates, or dispatches messages for a window that is in modal status.
ContinueModal |  | Continues a window's modal status.
EndModalLoop |  | Ends a window's modal status.

Data-Binding Functions
BindDefaultProperty | Binds the calling object's default simple bound property, as marked in the type library, to a cursor associated with a data-source control.
BindProperty | Binds a cursour-bound property on a data-bound control to a data-source control and registers that relationship with the MFC binding manager.

Menu Functions
GetMenu Retrieves a pointer to the specified menu.

Timer Functions
SetTimer | Installs a system timer that sends a WM_TIMER message when triggered.
KillTimer | Kills a system timer.

Alert Functions
MessageBox Creates and displays a window that contains an application-supplied message and caption.

Window Message Functions
GetCurrentMessage | Returns a pointer to the message this window is currently processing. Should only be called when in an On Message message-handler member function.
Default | Calls the default window procedure, which provides default processing for any window messages that an application does not process.
PreTranslateMessage | Used by CWinApp to filter window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions.
SendMessage | Sends a message to the CWnd object and does not return until it has processed the message.
PostMessage | Places a message in the application queue, then returns without waiting for the window to process the message.
SendNotifyMessage | Sends the specified message to the window and returns as soon as possible, depending on whether the calling thread created the window.

Clipboard Functions
OpenClipboard | Opens the Clipboard. Other applications will not be able to modify the Clipboard until the Windows CloseClipboard function is called.
GetClipboardOwner | Retrieves a pointer to the current owner of the Clipboard.
GetOpenClipboardWindow | Retrieves a pointer to the window that currently has the Clipboard open.

ActiveX Controls
SetProperty | Sets an ActiveX control property.
OnAmbientProperty | Implement ambient property values
GetControlUnknown | Retrieves a pointer to an unknown ActiveX control.
GetProperty | Retrieves an ActiveX control property
InvokeHelper | Invokes an ActiveX control method or property.

Overridables
GetSuperWndProcAddr | Accesses the default WndProc of a subclassed window.
WindowProc | Provides a window procedure for a CWnd. The default dispatches messages through the message map.
DefWindowProc | Calls the default window procedure, which provides default processing for any window messages that an application does not process.
PostNcDestroy | This virtual function is called by the default OnNcDestroy function after the window has been destroyed.
OnChildNotify | Called by a parent window to give a notifying control a chance to respond to a control notification.
DoDataExchange | For dialog data exchange and validation. Called by UpdateData.

Initialization Message Handlers
OnInitMenuPopup Called when a pop-up menu is about to become active.

System Message Handlers
OnSysChar | Called when a keystroke translates to a system character.
OnSysCommand | Called when the user selects a command from the Control menu, or when the user selects the Maximize or Minimize button.
OnSysDeadChar | Called when a keystroke translates to a system dead character (such as accent characters).
OnSysKeyDown | Called when the user holds down the ALT key and then presses another key.
OnSysKeyUp | Called when the user releases a key that was pressed while the ALT key was held down.
OnFontChange | Called when the pool of font resources changes.
OnWindowPosChanged | Called when the size, position, or Z-order has changed as a result of a call to SetWindowPos or another window-management function.
OnWinIniChange | Called for all top-level windows after the Windows initialization file, WIN.INI, is changed.

General Message Handlers
OnCommand | Called when the user selects a command.
OnActivate | Called when CWnd is being activated or deactivated.
OnCancelMode | Called to allow CWnd to cancel any internal modes, such as mouse capture.
OnClose | Called as a signal that CWnd should be closed.
OnCreate | Called as a part of window creation.
OnCtlColor | Called if CWnd is the parent of a control when the control is about to be drawn.
OnDestroy | Called when CWnd is being destroyed.
OnEnable | Called when CWnd is enabled or disabled.
OnEraseBkgnd | Called when the window background needs erasing.
OnKillFocus | Called immediately before CWnd loses the input focus.
OnMenuChar | Called when the user presses a menu mnemonic character that doesn't match any of the predefined mnemonics in the current menu.
OnMove | Called after the position of the CWnd has been changed.
OnStyleChanged | Indicates that the ::SetWindowLong Windows function has changed one or more of the window's styles.
OnPaint | Called to repaint a portion of the window.
OnSetFocus | Called after CWnd gains the input focus.
OnShowWindow | Called when CWnd is to be hidden or shown.
OnSize | Called after the size of CWnd has changed.
OnStyleChanged | Indicates that one or more of the window's styles has changed.

Control Message Handlers
OnCharToItem | Called by a child list box with the LBS_WANTKEYBOARDINPUT style in response to a WM_CHAR message.
OnCompareItem | Called to determine the relative position of a new item in a child sorted owner-draw combo box or list box.
OnDeleteItem | Called when an owner-draw child list box or combo box is destroyed or when items are removed from the control.
OnDrawItem | Called when a visual aspect of an owner-draw child button control, combo-box control, list-box control, or menu needs to be drawn.
OnGetDlgCode | Called for a control so the control can process arrow-key and TAB-key input itself.
OnMeasureItem | Called for an owner-draw child combo box, list box, or menu item when the control is created. CWnd informs Windows of the dimensions of the control.
SendChildNotifyLastMsg | Provides a notification message to a child window, from the parent window, so the child window can handle a task.
ReflectChildNotify | Helper function which reflects a message to its source.
OnWndMsg | Indicates if a windows message was handled.
ReflectLastMsg | Reflects the last message to the child window.
OnVKeyToItem | Called by a list box owned by CWnd in response to a WM_KEYDOWN message.

Input Message Handlers
OnChar |  | Called when a keystroke translates to a nonsystem character.
OnDeadChar |  | Called when a keystroke translates to a nonsystem dead character (such as accent characters).
OnHScroll |  | Called when the user clicks the horizontal scroll bar of CWnd.
OnKeyDown |  | Called when a nonsystem key is pressed.
OnKeyUp |  | Called when a nonsystem key is released.
OnLButtonDblClk |  | Called when the user double-clicks the left mouse button.
OnLButtonDown |  | Called when the user presses the left mouse button.
OnLButtonUp |  | Called when the user releases the left mouse button.
OnMouseMove |  | Called when the mouse cursor moves.
OnTimer |  | Called after each interval specified in SetTimer.
OnVScroll |  | Called when the user clicks the window's vertical scroll bar.
OnCaptureChanged | Sends a message to the window that is losing the mouse capture.

Nonclient-Area Message Handlers
OnNcDestroy Called when the nonclient area is being destroyed.

Clipboard Message Handlers
OnDestroyClipboard | Called when the Clipboard is emptied through a call to the Windows EmptyClipboard function.
OnRenderAllFormats | Called when the owner application is being destroyed and needs to render all its formats.
OnRenderFormat | Called for the Clipboard owner when a particular format with delayed rendering needs to be rendered.

See Also

CWnd Overview, CWnd Data Members, Window Class Categories


CWnd::Attach

Call this member function to attach a Windows window to a CWnd object.

Syntax

BOOL Attach( HWND hWndNew );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::Detach, CWnd::SubclassWindow


CWnd::BeginPaint

Call this member function to prepare a CWnd object for painting, and fill a PAINTSTRUCT data structure with information about the painting.

Syntax

CDC* BeginPaint( LPPAINTSTRUCT lpPaint );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::EndPaint, CWnd::Invalidate, CPaintDC


CWnd::BindProperty

Call this member function to bind a cursor-bound property on a data-bound control to a data-source control, and register that relationship with the MFC binding manager. The CWnd object on which you call this member function must be a data-bound control.

Syntax

void BindProperty( DISPID dwDispID, CWnd * pWndDSC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BindDefaultProperty


CWnd::BindDefaultProperty

Call this member function to bind the calling object's default simple bound property, as marked in the type library, to the underlying cursor that is defined by the DataSource, UserName, Password, and SQL properties of the data-source control. The CWnd object on which you Call this member function must be a data-bound control.

Syntax

void BindDefaultProperty( DISPID dwDispID, VARTYPE vtProp, LPCTSTR szFieldName, CWnd * pDSCWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BindProperty


CWnd::BringWindowToTop

Call this member function to bring this CWnd to the top of a stack of overlapping windows.

Syntax

void BringWindowToTop( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::CalcWindowRect

Call this member function to compute the required size of the window rectangle, based on the desired client-rectangle size. Called by the framework to size windows prior to creation.

Syntax

virtual void CalcWindowRect( LPRECT lpClientRect, UINT nAdjustType = adjustBorder );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::CenterWindow

Call this member function to center a window relative to its parent. Usually called from CDialog::OnInitDialog to center dialog boxes relative to the main window of the application.

Syntax

void CenterWindow( CWnd* pAlternateOwner = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDesktopWindow, CDialog::OnInitDialog


CWnd::CheckDlgButton

Call this member function to select (place a check mark next to) or clear (remove a check mark from) a button, or change the state of a three-state button. The CheckDlgButton function sends a BM_SETCHECK message to the specified button.

Syntax

void CheckDlgButton( int nIDButton, UINT nCheck );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::IsDlgButtonChecked, CButton::SetCheck


CWnd::CheckRadioButton

Call this member function to select (add a check mark to) a given radio button in a group and clear (remove a check mark from) all other radio buttons in the group. The CheckRadioButton function sends a BM_SETCHECK message to the specified radio button.

Syntax

void CheckRadioButton( int nIDFirstButton, int nIDLastButton, int nIDCheckButton );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetCheckedRadioButton, CButton::SetCheck


CWnd::ChildWindowFromPoint

Call this member function to determine which, if any, of the child windows belonging to CWnd contains the specified point.

Syntax

CWnd* ChildWindowFromPoint( POINT point ) const;

CWnd* ChildWindowFromPoint( POINT point, UINT nFlags ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::WindowFromPoint


CWnd::ClientToScreen

Call this member function to convert the client coordinates of a given point or rectangle on the display to screen coordinates. The ClientToScreen member function uses the client coordinates in the POINT or RECT structure or the CPoint or CRect object pointed to by lpPoint or lpRect to compute new screen coordinates; it then replaces the coordinates in the structure with the new coordinates.

Syntax

void ClientToScreen( LPPOINT lpPoint ) const;

void ClientToScreen( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ScreenToClient


CWnd::ContinueModal

This member function is called by RunModalLoop to determine when the modal state should be exited.

Syntax

BOOL ContinueModal( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::RunModalLoop


CWnd::Create

Call this member function to create a Windows child window and attach it to the CWnd object.

Syntax

virtual BOOL Create ( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

All windows in Windows CE have the WS_CLIPSIBLINGS and WS_CLIPCHILDREN styles.

The dwStyle parameter can contain a combination of the window styles and control styles listed in the following topics:

Window Styles List Box Styles
Push Button Styles Scroll Bar Styles
Combo Box Styles Dialog Box Styles
Edit Control Styles Static Control Styles

Windows CE does not support the following flags for the dwStyle parameter.

Unsupported window styles:

WS_CHILDWINDOW | WS_ICONIC
WS_MAXIMIZE | WS_MAXIMIZEBOX
WS_MINIMIZE | WS_MINIMIZEBOX
WS_OVERLAPPEDWINDOW | WS_POPUPWINDOW
WS_SIZEBOX | WS_THICKFRAME
WS_TILED | WS_TILEDWINDOW

Unsupported dialog box styles:

DS_ABSALIGN | DS_NOFAILCREATE
DS_CENTERMOUSE | DS_NOIDLEMSG
DS_CONTEXTHELP | DS_SYSMODAL
DS_FIXEDSYS |

Unsupported control styles:

Unsupported button styles | Unsupported scroll bar styles
BS_BITMAP | SBS_BOTTOMALIGN
BS_ICON | SBS_RIGHTALIGN
BS_LEFTTEXT | SBS_SIZEBOXBOTTOMRIGHTALIGN
BS_MULTILINE | SBS_SIZEGRIP
BS_PUSHBOX |
BS_TEXT | Unsupported static control styles
BS_USERBUTTON (Use BS_OWNERDRAW instead.) | SS_BLACKFRAME
 | SS_BLACKRECT
Unsupported combo box styles | SS_ENHMETAFILE
CBS_OWNERDRAWFIXED | SS_GRAYFRAME
CBS_OWNERDRAWVARIABLE | SS_GRAYRECT
CBS_SIMPLE | SS_METAPICT
 | SS_OWNERDRAW
Unsupported list box styles | SS_RIGHTIMAGE
LBS_NODATA | SS_SIMPLE
LBS_OWNERDRAWFIXED | SS_WHITEFRAME
LBS_OWNERDRAWVARIABLE | SS_WHITERECT
LBS_STANDARD |

For information on supported window styles, see Window Styles.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::CWnd, CWnd::CreateEx


CWnd::CreateControl

Call this member function to create an ActiveX control that will be represented in the MFC program by a CWnd object. CreateControl is a direct analog of the CWnd::Create function, but it creates an ActiveX control instead of an ordinary window.

Syntax

BOOL CreateControl(REFCLSID clsid, LPCTSTR pszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist=NULL, BOOL bStorage=FALSE, BSTR bstrLicKey=NULL);

BOOL CreateControl(LPCTSTR pszClass, LPCTSTR pszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist=NULL, BOOL bStorage=FALSE, BSTR bstrLicKey=NULL);

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::CWnd, CWnd::CreateEx


CWnd::CreateEx

Call this member function to create an overlapped, pop-up, or child window with the extended style specified in dwExStyle.

Syntax

BOOL CreateEx ( DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, HMENU nIDorHMenu, LPVOID lpParam = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

All windows in Windows CE have the WS_CLIPSIBLINGS and WS_CLIPCHILDREN styles.

Windows CE versions 2.0 and later support two new exetended window styles.

The WS_EX_NOACTIVATE style creates a top level window that can't be activated. If a child window has this style, tapping it won't cause its top-level parent to be activated. A window that has this style will receive stylus events, but neither it nor its child windows can get the focus.

The WS_EX_NOANIMATION style creates a window that doesn't show animated exploding and imploding rectangles, and doesn't have a button on the taskbar.

For a list of the window styles that cannot be specified in the dwStyle parameter, see CWnd::Create.

Windows CE does not support the following flags for the dwExStyle parameter.

WS_EX_ACCEPTFILES | WS_EX_LEFTSCROLLBAR
WS_EX_LEFT | WS_EX_MDICHILD
WS_EX_LTRREADING | WS_EX_PALETTEWINDOW
WS_EX_NOPARENTNOTIFY | WS_EX_RIGHTSCROLLBAR
WS_EX_RIGHT | WS_EX_TOOLWINDOW
WS_EX_RTLREADING | WS_EX_TOPMOST
WS_EX_APPWINDOW | WS_EX_TRANSPARENT

Windows CE versions prior to 2.0 do not support the WS_EX_TOPMOST style.

For information on supported window styles and extended window styles, see Window Styles.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::Create


CWnd::CreateSolidCaret

Call this member function to create a solid rectangle for the system caret, and claim ownership of the caret.

Syntax

void CreateSolidCaret( int nWidth, int nHeight );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ShowCaret


CWnd::CWnd

Call this member function to construct a CWnd object. The Windows window is not created and attached until the CreateEx or Create member function is called.

Syntax

CWnd( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::CreateEx, CWnd::Create


CWnd::Default

Use this function to call the default window procedure. The default window procedure provides default processing for any window message that an application does not process. This member function ensures that every message is processed.

Syntax

LRESULT Default( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::DefWindowProc


CWnd::DefWindowProc

Use this function to call the default window procedure, which provides default processing for any window message that an application does not process. This member function ensures that every message is processed.

Syntax

virtual LRESULT DefWindowProc( UINT message, WPARAM wParam, LPARAM lParam );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::Default


CWnd::DeleteTempMap

This member function is called automatically by the idle time handler of the CWinApp object. Deletes any temporary CWnd objects created by the FromHandle member function.

Syntax

static void PASCAL DeleteTempMap( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::FromHandle


CWnd::DestroyWindow

Call this member function to destroy the Windows window attached to this CWnd object.

Syntax

virtual BOOL DestroyWindow ( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

The CWnd::DestroyWindow member function only sends the WM_DESTROY message. Windows CE does not support the WM_NCDESTROY message.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnDestroy, CWnd::Detach


CWnd::Detach

Call this member function to detache a Windows handle from a CWnd object and retrieve the handle.

Syntax

HWND Detach( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::Attach


CWnd::DoDataExchange

This member function is called by the framework to exchange and validate dialog data.

Syntax

virtual void DoDataExchange( CDataExchange* pDX );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::UpdateData


CWnd::EnableWindow

Call this member function to enable or disable mouse and keyboard input.

Syntax

BOOL EnableWindow( BOOL bEnable = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnEnable


CWnd::EndModalLoop

Call this member function to terminate a call to RunModalLoop.

Syntax

void EndModalLoop( int nResult );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::RunModalLoop, CWnd::ContinueModal


CWnd::EndPaint

Call this member function once for each call to the BeginPaint member function, but only after painting is complete. Calling this function marks the end of painting in the given window.

Syntax

void EndPaint( LPPAINTSTRUCT lpPaint );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BeginPaint, CPaintDC


CWnd::ExecuteDlgInit

Call this member function to initiate a dialog box resource.

Syntax

BOOL ExecuteDlgInit( LPCTSTR lpszResourceName );

BOOL ExecuteDlgInit( LPVOID lpResource );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CDialog::OnInitDialog


CWnd::FindWindow

Call this member function to retrieve the top-level CWnd whose window class is given by lpszClassName and whose window name, or title, is given by lpszWindowName.

Syntax

static CWnd* PASCAL FindWindow( LPCTSTR lpszClassName, LPCTSTR lpszWindowName );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::FromHandle

Call this member function to retrieve a pointer to a CWnd object when you have a handle to a window.

Syntax

static CWnd* PASCAL FromHandle( HWND hWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::DeleteTempMap


CWnd::FromHandlePermanent

Call this member function to retrieve a pointer to a CWnd object when you have a handle to a window.

Syntax

static CWnd* PASCAL FromHandlePermanent( HWND hWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::FromHandle


CWnd::GetActiveWindow

Call this member function to retrieve a pointer to the active window.

Syntax

static CWnd* PASCAL GetActiveWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetActiveWindow


CWnd::GetCapture

Call this member function to retrieve the window that has the mouse capture.

Syntax

static CWnd* PASCAL GetCapture( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetCapture


CWnd::GetCaretPos

Call this member function to retrieve the client coordinates of the caret's current position as a CPoint object.

Syntax

static CPoint PASCAL GetCaretPos( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetCheckedRadioButton

Call this member function to retrieve the identifier of the currently checked radio button in the specified group.

Syntax

int GetCheckedRadioButton( int nIDFirstButton, int nIDLastButton );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::CheckRadioButton


CWnd::GetClientRect

Call this member function to copy the client coordinates of the CWnd client area into the structure pointed to by lpRect.

Syntax

void GetClientRect( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetWindowRect


CWnd::GetClipboardOwner

Call this member function to retrieve the current owner of the Clipboard.

Syntax

static CWnd* PASCAL GetClipboardOwner( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetControlUnknown

Call this member function to obtain a pointer to an unknown ActiveX control. You should not release this IUnknown pointer. Typically, you would use this member function to obtain a specific interface on the control.

Syntax

LPUNKNOWN GetControlUnknown( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, IUnknown::QueryInterface


CWnd::GetCurrentMessage

Call this member function to obtain a pointer to the MSG structure that contains the message the window is currently processing.

Syntax

static const MSG* PASCAL GetCurrentMessage( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

This function returns a pointer to a MSG structure. In Windows CE, the time member of this structure contains the system time at which CWnd::GetCurrentMessage is called, rather than the time at which the message was posted.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetDC

Call this member function to obtain a pointer to a common, class, or private device context for the client area, depending on the class style specified for the CWnd.

Syntax

CDC* GetDC( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ReleaseDC, CWnd::GetWindowDC, CClientDC


CWnd::GetDescendantWindow

Call this member function to find the descendant window specified by the given identifier.

Syntax

CWnd* GetDescendantWindow( int nID, BOOL bOnlyPerm = FALSE ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetParentFrame, CWnd::IsChild, CWnd::GetDlgItem


CWnd::GetDesktopWindow

Call this member function to retrieve the Windows desktop window. This window covers the entire screen and is the area on top of which all icons and other windows are painted.

Syntax

static CWnd* PASCAL GetDesktopWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetDlgCtrlID

Call this member function to retrieve the window or control identifier value for any child window. The child window does not have to be a control in a dialog box. Since top-level windows do not have an identifier value, the return value of this function is invalid if the CWnd is a top-level window.

Syntax

int GetDlgCtrlID( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetDlgItem

Call this member function to retrieve a pointer to the specified control or child window in a dialog box or other window. The pointer returned is usually cast to the type of control identified by nID.

Syntax

CWnd* GetDlgItem ( int nID ) const;

void CWnd::GetDlgItem( int nID, HWND* phWnd ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, the CDialog::GetDlgItem member function only applies to the immediate child controls of a dialog box. It does not search through nested dialog boxes.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetWindow, CWnd::GetDescendantWindow, CWnd::GetWindow


CWnd::GetDlgItemInt

Call this member function to retrieve the text of the control identified by the nID parameter. This function translates the text into an integer value by stripping any extra spaces at the beginning of the text and converting decimal digits.

Syntax

UINT GetDlgItemInt( int nID, BOOL* lpTrans = NULL, BOOL bSigned = TRUE ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, the CDialog::GetDlgItemInt member function can only translate text strings with 48 characters or fewer.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDlgItemText


CWnd::GetDlgItemText

Call this member function to retrieve the title or text associated with a control in a dialog box. This function copies the text to the location pointed to by lpStr and returns a count of the number of bytes it copies.

Syntax

int GetDlgItemText( int nID, LPTSTR lpStr, int nMaxCount ) const;

int GetDlgItemText( int nID, CString& rString ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDlgItem, CWnd::GetDlgItemInt


CWnd::GetExStyle

Call this member function to retrieve the window's extended style.

Syntax

DWORD GetExStyle( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetStyle


CWnd::GetFocus

Call this member function to obtain a pointer to the CWnd that currently has the input focus.

Syntax

static CWnd* PASCAL GetFocus( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetActiveWindow, CWnd::GetCapture, CWnd::SetFocus


CWnd::GetFont

Call this member function to retrieve the current font for this window.

Syntax

CFont* GetFont( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetFont, CFont


CWnd::GetForegroundWindow

Call this member function to obtain a pointer to the foreground window (the window with which the user is currently working).

Syntax

static CWnd* PASCAL GetForegroundWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetIcon

Call this member function to obtain the handle to either a big (32x32) or the handle to a small (16x16) icon, as indicated by bBigIcon.

Syntax

HICON GetIcon( BOOL bBigIcon ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, SetIcon


CWnd::GetMenu

Call this member function to obtain a pointer to the menu for this window.

Syntax

CMenu* GetMenu( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetNextDlgGroupItem

Call this member function to search for the previous (or next) control within a group of controls in a dialog box.

Syntax

CWnd* GetNextDlgGroupItem( CWnd* pWndCtl, BOOL bPrevious = FALSE ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetNextDlgTabItem


CWnd::GetNextDlgTabItem

Call this member function to obtain a pointer to the first control that was created with the WS_TABSTOP style, that precedes (or follows) the specified control.

Syntax

CWnd* GetNextDlgTabItem( CWnd* pWndCtl, BOOL bPrevious = FALSE ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetNextDlgGroupItem


CWnd::GetNextWindow

Call this member function to obtain a pointer to the next (or previous) window in the window manager's list.

Syntax

CWnd* GetNextWindow( UINT nFlag = GW_HWNDNEXT ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetOpenClipboardWindow

Call this member function to obtain the handle to the window that currently has the Clipboard open.

Syntax

static CWnd* PASCAL GetOpenClipboardWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetClipboardOwner, CWnd::OpenClipboard


CWnd::GetOwner

Call this member function to obtain a pointer to the owner of the window.

Syntax

CWnd* GetOwner( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetParent, CWnd::SetOwner


CWnd::GetParent

Call this member function to obtain a pointer to this window's parent window, if it has one.

Syntax

CWnd* GetParent( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE version 1.0 doesn't support owned windows, except for dialog boxes.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetOwner, CWnd::SetParent


CWnd::GetParentFrame

Call this member function to retrieve the parent frame window. The member function searches up the parent chain until a CFrameWnd (or derived class) object is found.

Syntax

CFrameWnd* GetParentFrame( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDescendantWindow, CWnd::GetParent, CFrameWnd, CFrameWnd::GetActiveView


CWnd::GetParentOwner

Call this member function to obtain a pointer to a child window's parent window.

Syntax

CWnd* GetParentOwner( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetProperty

Call this member function to retrieve the control property specified by dwDispID. GetProperty returns the value through pvProp. This function should be only called on a control.

Syntax

void GetProperty( DISPID dwDispID, VARTYPE vtProp, void* pvProp ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::InvokeHelper, COleDispatchDriver, CWnd::CreateControl


CWnd::GetSafeHwnd

Call this member function to obtain the window handle for a window. It returns NULL if the CWnd is not attached to a window or if it is used with a NULL CWnd pointer.

Syntax

HWND GetSafeHwnd( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetSafeOwner

Call this member function to obtain a pointer to the owner window that should be used for dialog boxes or other modal windows.

Syntax

CWnd* PASCAL GetSafeOwner( CWnd* pParent, HWND* pWndTop );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetScrollBarCtrl

Call this member function to obtain a pointer to the specified sibling scroll bar or splitter window.

Syntax

virtual CScrollBar* GetScrollBarCtrl( int nBar ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetScrollInfo

Call this member function to retrieve the information that the SCROLLINFO structure maintains about a scroll bar. GetScrollInfo enables applications to use 32-bit scroll positions.

Syntax

BOOL GetScrollInfo( int nBar, LPSCROLLINFO lpScrollInfo, UINT nMask = SIF_ALL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CScrollBar::GetScrollInfo, CWnd::SetScrollInfo, CWnd::SetScrollPos, CWnd::OnVScroll, CWnd::OnHScroll


CWnd::GetScrollLimit

Call this member function to retrieve the maximum scrolling position of the scroll bar.

Syntax

int GetScrollLimit( int nBar );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CScrollBar::GetScrollLimit


CWnd::GetScrollPos

Call this member function to retrieve the current position of the scroll box of a scroll bar.

Syntax

int GetScrollPos( int nBar ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CScrollBar::GetScrollPos


CWnd::GetScrollRange

Call this member function to copy the current minimum and maximum scroll-bar positions for the given scroll bar to the locations specified by lpMinPos and lpMaxPos.

Syntax

void GetScrollRange( int nBar, LPINT lpMinPos, LPINT lpMaxPos ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetStyle

Call this member function to retrieve the window's style.

Syntax

DWORD GetStyle( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetSuperWndProcAddr

This function is obsolete. You will not need to override this function because the default implementation in CWnd now stores this pointer in all CWnd objects.

Syntax

virtual WNDPROC* GetSuperWndProcAddr( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetTopLevelFrame

Call this member function to retrieve the window's top level frame window, if any. If CWnd has no attached window, or its top-level parent is not a CFrameWnd-derived object, this function returns NULL.

Syntax

CFrameWnd* GetTopLevelFrame( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetTopLevelOwner, CWnd::GetTopLevelParent, CFrameWnd


CWnd::GetTopLevelOwner

Call this member function to obtain a pointer to the top-level window.

Syntax

CWnd* GetTopLevelOwner( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetTopLevelFrame, CWnd::GetTopLevelParent


CWnd::GetTopLevelParent

Call this member function to obtain a pointer to the window's top-level parent.

Syntax

CWnd* GetTopLevelParent( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetTopLevelOwner, CWnd::GetTopLevelFrame, CWnd::GetOwner, CWnd::SetOwner


CWnd::GetTopWindow

Call this member function to obtain a pointer to the top-level child window that belongs to this CWnd.

Syntax

CWnd* GetTopWindow( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::GetUpdateRect

Call this member function to retrieve the coordinates of the smallest rectangle that completely encloses the update region.

Syntax

BOOL GetUpdateRect( LPRECT lpRect, BOOL bErase = FALSE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BeginPaint, CWnd::OnPaint, CWnd::RedrawWindow


CWnd::GetUpdateRgn

Call this member function to copy the update region into a region identified by pRgn. The coordinates of the update region are relative to the upper-left corner (client coordinates).

Syntax

int GetUpdateRgn ( CRgn* pRgn, BOOL bErase = FALSE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE ignores the bErase parameter, and does not erase the window's background or do any drawing.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BeginPaint


CWnd::GetWindow

Call this member function to obtain a pointer to the requested window.

Syntax

CWnd* GetWindow ( UINT nCmd ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE 1.0 does not support owned windows, except for dialog boxes. In version 1.0, you cannot pass the GW_OWNER value in the nCmd parameter unless the specified window is a dialog box.

Windows CE versions 2.0 and later support owned windows.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetParent, CWnd::GetNextWindow


CWnd::GetWindowDC

Call this member function to retrieve the display context for the entire window, including caption bar, menus, and scroll bars.

Syntax

CDC* GetWindowDC( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ReleaseDC, CWnd::GetDC, CWindowDC


CWnd::GetWindowRect

Call this member function to copy the dimensions of the bounding rectangle of the CWnd object into the structure pointed to by lpRect.

Syntax

void GetWindowRect( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetClientRect, CWnd::MoveWindow, CWnd::SetWindowPos


CWnd::GetWindowText

Call this member function to copy the CWnd caption title into the buffer pointed to by lpszStringBuf or into the destination string rString.

Syntax

int GetWindowText( LPTSTR lpszStringBuf, int nMaxCount ) const;

void GetWindowText( CString& rString ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetWindowText, CWnd::GetWindowTextLength


CWnd::GetWindowTextLength

Call this member function to retrieve the length of the CWnd object caption title.

Syntax

int GetWindowTextLength( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, , CWnd::GetWindowText


CWnd::HideCaret

Call this member function to hide the caret by removing it from the display screen.

Syntax

void HideCaret( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ShowCaret


CWnd::Invalidate

Call this member function to invalidate the entire client area of CWnd.

Syntax

void Invalidate( BOOL bErase = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BeginPaint, CWnd::ValidateRect


CWnd::InvalidateRect

Call this member function to invalidate the client area within the given rectangle, by adding that rectangle to the CWnd update region. The invalidated rectangle, along with all other areas in the update region, is marked for painting when the next WM_PAINT message is sent.

Syntax

void InvalidateRect ( LPCRECT lpRect, BOOL bErase = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you have to pass a valid RECT pointer in the lpRect parameter. Windows 95 and Windows NT invalidate and redraw the entire window if the lpRect parameter is set to NULL. This is not supported in Windows CE.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BeginPaint, CWnd::ValidateRect, RECT, WM_PAINT


CWnd::InvokeHelper

Call this member function to invoke the ActiveX control method or property specified by dwDispID, in the context specified by wFlags. The pbParamInfo parameter specifies the types of the parameters passed to the method or property. The variable list of arguments is represented by ... in the syntax declaration.

Syntax

void InvokeHelper( DISPID dwDispID, WORD wFlags, VARTYPE vtRet, void* pvRet, const BYTE* pbParamInfo, ... );
throw( COleException );
throw( COleDispatchException );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetProperty, CWnd::SetProperty, COleDispatchDriver, CWnd::CreateControl


CWnd::IsChild

Call this member function to determine whether the window specified by pWnd is a child window or other direct descendant of CWnd.

Syntax

BOOL IsChild( const CWnd* pWnd ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::IsDialogMessage

Call this member function to determine whether the given message is intended for a modeless dialog box. If it is, this function processes the message.

Syntax

BOOL IsDialogMessage( LPMSG lpMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::PreTranslateMessage


CWnd::IsDlgButtonChecked

Call this member function to determine whether a button control has a check mark next to it.

Syntax

UINT IsDlgButtonChecked( int nIDButton ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CButton::GetCheck


CWnd::IsIconic

Call this member function to determine whether CWnd is minimized (iconic).

Syntax

BOOL IsIconic( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::IsWindowEnabled

Call this member function to determine whether CWnd is enabled for mouse (or touch screen) and keyboard input.

Syntax

BOOL IsWindowEnabled( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::IsWindowVisible

Call this member function to determine the visibility state of the given window.

Syntax

BOOL IsWindowVisible( ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ShowWindow


CWnd::KillTimer

Call this member function to kill the timer event identified by nIDEvent, set by an earlier call to SetTimer.

Syntax

BOOL KillTimer( int nIDEvent );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetTimer


CWnd::MapWindowPoints

Call this member function to convert (map) a set of points from the coordinate space of the CWnd to the coordinate space of another window.

Syntax

void MapWindowPoints( CWnd* pwndTo, LPRECT lpRect ) const;

void MapWindowPoints( CWnd* pwndTo, LPPOINT lpPoint, UINT nCount ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ClientToScreen, CWnd::ScreenToClient


CWnd::MessageBox

Call this member function to create a message box.

Syntax

int MessageBox ( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the MB_SYSTEMMODAL, MB_TASKMODAL, MB_HELP, MB_RIGHT, MB_RTLREADING, MB_DEFAULT_DESKTOP_ONLY, MB_SERVICE_NOTIFICATION, or MB_USERICON styles in the nType parameter.

Tip Sometimes it is necessary for a message box to appear on top of all other windows. In particular, under low memory conditions, the System Out of Memory dialog box will send a WM_CLOSE message to an application. If the application is not in the foreground, any message box it puts up will be hidden behind the current foreground window unless you create the message box with the MB_SETFOREGROUND style. Putting the message box in the foreground will not bring the application's main window forward, so be sure to put any information the user may need, to decide what action to take, in the message box. For more information on the System Out of Memory dialog box, see System Out of Memory Dialog Box.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_CLOSE


CWnd::ModifyStyle

Call this member function to modify a window's style.

Syntax

BOOL ModifyStyle( DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, SetWindowPos, CWnd::ModifyStyleEx


CWnd::ModifyStyleEx

Call this member function to modify a window's extended style.

Syntax

BOOL ModifyStyleEx( DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ModifyStyle


CWnd::MoveWindow

Call this member function to change the position and dimensions of a window.

Syntax

void MoveWindow ( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );

void MoveWindow ( LPCRECT lpRect, BOOL bRepaint = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE ignores the bRepaint parameter and treats it as TRUE. This function always sends a WM_PAINT message to the window.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetWindowPos, WM_PAINT


CWnd::OnActivate

The framework calls this member function when a CWnd object is being activated or deactivated. First, the main window being deactivated has OnActivate called, and then the main window being activated has OnActivate called. This member function is called by the framework to allow your application to handle a Windows message.

Syntax

afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnAmbientProperty

The framework calls this member function to obtain ambient property values from a window that contains ActiveX controls. Override this function to alter the default ambient property values returned by an ActiveX control container to its controls. Any ambient property requests not handled by an overriding function should be forwarded to the base class implementation.

Syntax

BOOL OnAmbientProperty( COleControlSite* pSite, DISPID dispid, VARIANT* pvar )

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnCancelMode

The framework calls this member function to inform this CWnd object to cancel any internal mode.

Syntax

afx_msg void OnCancelMode( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::Default


CWnd::OnCaptureChanged

The framework calls this member function to notify the window that is losing the mouse (or stylus) capture.

Syntax

afx_msg void OnCaptureChanged( CWnd* pWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnChar

This member function is called by the framework when a keystroke translates to a nonsystem character.

Syntax

afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_KEYDOWN, WM_KEYUP


CWnd::OnCharToItem

This member function is called by the framework when a list box with the LBS_WANTKEYBOARDINPUT style sends its owner a WM_CHARTOITEM message in response to a WM_CHAR message. This member function is called by the framework to allow your application to handle a Windows message.

Syntax

afx_msg int OnCharToItem( UINT nChar, CListBox* pListBox, UINT nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_CHAR, WM_CHARTOITEM


CWnd::OnChildNotify

This member function is called by this window's parent window when it receives a notification message that applies to this window.

Syntax

virtual BOOL OnChildNotify( UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnClose

This member function is called by the framework as a signal that the CWnd object or the application is to terminate. The default implementation calls DestroyWindow.

Syntax

afx_msg void OnClose( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::DestroyWindow


CWnd::OnCommand

This member function is called by the framework when the user selects an item from a menu, when a child control sends a notification message, or when an accelerator keystroke is translated.

Syntax

virtual BOOL OnCommand( WPARAM wParam, LPARAM lParam );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CCmdTarget::OnCmdMsg


CWnd::OnCompareItem

This member function is called by the framework to specify the relative position of a new item in a child sorted owner-draw combo or list box.

Syntax

afx_msg int OnCompareItem( int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CListBox::CompareItem, CComboBox::CompareItem


CWnd::OnCreate

This member function is called by the framework when an application requests that the Windows window be created by calling the Create or CreateEx member function.

Syntax

afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::Create, CWnd::CreateEx, CWnd::Default, CWnd::FromHandle


CWnd::OnCtlColor

This member function is called by the framework when a child control is about to be drawn.

Syntax

afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CDC::SetBkColor


CWnd::OnDeadChar

This member function is called by the framework when the OnKeyUp member function and the OnKeyDown member functions are called. This member function can be used to specify the character value of a dead key.

Syntax

afx_msg void OnDeadChar( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnKeyUp, CWnd::OnKeyDown


CWnd::OnDeleteItem

This member function is called by the framework to inform the owner of an owner-draw list box or combo box that the list box or combo box is destroyed or that items have been removed by CComboBox::DeleteString, CListBox::DeleteString, CComboBox::ResetContent, or CListBox::ResetContent.

Syntax

afx_msg void OnDeleteItem( int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CComboBox::DeleteString, CListBox::DeleteString, CComboBox::ResetContent, CListBox::ResetContent, CComboBox::DeleteItem


CWnd::OnDestroy

This member function is called by the framework to inform the CWnd object that it is being destroyed.

Syntax

afx_msg void OnDestroy( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::DestroyWindow


CWnd::OnDestroyClipboard

This member function is called by the framework for the Clipboard owner when the Clipboard is emptied through a call to the EmptyClipboard Windows function.

Syntax

afx_msg void OnDestroyClipboard( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnDrawItem

This member function is called by the framework for the owner of an owner-draw button control, combo-box control, list-box control, or menu when a visual aspect of the control or menu has changed.

Syntax

afx_msg void OnDrawItem( int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CButton::DrawItem, CMenu::DrawItem, CListBox::DrawItem, CComboBox::DrawItem


CWnd::OnEnable

This member function is called by the framework when an application changes the enabled state of the CWnd object.

Syntax

afx_msg void OnEnable( BOOL bEnable );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::EnableWindow


CWnd::OnEraseBkgnd

This member function is called by the framework when the CWnd object background needs erasing (for example, when resized). It is called to prepare an invalidated region for painting.

Syntax

afx_msg BOOL OnEraseBkgnd( CDC* pDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnFontChange

This member function is called by the framework for all top-level windows in the system after an application changes the pool of font resources.

Syntax

afx_msg void OnFontChange( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnGetDlgCode

Normally, Windows handles all arrow-key and TAB-key input to a CWnd control. By overriding OnGetDlgCode, a CWnd control can choose a particular type of input to process itself. The default OnGetDlgCode functions for the predefined control classes return a code appropriate for each class.

Syntax

afx_msg UINT OnGetDlgCode( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnHelpInfo

This member function is called by the framework when the user presses the F1 key.

Syntax

afx_msg BOOL OnHelpInfo( HELPINFO* lpHelpInfo );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWinApp::OnHelp, CWinApp::WinHelp


CWnd::OnHScroll

This member function is called by the framework when the user clicks a window's horizontal scroll bar. The SB_THUMBTRACK scroll-bar code typically is used by applications that give some feedback while the scroll box is being dragged.

Syntax

afx_msg void OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetScrollPos, WM_VSCROLL


CWnd::OnInitMenuPopup

This member function is called by the framework when a pop-up menu is about to become active. This allows an application to modify the pop-up menu before it is displayed without changing the entire menu.

Syntax

afx_msg void OnInitMenuPopup ( CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

There is no system menu in Windows CE, so the value of the bSystemMenu parameter is always FALSE.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnKeyDown

This member function is called by the framework when a nonsystem key is pressed.

Syntax

afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_CHAR, WM_KEYUP


CWnd::OnKeyUp

This member function is called by the framework when a nonsystem key is released.

Syntax

afx_msg void OnKeyUp( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_CHAR, CWnd::Default


CWnd::OnKillFocus

This member function is called by the framework immediately before losing the input focus.

Syntax

afx_msg void OnKillFocus( CWnd* pNewWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetFocus


CWnd::OnLButtonDblClk

This member function is called by the framework when the user double-clicks the left mouse button.

Syntax

afx_msg void OnLButtonDblClk( UINT nFlags, CPoint point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnLButtonDown, CWnd::OnLButtonUp


CWnd::OnLButtonDown

This member function is called by the framework when the user presses the left mouse button.

Syntax

afx_msg void OnLButtonDown( UINT nFlags, CPoint point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnLButtonDblClk, CWnd::OnLButtonUp


CWnd::OnLButtonUp

This member function is called by the framework when the user releases the left mouse button.

Syntax

afx_msg void OnLButtonUp( UINT nFlags, CPoint point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnLButtonDblClk, CWnd::OnLButtonDown


CWnd::OnMeasureItem

This member function is called by the framework for the owner of an owner-draw button, combo box, list box, or menu item when the control is created.

Syntax

afx_msg void OnMeasureItem( int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CMenu::MeasureItem, CComboBox::MeasureItem


CWnd::OnMenuChar

This member function is called by the framework when the user presses a menu mnemonic character that does not match any of the predefined mnemonics in the current menu. It is sent to the CWnd that owns the menu. It is also called when the user presses alt and any other key, even if the key does not correspond to a mnemonic character.

Syntax

afx_msg LRESULT OnMenuChar ( UINT nChar, UINT nFlags, CMenu* pMenu );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

There is no system menu in Windows CE, so the only value the CWnd::OnMenuChar supports in the nFlags parameter is MF_POPUP.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnMouseMove

This member function is called by the framework when the mouse cursor (or stylus) moves.

Syntax

afx_msg void OnMouseMove( UINT nFlags, CPoint point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetCapture


CWnd::OnMove

This member function is called by the framework after the CWnd object has been moved.

Syntax

afx_msg void OnMove( int x, int y );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnNcDestroy

This member function is called by the framework when the nonclient area is being destroyed, and is the last member function called when the Windows window is destroyed.

Syntax

afx_msg void OnNcDestroy( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::DestroyWindow, CWnd::Default, CWnd::PostNcDestroy


CWnd::OnPaint

This member function is called by the framework when Windows or an application makes a request to repaint a portion of an application's window.

Syntax

afx_msg void OnPaint( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BeginPaint, CWnd::EndPaint, CWnd::RedrawWindow, CPaintDC, CView::OnDraw


CWnd::OnRenderAllFormats

The Clipboard owner's OnRenderAllFormats member function is called by the framework when the owner application is being destroyed.

Syntax

afx_msg void OnRenderAllFormats( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OpenClipboard, CWnd::OnRenderFormat


CWnd::OnRenderFormat

The Clipboard owner's OnRenderFormat member function is called by the framework when a particular format with delayed rendering needs to be rendered. passed with the message and not the parameters you supply to the function.

Syntax

afx_msg void OnRenderFormat( UINT nFormat );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OpenClipboard


CWnd::OnSetFocus

This member function is called by the framework after gaining the input focus. To display a caret, CWnd should call the appropriate caret functions at this point.

Syntax

afx_msg void OnSetFocus( CWnd* pOldWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnShowWindow

This member function is called by the framework when the CWnd object is about to be hidden or shown.

Syntax

afx_msg void OnShowWindow( BOOL bShow, UINT nStatus );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnSize

This member function is called by the framework of the CWnd class after the window's size has changed.

Syntax

afx_msg void OnSize ( UINT nType, int cx, int cy );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Because users cannot resize windows, the only value Windows CE supports in the nType parameter is SIZE_RESTORED.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::MoveWindow, CWnd::SetScrollPos


CWnd::OnStyleChanged

This member function is called by the framework after the SetWindowLong function has changed one or more of the window's styles.

Syntax

afx_msg void OnStyleChanged( int nStyleType, LPSTYLESTRUCT lpStyleStruct );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, ::SetWindowLong


CWnd::OnSysChar

This member function is called by the framework if CWnd has the input focus and the WM_SYSKEYUP and WM_SYSKEYDOWN messages are translated. It specifies the virtual-key code of the Control-menu key.

Syntax

afx_msg void OnSysChar( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_SYSKEYDOWN, WM_SYSKEYUP


CWnd::OnSysCommand

This member function is called by the framework when the user selects a command from the Control menu, or when the user selects the Maximize or the Minimize button.

Syntax

afx_msg void OnSysCommand( UINT nID, LPARAM lParam );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnSysDeadChar

This member function is called by the framework if the CWnd object has the input focus when the OnSysKeyUp or OnSysKeyDown member function is called. It specifies the character value of a dead key.

Syntax

afx_msg void OnSysDeadChar( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnSysKeyDown, CWnd::OnSysKeyUp, CWnd::OnDeadChar


CWnd::OnSysKeyDown

This member function is called by the framework, if the CWnd object has the input focus, when the user holds down the ALT key and then presses another key. If no window currently has the input focus, the active window's OnSysKeyDown member function is called. The CWnd object that receives the message can distinguish between these two contexts by checking the context code in nFlags.

Syntax

afx_msg void OnSysKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_SYSKEYUP


CWnd::OnSysKeyUp

This member function is called by the framework, if the CWnd object has the input focus, when the user releases a key that was pressed while the ALT key was held down. If no window currently has the input focus, the active window's OnSysKeyUp member function is called. The CWnd object that receives the call can distinguish between these two contexts by checking the context code in nFlags.

Syntax

afx_msg void OnSysKeyUp( UINT nChar, UINT nRepCnt, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_SYSKEYDOWN


CWnd::OnTimer

This member function is called by the framework after each interval specified in the SetTimer member function used to install a timer.

Syntax

afx_msg void OnTimer( UINT nIDEvent );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetTimer


CWnd::OnVKeyToItem

This member function is called by the framework for a CWnd object that owns a list box with the LBS_WANTKEYBOARDINPUT and LBS_HASSTRINGS styles, when the list box sends the WM_VKEYTOITEM message in response to a WM_KEYDOWN message.

Syntax

protafx_msg int OnVKeyToItem( UINT nKey, CListBox* pListBox, UINT nIndex );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_KEYDOWN


CWnd::OnVScroll

This member function is called by the framework when the user clicks the window's vertical scroll bar.

Syntax

afx_msg void OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetScrollPos, CWnd::OnHScroll


CWnd::OnWindowPosChanged

This member function is called by the framework when the size, position, or Z-order has changed as a result of a call to the SetWindowPos member function or another window-management function.

Syntax

afx_msg void OnWindowPosChanged( WINDOWPOS* lpwndpos );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See AlsoWindow Class Categories, CWnd::SetWindowPos


CWnd::OnWinIniChange

This member function is called by the framework after a change has been made to the Windows initialization file, WIN.INI.

Syntax

afx_msg void OnWinIniChange ( LPCTSTR lpszSection );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, the lpszSection parameter is a constant defined in Winuser.h, rather than a pointer to a string. At this time, the only value defined for it is INI_INTL, which indicates that a user has made a change to the regional settings in the control panel.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::OnWndMsg

This member function is called by WindowProc, or is called during message reflection.

Syntax

virtual BOOL OnWndMsg( UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnChildNotify, CWnd::SendChildNotifyLastMsg, CWnd::ReflectChildNotify, CCmdTarget::OnCmdMsg, CWnd::ReflectLastMsg


CWnd::OpenClipboard

Call this member function to open the Clipboard.

Syntax

BOOL OpenClipboard( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::PostMessage

Call this member function to place a message in the window's message queue. This function returns without waiting for the corresponding window to process the message.

Syntax

BOOL PostMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SendMessage


CWnd::PostNcDestroy

This member function is called by the default OnNcDestroy member function after the window has been destroyed.

Syntax

virtual void PostNcDestroy( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnNcDestroy


CWnd::PreCreateWindow

This member function is called by the framework before the creation of the Windows window attached to this CWnd object.

Syntax

virtual BOOL PreCreateWindow( CREATESTRUCT& cs );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::Create, CWnd::CreateEx


CWnd::PreSubclassWindow

This member function is called by the framework to allow other necessary subclassing to occur before the window is subclassed.

Syntax

virtual void PreSubclassWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SubclassWindow, CWnd::UnSubclassWindow, CWnd::GetSuperWndProcAddr, CWnd::DefWindowProc, CWnd::SubclassDlgItem, CWnd::Attach, CWnd::PreCreateWindow


CWnd::PreTranslateMessage

This function is used by class CWinApp to translate window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions.

Syntax

virtual BOOL PreTranslateMessage( MSG* pMsg );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWinApp, TranslateMessage, DispatchMessage


CWnd::RedrawWindow

Call this member function to update the specified rectangle or region in the given window's client area.

Syntax

BOOL RedrawWindow( LPCRECT lpRectUpdate = NULL, CRgn* prgnUpdate = NULL, UINT flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::ReflectChildNotify

This message function is called by the framework from OnChildNotify. It is a helper function which reflects message to its source.

Syntax

BOOL ReflectChildNotify( UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnChildNotify, CWnd::SendChildNotifyLastMsg, CWnd::OnWndMsg, CCmdTarget::OnCmdMsg, CWnd::ReflectLastMsg


CWnd::ReflectLastMsg

This member function is called by the framework to reflect the last message to the child window.

Syntax

static BOOL PASCAL ReflectLastMsg( HWND hWndChild, LRESULT* pResult = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnChildNotify, CWnd::SendChildNotifyLastMsg, CWnd::ReflectChildNotify, CCmdTarget::OnCmdMsg


CWnd::ReleaseDC

Call this member function to release a device context, freeing it for use by other applications.

Syntax

int ReleaseDC( CDC* pDC );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDC, CWnd::GetWindowDC


CWnd::RepositionBars

Call this member function to reposition and resize control bars in the client area of a window. The nIDFirst and nIDLast parameters define a range of control-bar identifiers to be repositioned in the client area. The nIDLeftOver parameter specifies the identifier of the child window (normally the view) which is repositioned and resized to fill the rest of the client area not filled by control bars.

Syntax

void RepositionBars( UINT nIDFirst, UINT nIDLast, UINT nIDLeftOver, UINT nFlag = CWnd::reposDefault, LPRECT lpRectParam = NULL, LPCRECT lpRectClient = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::RunModalLoop

Call this member function to retrieve, translate, or dispatch messages until ContinueModal returns FALSE.

Syntax

int RunModalLoop( DWORD dwFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, ContinueModal, EndModalLoop


CWnd::ScreenToClient

Call this member function to convert the screen coordinates of a given point or rectangle on the display to client coordinates.

Syntax

void ScreenToClient( LPPOINT lpPoint ) const;

void ScreenToClient( LPRECT lpRect ) const;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ClientToScreen


CWnd::ScrollWindow

Call this member function to scroll the contents of a window's client area. This function is similar to the ScrollWindow function, with some additional features.

Syntax

void ScrollWindow ( int xAmount, int yAmount, LPCRECT lpRect = NULL, LPCRECT lpClipRect = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Either the xAmounor yAmount parameter must be set to zero.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::UpdateWindow


CWnd::ScrollWindowEx

Call this member function to scroll the contents of a window's client area. This function is similar to the ScrollWindow function, with some additional features.

Syntax

int ScrollWindowEx ( int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, CRgn* prgnUpdate, LPRECT lpRectUpdate, UINT flags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

MFC for Windows CE does not support the SW_SCROLLCHILDREN flag in the flags parameter.

Either the dx or dy parameter must be set to zero.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::RedrawWindow, CDC::ScrollDC, CWnd::ScrollWindow, CWnd::UpdateWindow


CWnd::SendChildNotifyLastMsg

This member function is called by the framework to provide a notification message to a child window, from the parent window, so the child window can handle a task.

Syntax

BOOL SendChildNotifyLastMsg( LRESULT* pResult = NULL );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnChildNotify


CWnd::SendDlgItemMessage

Call this member function to send a message to a control.

Syntax

LRESULT SendDlgItemMessage( int nID, UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SendMessage


CWnd::SendMessage

Call this member function to send the specified message to this window. The SendMessage member function calls the window procedure directly and does not return until that window procedure has processed the message.

Syntax

LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::PostMessage, CWnd::SendDlgItemMessage


CWnd::SendMessageToDescendants

Call this member function to send the specified Windows message to all descendant windows.

Syntax

void SendMessageToDescendants( UINT message, WPARAM wParam = 0, LPARAM lParam = 0, BOOL bDeep = TRUE, BOOL bOnlyPerm = FALSE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SendMessage, CWnd::FromHandlePermanent, CWnd::FromHandle


CWnd::SendNotifyMessage

Call this member function to send the specified message to the window.

Syntax

BOOL SendNotifyMessage( UINT message, WPARAM wParam, LPARAM lParam );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SendMessage


CWnd::SetActiveWindow

Call this member function to make this CWnd the active window. The SetActiveWindow member function should be used with care since it allows an application to arbitrarily take over the active window and input focus.

Syntax

CWnd* SetActiveWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetActiveWindow


CWnd::SetCapture

Call this member function to cause all subsequent mouse (or stylus) input to be sent to the current CWnd object regardless of the position of the cursor.

Syntax

CWnd* SetCapture( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetCapture


CWnd::SetCaretPos

Call this member function to set the position of the caret.

Syntax

static void PASCAL SetCaretPos( POINT point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetCaretPos


CWnd::SetDlgCtrlID

Call this member function to set the window identifier or control identifier for the window to a new value.

Syntax

int SetDlgCtrlID( int nID );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDlgCtrlID, CWnd::Create, CWnd::CreateEx, CWnd::GetDlgItem


CWnd::SetDlgItemInt

Call this member function to set the text of a given control in a dialog box to the string representation of a specified integer value.

Syntax

void SetDlgItemInt( int nID, UINT nValue, BOOL bSigned = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, the bSigned parameter is not used. All values passed in the nValue parameter are assumed to be signed.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDlgItemInt


CWnd::SetDlgItemText

Call this member function to set the caption or text of a control owned by a window or dialog box.

Syntax

void SetDlgItemText( int nID, LPCTSTR lpszString );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetDlgItemText


CWnd::SetFocus

Call this member function to claim the input focus. The input focus directs all subsequent keyboard input to this window. Any window that previously had the input focus loses it.

Syntax

CWnd* SetFocus( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetFocus


CWnd::SetFont

Call this member function to set the window's current font to the specified font.

Syntax

void SetFont( CFont* pFont, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetFont


CWnd::SetForegroundWindow

Call this member function to put the thread that created the window into the foreground and activate the window.

Syntax

BOOL SetForegroundWindow ( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

This member function activates the specified window and brings the thread that created it to the foreground, but the system does not automatically assign a higher priority to the foreground thread, as it does in Windows 95 and Windows NT.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetFont


CWnd::SetIcon

Call this member function to set the handle to a specific icon, as identified by hIcon.

Syntax

HICON SetIcon( HICON hIcon, BOOL bBigIcon );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, GetIcon


CWnd::SetOwner

Call this member function to set the current window's owner to the specified window object. This owner can then receive command messages from the current window object.

Syntax

void SetOwner( CWnd* pOwnerWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetOwner, CToolBar


CWnd::SetParent

Call this member function to change the parent window of a child window. If the child window is visible, Windows performs the appropriate redrawing and repainting.

Syntax

CWnd* SetParent( CWnd* pWndNewParent );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetParent


CWnd::SetProperty

Call this member function to set the ActiveX control property specified by dwDispID. This function should be called only on an ActiveX control.

Syntax

void SetProperty( DISPID dwDispID, VARTYPE vtProp, ... );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 2.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::InvokeHelper, COleDispatchDriver, CWnd::CreateControl


CWnd::SetRedraw

Call this member function to allow changes to be redrawn or to prevent changes from being redrawn.

Syntax

void SetRedraw( BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::SetScrollInfo

Call this member function to set the information that the SCROLLINFO structure maintains about a scroll bar.

Syntax

BOOL SetScrollInfo( int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetScrollInfo, CWnd::SetScrollPos, CWnd::OnVScroll, CWnd::OnHScroll


CWnd::SetScrollPos

Call this member function to set the current position of a scroll box and, optionally, redraw the scroll bar to reflect the new position of the scroll box.

Syntax

int SetScrollPos( int nBar, int nPos, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetScrollPos, CScrollBar::SetScrollPos


CWnd::SetScrollRange

Call this member function to set minimum and maximum position values for the given scroll bar. It can also be used to hide or show standard scroll bars.

Syntax

void SetScrollRange( int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SetScrollPos, CWnd::GetScrollRange


CWnd::SetTimer

Call this member function to install a system timer. A time-out value is specified, and every time a time-out occurs, the system posts a WM_TIMER message to the installing application's message queue or passes the message to an application-defined TimerProc callback function.

Syntax

UINT SetTimer( UINT nIDEvent, UINT nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD) );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::KillTimer


CWnd::SetWindowPos

Call this member function to change the size, position, and Z-order of child, pop-up, and top-level windows.

Syntax

BOOL SetWindowPos ( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

If this is a visible top-level window, and you don't specigy the SWP_NOACTIVATE flag in the nFlags parameter, this function will activate the window. If this is the currently active window, and you specify either the SWP_NOACTIVATE flag or the SWP_HIDEWINDOW flag, the activation is passed on to another visible top-level window.

When you set the SWP_FRAMECHANGED flag in the nFlags parameter, Windows CE redraws the entire non-client area of the window, which may change the size of the client area.

Windows CE 1.0 doesn't support the HWND_TOPMOST and HWND_NOTOPMOST constants in the hwndInsertAfter parameter, or the SWP_DRAWFRAME or SWP_NOCOPYBITS flags in the fuFlags parameter.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::SetWindowText

Call this member function to set the window's title to the specified text. If the window is a control, the text within the control is set. This function causes a WM_SETTEXT message to be sent to this window.

Syntax

void SetWindowText( LPCTSTR lpszString );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetWindowText


CWnd::ShowCaret

Call this member function to show the caret on the screen at the caret's current position. Once shown, the caret begins flashing automatically.

Syntax

void ShowCaret( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::HideCaret


CWnd::ShowWindow

Call this member function to create an overlapped, pop-up, or child window with the extended style specified in the dwExStyle parameter.

Syntax

BOOL ShowWindow ( int nCmdShow );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

Windows CE does not support the SW_MAXIMIZE, SW_MINIMIZE, SW_RESTORE, SW_SHOWDEFAULT, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED, or SW_SHOWMINNOACTIVE values for the nCmdShow parameter.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::OnShowWindow


CWnd::SubclassDlgItem

Call this member function to dynamically subclass a control created from a dialog box template, and attach it to this CWnd object.

Syntax

BOOL SubclassDlgItem( UINT nID, CWnd* pParent );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetSuperWndProcAddr, CWnd::DefWindowProc, CWnd::SubclassWindow, CWnd::Attach


CWnd::SubclassWindow

Call this member function to dynamically subclass a window and attach it to this CWnd object.

Syntax

BOOL SubclassWindow( HWND hWnd );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::GetSuperWndProcAddr, CWnd::DefWindowProc, CWnd::SubclassDlgItem, CWnd::Attach, CWnd::PreSubclassWindow, CWnd::UnSubclassWindow


CWnd::UnSubclassWindow

Call this member function to set WndProc back to its original value and detach the window identified by HWND from the CWnd object.

Syntax

HWND UnsubclassWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::SubclassWindow, CWnd::PreSubclassWindow, CWnd::GetSuperWndProcAddr, CWnd::DefWindowProc, CWnd::SubclassDlgItem, CWnd::Attach


CWnd::UpdateData

Call this member function to initialize data in a dialog box, or to retrieve and validate dialog data.

Syntax

BOOL UpdateData( BOOL bSaveAndValidate = TRUE );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::DoDataExchange


CWnd::UpdateDialogControls

Call this member function to update the state of buttons and other controls in a dialog box or window that uses the ON_UPDATE_COMMAND_UI callback mechanism.

Syntax

void UpdateDialogControls( CCmdTarget* pTarget, BOOL bDisableIfNoHndler );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::UpdateWindow

Call this member function to update the client area by sending a WM_PAINT message, if the update region is not empty. This function sends a WM_PAINT message directly, bypassing the application queue. If the update region is empty, WM_PAINT is not sent.

Syntax

void UpdateWindow( );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::RedrawWindow


CWnd::ValidateRect

Call this member function to validate the client area within the given rectangle by removing the rectangle from the update region of the window.

Syntax

void ValidateRect ( LPCRECT lpRect );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

In Windows CE, you have to pass a valid RECT pointer in the lpRect parameter. Windows 95 and Windows NT validate the entire window if the lpRect parameter is set to NULL. This is not supported in Windows CE.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::BeginPaint, RECT


CWnd::WindowFromPoint

Call this member function to retrieve the window that contains the specified point. The point argument must specify the screen coordinates of a point on the screen.

Syntax

static CWnd* PASCAL WindowFromPoint( POINT point );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, CWnd::ChildWindowFromPoint


CWnd::WindowProc

This member function provides a Windows procedure (WindowProc) for a CWnd object. It dispatches messages through the window's message map.

Syntax

virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd Data Members

Data Members
m_hCommandBarMenu | The menu handle to this CWnd objet's command bar menu.
m_hWnd | The window handle attached to this CWnd object.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories


CWnd::m_hCommandBarMenu

This data member contains the menu handle to a window's command bar menu.

HMENU m_hCommandBarMenu;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

Remarks

This member is only supported in Windows CE.

See Also

CWnd Overview, CWnd Data Members, Window Class Categories


CWnd::m_hWnd

This data member contains the window handle to the Windows CE window attached to this CWnd object.

HWND m_hWnd;

At a Glance

Header File | Afxwin.h
Platforms
Versions | 1.0 and later
Complete documentation | Visual C++ documentation

See Also

CWnd Overview, CWnd Data Members, Window Class Categories, CWnd::Attach, CWnd::Detach, CWnd::FromHandle


CWordArray

The CWordArray class supports arrays of 16-bit words.

The member functions of CWordArray are similar to the member functions of class CObArray. Because of this similarity, you can use the CObArray reference documentation for member function specifics.

At a Glance

Header file: Afxcoll.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation

See Also

Class Members, Array Classes, CObArray


CWordArray Class Members

Construction
CWordArray Constructs an empty array for words.

Bounds
GetSize | Gets number of elements in this array.
GetUpperBound | Returns the largest valid index.
SetSize | Sets the number of elements to be contained in this array.

Operations
FreeExtra | Frees all unused memory above the current upper bound.
RemoveAll | Removes all the elements from this array.

Element Access
GetAt |  | Returns the value at a given index.
SetAt |  | Sets the value for a given index; array is not allowed to grow.
ElementAt |  | Returns a temporary reference to the element pointer within the array.
GetData | Allows access to elements in the array. Can be NULL.

Growing the Array
SetAtGrow |  | Sets the value for a given index; grows the array if necessary.
Add |  | Adds an element to the end of the array; grows the array if necessary.
Append | Appends another array to the array; grows the array if necessary.
Copy | Copies another array to the array; grows the array if necessary.

Insertion/Removal
InsertAt | Inserts an element (or all the elements in another array) at a specified index.
RemoveAt | Removes an element at a specific index.

Operators
operator [] Sets or gets the element at the specified index.

See Also

CWordArray Overview, Array Classes


New MFC for Windows CE API Elements


AfxGetCeSocketWindow

Call this global function to obtain the handle to the socket window to which you can send WM_SOCKET_NOTIFY messages in a Windows CE socket application.

Syntax

HWND AfxGetCeSocketWindow();

At a Glance

Header file: | Wcesock.h
Platforms: |
Versions: | 2.0 and later

Return Value

The handle to an invisible window, to which you can send socket notification messages.

Remarks

This function accesses the module's thread state and returns the socket window handle that is used internally for receiving and processing Windows sockets messages.

Note This MFC global function is unique to Windows CE. It is not portable to other Windows platforms.

See Also

CCeSocket, WM_SOCKET_NOTIFY


WM_SOCKET_NOTIFY

The WM_SOCKET_NOTIFY message informs the socket window that a socket event has occurred.

Syntax

WM_SOCKET_NOTIFY
hSocket = (SOCKET) wParam;
lSocketEvent = (long) lParam;

At a Glance

Header file: | Wcesock.h
Platforms: |
Versions: | 2.0 and later

Parameters

hSocket
The socket handle to the socket for which the notification is intended.
lSocketEvent
A constant value representing the event of which to inform the socket. This parameter can be one of the following values.
FD_READ
Calls the specified socket's OnReceive function.
FD_WRITE
Calls the specified socket's OnSend function.
FD_OOB
Calls the specified socket's OnOutOfBandData function.
FD_ACCEPT
Calls the specified socket's OnAccept function.
FD_CONNECT
Calls the specified socket's OnConnect function.
FD_CLOSE
Calls the specified socket's OnClose function.

Return Value

This message does not return a value.

Remarks

You can only send the WM_SOCKET_NOTIFY message to a window returned by the AfxGetCeSocketWindow WCE MFC global function.

This message is only exposed publicly in Windows CE.

See Also

AfxGetCeSocketWindow, CCeSocket::OnAccept, CCeSocket::OnConnect, CAsyncSocket::OnClose, CAsyncSocket::OnOutOfBandData, CAsyncSocket::OnSend, CAsyncSocket::OnReceive


Topic Not Found

No matching topic was found. Some possible reasons and remedies are as follows:

  • The file (.chm) that contains the destination topic is not in the expected location.

Remedy: Rerun the MSDN Library Setup.

  • The file (.chm) that contains the current topic or destination topic is out-of-date and the link is no longer valid.

Remedy: Install the latest version of the MSDN Library.

  • The MSDN Library CD is not in the CD-ROM drive.

Remedy: Insert the MSDN Library CD into the CD-ROM drive.