Index
C
C++. See also Visual C++ .NET
adding managed C++ support to existing C++ projects, 925–26
vs. ATL, 693
vs. C#, 911
COM interfaces and, 538
vs. MFC, 693
reasons to use for writing .NET code, 910–12
reasons to use Managed Extensions, 911–12
relationship to CLR, 909–10
C# vs. C++, 911
CAccessorRowset class, 775–76
CacheData function, 646
CacheGlobalData function, 646, 649
caching, WinInit and, 839
calendar controlsActiveX controls, 215, 216, 218–20, 223–30
common control overview, 196
list of events, 216
list of methods, 216
list of properties, 216
callbacksconnections and, 761–62
WinInit and, 839, 841–43
CApplication class, 629
CArchive class, 392, 393, 397, 587
CArray class, 449–50, 451
CAsyncMonikerFile class, 846, 847–48
CBitmap class, 92, 114
CBitmapButton class, 130–33
CBlockingSocket class, 821, 823–28, 834
CBlockingSocketException class, 823–28
CBrush class, 93
CButton class, 158
CChildFrame class, 420, 421, 432–34, 528
CChildView class, 527, 528
CClientDC class, 90, 91
CCmdTarget class, 543–44, 559, 569, 580, 647–48, 673
CCmdUI class, 282, 312, 313
CColorDialog class, 159
CComboBox class, 158, 159
CComboBoxEx class, 197
CComCoClass class, 702, 729, 750, 768
CComControl class, 730–31
CComControlBase classDoVerbProperties function, 753
OnPaint function, 738–39
overview, 730, 731–32
persistence and, 760
CComDispatchDriver class, 732
CCommand class, 777, 787
CComObjectRoot class, 702
CComObjectRootBase class, 705–8
CComObjectRootEx class, 705–8, 729, 730, 750, 768
CCommonDialog class, 159
CComPtr class, 688–90, 731
CComPtrBase class, 684–88
CComputeDlg class, 260–61, 269
CComQIPtr class, 690–92
CControlBar class, 309
CControlWinTraits class, 734
CCriticalSection class, 272–74
CDataSource class, 775
CDateTimeCtrl class, 195
CDC classconstructing CDC objects, 90–91
destroying CDC objects, 90–91
Ellipse function, 42
GetClipBox function, 64
GetDeviceCaps function, 98
GetTextMetric function, 99
overview, 41, 42, 89–90
SelectStockObject function, 42
SetBkColor function, 114
SetTextColor function, 114
TextOut function, 42, 340
virtualness, 90
CDialog class, 135, 145, 167, 182
CDialogImpl class, 750
CDib classdefault constructor, 120
destructor, 120
DIB section constructor, 120
list of functions, 120–25
overview, 114, 118
CDocTemplate class, 399, 424, 466
CDocument classas base class, 278, 349
class relationships, 399, 400
DeleteContents function, 368, 402, 404, 414, 443, 444
GetDocTemplate function, 420
GetNextView function, 350
object relationships, 399, 400
OnNewDocument function, 352, 368, 403, 443
OnSaveDocument function, 404
OnSaveDocumentAs function, 404
UpdateAllViews function, 351, 367, 368
CDumpContext class, 356, 587
CDynamicAccessor class, 776
CDynamicParameterAccessor class, 776
CEdit class, 158, 284
CEditView class, 284, 835
CEnumerator class, 775
CFile classvs. CArchive class, 392, 397
overview, 392
Read function, 835
role in serialization, 392
CFileDialog class, 159, 160, 161–66, 167
CFindReplaceDialog class, 159
CFont class, 93, 103
CFontDialog class, 159, 293
CFormView class, 349, 353–54
CFrameWnd classActivateFrame function, 334–35
as base class, 26, 278, 420
class relationships, 399, 400
CPersistentFrame class, 334, 342–47, 503–8, 568
Create function, 26
enabling drag and drop, 416
object relationships, 399, 400
OnDropFiles function, 416
OnHelp function, 487–88
CFtpConnection class, 840
CFtpFileFind class, 841
CGdiObject class, 92
CGI (Common Gateway Interface), 870–71, 954
CGopherConnection class, 840
CGopherFileFind class, 841
CHAIN_MSG_MAP macro, 735
char type, 394
check boxes, 142
child windowscontrol bars as, 334
controls as, 212, 213
creating, 423
vs. main frame window, 278
status bar and, 321–22
in typical MDI application, 418–19
view window as, 278
views as, 334–35
CHttpBlockingSocket class, 828–30, 833, 834
CHttpConnection class, 840, 844
CHttpFile class, 841, 842
CImageList class, 190, 197
CInternetException class, 841
CInternetFile class, 840
CInternetSession class, 839–40
CIPAddressCtrl class, 196
circles, drawing, 315, 317, 318–19
class data membersinitializing, 63
saving view state, 63
vs. wrapper classes, 221–22
class factoriesclass objects as, 541
overview, 541–43, 673
registering, 552–53
class libraries vs. application frameworks, 23, 26
class objects, as class factories, 541
Class View Properties window, 220, 222, 288–89, 290, 295, 307, 312, 465, 467
Class View windowcreating applications using MFC Application Wizard and code wizards together, 71–73
creating dialog class, 145–49
opening, 13
overview, 13
setting up message map structure, 61+Class Wizard. See MFC Class Wizard
classesC++ vs. COM, 671–73
making serializable, 393–96
.NET, Form class, 932–33
.NET type overview, 898–99
OLE DB, 774
registering COM classes, 552–53
relationships, 399, 400
window vs. C++, 73
WinInit, 839–41
Winsock, 820–30
client programsAutomation, 616–36
WinInit and, 843–44
clients, domain names and, 814
client-side ATL programming, 677–93
ClipboardMFC data object transfers, 648–50
role of COleDataObject class, 647–48
role of COleDataSource class, 648
role of IDataObject interface, 642
CListBox class, 158, 159
CListCtrl class, 179–80
Close function, 824
CloseClipboard function, 642
CLR. See common language runtime
CLS (Common Language Specification), 899
CMainFrame classOnCmdMsg function, 527–28
OnCreateClient function, 460–61, 463
OnSetFocus function, 527
in SDI applications, 420, 421
toolbars and, 310
CManualAccessor class, 776
CMDIChildWnd class, 420, 423
CMDIFrameWnd class, 420, 468
CMenu class, 306–7
CMessageMap class, 734
CMetaFileDC class, 89
CMonthCalCtrl class, 196
CMultiDocTemplate class, 420, 422
CNT files, 479
CObArray class, 444
CObject class, 354–55, 894
CObList classAddTail function, 370
first-in, first-out example, 369–70
overview, 369
POSITION variable and, 370–72
CoCreateInstance function, 578, 747, 751, 756, 761, 782
code wizards, 71–73
code-behind, 958, 959–62
CoGetClassObject function, 551–52, 621
COleDataObject class, 647–48
COleDataSource class, 646–47, 648, 649
COleDateTime class, 195
COleDialog class, 159
COleDispatchDriver classAttachDispatch function, 630
as base class, 581
CreateDispatch function, 621, 629
GetProperty function, 582
InvokeHelper function, 582
ReleaseDispatch function, 621
SetProperty function, 582
COleObjectFactory classMFC and, 673
overview, 560
UpdateRegistryAll function, 596
COleTemplateServer class, 611–12, 673
COleVariant class, 221, 586–90
collectionsCArray class, 449–50
CObList class, 369–73
CTypedPtrList class, 372
Dump function, 372–73
properties, 615
serializing, 396–97
in VBA, 575–76
color bitmaps, 114
column maps, 787
COM (Component Object Model)ActiveX and, 531–32
apartments and threading, 698–700
benefits, 890–91
class factories and, 541–43
creating ATL-based classes, 697–98
evolution to CLR, 892–94
how clients call in-process components, 554–56
how clients call out-of-process components, 556–58
interoperability with CLR, 909
limitations, 891–92
MFC and, 551–62, 673–74
overview, 531, 532–34
registering class factories, 552–53
registering classes, 552–53
relationship to ActiveX, 674–75
relationship to MFC, 674–75
relationship to OLE, 674
role of aggregation, 568–69
role of containment, 568
role of interfaces, 667–69
role of property pages, 747
summary, 889–92
versioning, 901–2
wizard support for in-process components, 560–62
writing code, 671–73
combo boxesadding, 142–43
extended, 197, 205–10
sizing drop-down portion, 143
COMCTL32.DLL file, 177
COMDLG32.DLL file, 159, 160
command messages. See also message mapping
extended processing, 307–8
handler sequence, 280–81
handling in derived classes, 281
handling in Windows Forms, 946
overview, 280–81
sending from dialog boxes, 282–83
toolbars and, 311–12
update command user interface handlers, 282, 288, 289, 312–13, 317
command processing. See command messages
COMMAND_CODE_HANDLER macro, 735
COMMAND_HANDLER macro, 735
COMMAND_ID_HANDLER macro, 735
COMMAND_RANGE_HANDLER macro, 735
commands, as OLE DB element, 773, 777, 778–79
CommandText property, 986
CommandType property, 986
committed memory, 248–49
common controlsadvanced, 194–210
date and time picker, 194–95, 200, 201–3
extended combo-box control, 197, 205–10
Internet protocol address, 196, 201, 204
list control, 179–80
in modal dialog box, 181–94
month calendar, 196, 201, 203–4
overview, 177
progress control, 178, 183
rebars, 328–32
rich edit control, 284
slider control, 178–79, 183–86
spin control, 179, 186–87
standard, 178–94
tree control, 180, 191–93
WM_NOTIFY message and, 180–81
common dialog boxes. See Windows common dialog boxes
common dialog classes, 159–60
Common Gateway Interface (CGI), 870–71, 954
common language runtime (CLR)C++ relationship to, 909–10
evolution from COM, 892–94
interoperability with COM, 909
overview, 892–94
role of garbage collection, 905–6
role of Intermediate Language, 903–4
role of Mscoree.dll file, 894
role of Mscorlib.dll file, 894
role of Windows Forms, 928
threading and, 906
types overview, 895–99
writing code, 903–6
Common Language Specification (CLS), 899
common type system (CTS)vs. COM, 892
role of CLS, 899
Common.js file, 53
compiler, C/C++, 10
compiler-approved macros, 677
component objects, defined, 541
component versioningCOM vs. .NET, 901–3
in .NET, 903
component-based architecture. See also COM
COM summary, 889–92
DLL limitations, 888–89
history, 888
overview, 887–92
Compress function, 121
connection points, 700, 701, 763–65
constant data, storing, 254–55
ConstructElements function, 450
constructing CDC objects, 90–91
constructing GDI objects, 93
Constructor function, 824
constructor functions, 403
consumers, OLE DBcreating, 783–88
overview, 772
template architecture, 774–77
containersActiveX control events and, 760–62
defined, 212
programming for ActiveX controls, 217–23
containment vs. inheritance, 568
context. See device context
context-sensitive helpaccess methods, 483–84
calling WinHelp from within applications, 480–82
determining context, 482–83
elements, 480
MFC Application Wizard and, 466, 485–87
control bars. See also status bars; toolbars
overview, 309–10
role of Registry, 341
saving and loading status, 341
control flow, 879–80
control IDs, converting to CWnd pointers, 157
ControlQueryInterface function, 731
controls. See also ActiveX controls; common controls
ActiveX, 211–39, 724–70
adding to dialog boxes, 140–44
adding to dialog boxes at run time, 158
aligning, 141
changing behavior, 358
check boxes, 142
combo boxes, 142
common vs. standard, 177
converting IDs to CWnd pointers, 157
dialog boxes and, 136
DLLs as, 510–11
edit control, 284, 358
jumping to, 141
list boxes, 143
for ManagedCWebFormWizard sample wizard, 53–54
modifying, 358
ordinary vs. ActiveX, 212–14
radio buttons, 142
scroll bars, 144, 155–56
standard, 136, 177
subclassing, 358–59
converting CRectTracker coordinates, 651
converting value types to reference types, 896
coordinates. See device coordinates
CopyToMapFile function, 121
core memory, managing, 241–55
CPageSetupDialog class, 159
CPaintDC class, 92
CPalette class, 93
CPen class, 93
CPersistentFrame classas extension DLL, 503–5
inheritance and, 568
overview, 334
CPicture class, 237
CPictureHolder class, 237, 238
CPoint class, 65
CPrintDialog class, 159
CPrintDialogEx class, 159
CPrintInfo class, 441
CProgressCtrl class, 178, 183
CPropertyPage class, 292, 293
CPropertySheet class, 292, 296
CPtrList class, 369
CRange class, 629
Create function, 158, 167, 172–73, 285, 306, 322, 460, 463, 824
CreateAccessor function, 779
CreateBitmap function, 122
CreateControlWindow function, 731
CreateDIBitmap function, 118
CreateDIBSection function, 118, 120
CreateDispatch function, 621, 629
CreateEllipticRgnIndirect function, 66
CreateFile function, 392
CreateFileMapping function, 253
CreateFont function, 103
CreateInstance function, 541–42, 578, 599, 611, 621
CreateObject function, 597
CreateSection function, 122
CreateStatic function, 463
CREATESTRUCT function, 335–36
CreateView function, 463
CreateWindow function, 73
CRect classCDumpContext class and, 356
default window rectangle and, 342
defined, 42, 65
LPCRECT operator, 66
CRectArray class, 449
CRectTracker class, 650–51
CRequestHandlerT class, 875, 879
CRgn class, 93
CRichEditCntrlItem class, 284
CRichEditCtrl class, 285, 290
CRichEditDoc class, 284
CRichEditView class, 284
critical sections, 272–74
CRuntimeClass class, 541
CScrollBar class, 155, 158
CScrollView classas base class, 441
OnPrepareDC function, 111
overview, 81
SetScaleToFitSize mode, 112
CSession class, 775
CSharedFile class, 253
CSingleDocTemplate class, 399
CSingleDocTemplate object, class relationships, 399, 400
CSize class, 65
CSliderCtrl class, 178–79, 183–86
CSockAddr class, 821–23
CSpinButtonCtrl class, 179, 186–87
CSplitterWnd class, 458, 460, 463
CStatusBar class, 309, 320, 322. See also status bars
CStdioFile class, 845
CString class, 338, 339–41, 356, 588, 649
CStringArray class, 442, 443, 444, 450
CTable class, 777
CTime class, 195, 356
CToolBar class, 309. See also toolbars
CTreeCtrl class, 180, 191–93
CTS (common type system), 892, 899
CTypedPtrList class, 372
custom controlsDLLs as, 510–11
list of notification messages, 512
overview, 511
user-defined messages and, 513–18
window class and, 511–12
Custom Wizard templatecreating sample wizard that generates Web applications, 53–60
list of files it generates, 52–53
role in creating wizards, 51–53
CView classas base class, 34, 40, 349
CEditView class and, 284
CFormView class, 354
class relationships, 399, 400
CWnd class and, 40, 61
GetDocument function, 278, 350–51, 367
object relationships, 399, 400
OnDraw function, 40, 63, 64, 89
OnPrepareDC function, 95, 111, 441
OnPrint function, 440–41, 448, 452
OnUpdate function, 351–52, 367
overridable print loop functions, 441–42
resources for splitting, 460
CWinApp classas base class, 26, 397–98
class relationships, 399, 400
member functions, 338
object relationships, 399, 400
OnFileNew function, 402, 404, 422–23
ProcessShellCommand function, 402
SetRegistryKey function, 338
WinHelp function, 480–81
CWindow class, 734
CWindowDC class, 90
CWindowImpl class, 730, 731, 732, 733, 734
CWindowImplBaseT class, 732, 734
CWindowImplRoot class, 732, 734
CWindowsFile class, 782
CWinThread class, 265
CWnd classas base class, 40, 61
CControlBar class, 309
DefWindowProc function, 359
DoDataExchange function, 152–53
DragAcceptFiles function, 416
GetDlgItem function, 157
GetMenu function, 306
GetParent function, 167
GetParentFrame function, 314
GetWindowPlacement function, 341
GetWindowRect function, 341
MessageBox function, 484
OnHelpFinder function, 481
PreCreateWindow function, 335–36
ScrollWindow function, 81
SendMessage function, 168, 280
SetWindowOrg function, 81
SetWindowPlacement function, 341
ShowWindow function, 335
SubclassDlgItem function, 359
CWndApp classGetFirstDocTemplatePosition function, 424
GetNextDocTemplate function, 424
CWndClassInfo class, 733, 734
CWorkbooks class, 629
CWorksheet class, 629
CWorksheets class, 629
CWriteStreamHelper class, 879