Tải bản đầy đủ (.pdf) (1,741 trang)

MFC programming with visual c++ 6 unleashed 1999

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (15.95 MB, 1,741 trang )

MFCProgrammingwithVisual
C++6Unleashed
byDavidWhite,Kenn ISBN:0672315572
Scribner,Eugene
Olafsen
Sams©1999(1306pages)
ThistitledemonstrateshowtoapplyMFCstomany
commonprogrammingproblems.inadditionto
techniquessuchasdatabasecreation,networking
systemsandCOMprogramming,allsourcecodefrom
thebookisavailableenablingthereadertobuildtheir
ownapplications.

Introduction
Foreword
AbouttheAuthor
CoreMFC
TheMFCArchitecture
ABriefHistoryofMFC
TheMFCClassHierarchy
CObject
CCmdTarget
CWinThread
CWinApp
CWnd
CFrameWnd
CView
CDocument
Summary
MFCDialogs,Controls,andDataInteraction
CreatinganApplication


StartingandUsingMFCAppWizard
TheAppWizard-GeneratedCode


ModifyingtheApplication
AddingDialogControls
AddingInitialization
UsingDialogControls
ToolTips
EnablingToolTips
DisplayingText
DialogDataExchange
StandardDDX
UpdateData
UsingStandardDialogBoxes
FileOpen/Save
ColorSelector
FontSelector
PrintDialog
Summary
TheWindowsCommonControls
InitializingandUsingtheCommonControls
NotificationsforWindowsCommonControls
TheNotificationMessageStructure
OverviewoftheNotificationProcess
ABetterNotificationHandlingScheme
SpecifyingNotificationRangeswith
ON_NOTIFY_RANGE
HotKeyControls:ClassCHotKeyCtrl
CHotKeyCtrlClassMethods

CreatingandInitializingaCHotKeyCtrlObject


UsingaHotKeyControl
SpinControls:ClassCSpinButtonCtrl
SpinControlStyles
CSpinButtonCtrlMessages
CSpinButtonCtrlClassMethods
CreatingandInitializingaSpinControl
SampleProgram:SPIN1
SliderControls:ClassCSliderCtrl
SliderControlStyles
CSliderCtrlMessages
CSliderCtrlClassMethods
CreatingandInitializingaSliderControl
SampleProgram:SliderControls(SLIDER1)
SampleProgram:SLIDER1
ProgressBarControls:ClassCProgressCtrl
CProgressCtrlClassMethods
CreatingandInitializingaCProgressCtrlObject
UsingaProgressControl
ImageLists:ClassCImageList
CImageListClassMethods
CreatingandInitializingaCImageListControl
ListViewControls:ClassCListCtrl
ListViewControlStyles
ImageListsandtheListViewControl
ListViewItemsandSubitems
ListViewNotificationMessages
CreatingandInitializingaCListCtrlObject

UsingtheListViewControl


TreeViewControls:ClassCTreeCtrl
TreeViewControlStyles
TreeViewNotificationMessages
CTreeCtrlClassMethods
CreatingandInitializingaTreeViewControl
UsingaCTreeCtrlObject
SampleProgram:TREELIST.EXE
TabControls:ClassCTabCtrl
TabControlStyles
TabControlNotificationMessages
CTabCtrlClassMethods
TheTabItemStructure(TC_ITEM)
CreatingandInitializingaTabControl
UsingaTabControl
AnimateControls:ClassCAnimateCtrl
AnimateControlStyles
AnimateControlNotificationMessages
CAnimateCtrlClassMethods
CreatingandInitializinganAnimateControl
UsinganAnimateControl
RichEditControls:ClassCRichEditCtrl
RichEditControlWindowStyles
TheCharacterFormatStructure(CHARFORMAT)
TheParagraphFormatStructure(PARAFORMAT)
CRichEditCtrlClassMethods
CRichEditCtrlLine-RelatedMethods
CRichEditCtrlText-SelectionMethods

CRichEditCtrlFormattingMethods
CRichEditCtrlEditingMethods
CRichEditCtrlClipboardMethods
CRichEditCtrlGeneral-PurposeMethods
CreatingandInitializingaRichEditControl
UsingaRichEditControl


Summary
Painting,DeviceContexts,Bitmaps,andFonts
DeviceContexts
TheGraphicsDeviceInterface
MFCWrapping
MFCDeviceContextClasses
TheBaseClass:CDC
PaintingwithClassCPaintDC
ManagingClientAreaswithClassCClientDC
ManagingFrameWindowswithClassCWindowDC
WindowsGraphicObjects
Pens:ClassCPen
Brushes:ClassCBrush
Fonts:ClassCFont
Bitmaps:ClassCBitmap
Palettes:ClassCPalette
Regions:ClassCRgn
GDICoordinateSystems
LogicalMappingModes
VectorGraphics
DrawingModes
LinesandPolylines

Rectangles
Regions
Polygons
Ellipses
BezierCurves
FontsandText


FontCharacteristics
TheTEXTMETRICStructure
TheLOGFONTStructure
FontCreation
DrawingText
SampleProgram:VectorGraphicsandTextMethods
(VECTEXT1.EXE)
RasterGraphics
NamedRasterOperations(ROPs)
Bitmaps
Device-DependentBitmaps
Device-IndependentBitmaps(DIBs)
TheCBitmapClass
TransferringandContortingBitmaps
BitmapResources
TackingResourcesontoanExecutableFile
GettingImageResourcesoutofanExecutableFile
SampleProgram:ExploringBitmapResources(BITMAP1)
Summary
CustomControlDevelopment
WindowClassesVersusC++Classes
AValidatingEditControl

TheClockStaticControl
ControlMetrics
PaintingtheFace
LocatingtheHands
PaintingtheHands
SettingtheTime
PitfallsofSubclassingStandardControls
TheHyperlinkControl


ImplementationStrategy
FontProcessing
PaintingtheWindow
ControllingtheCursor
MouseInput
KeyboardInput
LaunchingtheLink
AdvancedCustomControlTopics
SubclassingLimitations
Notifications
UsingtheResourceEditorwithCustomClasses
Summary
TheMFCApplicationObject,MessageRouting,andIdle
Processing
TheMFCApplicationObject
CWinAppandApplicationLifetime
TheCWinAppDataMembers
TheCWinAppMemberFunctions
Application-SpecificInitialization
FunctionalityinInitInstance

OLEContainerSupport
3DLookforWindowsNT3.5x
RegistryUsage
MostRecentlyUsedFilesList
SDIandMDIDocument/View
MainFrameWindowCreation
AutomationSupport
RichEditControlSupport
Command-LineHandling
MessageRouting,MessageMaps,andMessage
Categories
MessageRouting


PreTranslateMessage
MessageMaps
IdleProcessing
OnIdle
IdleProcessingforDialogs
TheSplashScreenComponent
Summary
Documents,Views,andApplicationsThatUseThem
TheDocument/ViewArchitecture
Documents,Frames,andViews
DocumentTemplates
CreatingNewDocuments
OpeningNewFiles
SingleVersusMultipleDocumentTemplates
Views
TheCViewClass

TheCScrollViewClass
TheCFormViewClass
TheDatabaseViewClasses
TheControlViews
ChangingViewsinanSDI
UsingtheMDI
Summary
ExtendingtheUserInterface
RespondingtotheUser


KeyboardMessaging
HandlingKeyboardMessages
MouseMessaging
HandlingMouseMessages
UserInterfacesandAppWizard
ExtendingMenus
ObtainingMenusandPop-upMenus
AddingMenuItems
UsingFloatingPop-upMenus
PuttingControlBarstoUse
UsingToolbarsandRebars
UsingStatusBars
ShowingandHidingControlBars
SupportingToolTips
UpdatingtheUserInterface
PropertySheetsandWizards
MFC'sSupportforPropertySheetsandWizards
CreatingaSimpleWizard
SplittingaView

Summary
Printing
PrintingFundamentals
PrintingwithMFC
PrintingintheView
ThePrintInfoObject
PrintingMenuCommands
PrintingandGDIMappingModes
WYSIWYGPrinting


ApplicationResources
TheApplicationClass
TheViewClass
Pagination
PrintingwithaKnownPageCount
PrintingwithanUnknownPageCount
PrintingPageNumbers
StoppingandAbortingPrintJobs
HaltingaPrintJobinOnPrepareDC()
HaltingaPrintJobinOnPrint()
Summary
MFCandCOMProgramming
COM
ALittleHistory
Interfaces,Objects,andMethods
SomeTerminology
AReal-WorldView
TheIUnknownInterface
Servers,Clients,andClasses

TheCOMRuntimeEnvironment
DefiningtheClassFactory
HowAreCOMObjectsReused?
MarshalingandThreading
Marshaling
Threading


COM,OLE,andAutomation
IDispatch
AutomationServers,Objects,andControllers
SupportingBothIDispatchandIUnknown
PersistingCOMData
StructuredStorage
IdentifyingCOMData(Monikers)
TransferringData
UniformDataTransfer
ConnectableObjects
DCOM
ObjectCreation
InvokingMethods
SecurityIssues
SomeImportantInformation
BSTR
SAFEARRAY
HRESULT
VARIANT
FurtherReading
Summary
COMandMFC

UnderstandingtheAfxGlobalFunctions
ApplicationLifetimeControl
ClientControlManagement
ConnectionPointManagement
ControlRegistration


Exceptions
Initialization
Licensing
TypeInformation
ReviewingtheOLEMacros
ClassFactories
Client/ContainerCommonCommands
ControlPropertyPersistence
DialogDataExchange
DispatchMaps
EventMaps
PropertyPageDataMapping
PropertyPages
TypeLibraryAccess
MFCandtheOLEClassCategories
ActiveDocument
Automation
CommonDialogsforOLE
Container
Control
DragandDrop(UniversalDataTransfer)
DocumentServers
Support

Summary
MFCOLEServers
DocumentServers
ServerTypes
FullServer
ActiveDocument
Container/Server
Mini-Server


DocumentServerDesign
OLEDocuments
ActiveDocuments
BuildinganActiveDocumentServer
Persistence
RenderingtheView
AutomationServers
IDispatch
GetIDsOfNames
GetTypeInfo
GetTypeInfoCount
Invoke
IDispatch-DerivedInterfaceinODL
CallingMethodsThroughIDispatch
GetIDsOfNames
TypeInformationMethods
Invoke
DispinterfacesDifferfromInterfaces
CallingMethodsThroughIDispatch
DualInterfaces

TheVariant
AnAutomationServerUsingMFC
ServerType
DeclaringandDefiningAdditionalDispinterfaces
AddingMethodsandProperties
Summary
MFCOLEClients
IDispatchandItsPlaceinAutomation


InterfaceDefinitionforAutomationServers
IDLandATL
ODLandMFC
DualInterfaces
MFCandAutomation
Controller
ConnectingtoaServer
ServerReview
BuildingaController
UsingCOleDispatchDriver
Using#import
RemoteAutomation
Summary
MFCActiveXControls
DevelopmentStrategy
MFC
ATL
MFCandATL
ControlDevelopment
TwoFacesofaControl

Runtime
DesignTime
SubclassingaControl
MFC
ATL
ComponentCategories


ICatRegister
ICatInformation
Methods,Properties,andEvents
Properties
Methods
Events
PropertyPages
PropertyPagesinATL
PropertyPagesinMFC
ComponentRegistration
RegistrationScripts
RegistrationandControls
COMObjectSubkeys
BuildinganMFCControl
InterfaceDefinition
AQuickATLPort
Summary
MFCActiveXControlContainers
ActiveDocumentContainer
Storage
SiteObjects
In-PlaceActivation

DocumentExtensions
BuildingtheSimplestActiveDocumentContainer
OLEControls
AddingContainmenttoanExistingProject
ActiveXContainer
ControlContainmentandEvents


Summary
UsingMFCandATL
WhatIsATLandWhyIsItImportantforProgrammingin
MFC?
HelpfulATLCOMSupportforMFCApplications
COMPointerstheSmartWay
OtherATLCOMSupport
AdvancedATLSupportforMFCApplications
BeginwithYourMFCApplication
AddtheRequiredATLSupport
Summary
ScriptingYourMFCApplication
ScriptingBasics
ScriptingInterfaces
DualInterfaces
ObjectModels
ImplementingaScriptedApplication
ObjectImplementation
Summary
MFCDatabaseProgramming
MFCDatabaseProcessing
RelationalDatabaseConcepts

Tables
Columns


Records
Cursors
Transactions
StoringandRetrievingData
SELECT
INSERT
DELETE
UPDATE
DatabaseCommunicationMechanisms
ODBC
DAO
WhichMethodologyShouldIUse?
ODBC/MFC
CDatabase
CRecordset
DAO
CDaoWorkspace
CDaoDatabase
CDaoRecordset
CDaoTableDef
CDaoQueryDef
Summary
AdvancedDatabaseSupport
TheCOMApproach
OLEDB
ADO

WhichOneShouldIUse?


OLEDBConsumersUsingtheATLWrapperClasses
CDataSource
CSession
Accessors
Rowsets
AccessingDatasourceData
UsingtheADOC++Interfaces
ADOConnection
ADORecordset
ADOCommand
ADOField
ADOProperty
ADOParameter
ADOError
Summary
MFCUtilityClasses
StringsandCollections
StringsandStringClasses
InsidetheCStringClass
PracticalCStringUsage
CStringSummary
Collections
InsideCollectionClasses
TemplatedCollections
TheUNL_MultiEdApplication
Overview



AnSTLApproach
Summary
FileI/OandMFC
TheCFileClass
ProcessingFileswithCFile
InsidetheCFileClass
TheCStdioFileClass
TheCMemFileClass
TheCSharedFileClass
TheCFileDialogClass
TheUser-DefinedCFileDialogClass
PracticalUsageofCFileandCFileDialog
OpeningaFile
ReadingDatafromaFile
AClassicalApproach
WhatAreStreams?
Summary
Exceptions
WhatAreTheyGoodFor?
TypesofExceptions
StructuredExceptionHandlers
NestingofStructuredExceptionHandlers
RaisingStructuredExceptions
CleaningUpAfteranException
C++Exceptions
DefiningaC++ExceptionClass
MFCExceptions



MFCCException-DerivedClasses
CMemoryException
CNotSupportedException
CArchiveException
CFileException
CResourceException
COleException
CDbException
COleDispatchException
CUserException
CDaoException
CInternetException
DerivingYourOwnMFC-CompliantExceptionObjects
DeletingExceptions
UsingMFCExceptionMacros
MixingExceptions
Summary
MFCandtheWeb
MFCandDHTML
DHTML,MSIE,andtheInternet
UsingtheInternetExplorerWebActiveXControl
InternetExplorerActiveXControlBasics
CHtmlView
CHtmlViewandtheDocument/ViewRelationship
CHtmlViewandCOM
UsingtheInternetExplorerActiveXControlinaDialog
Box
UsingDHTML
TheDHTMLObjectModel
TheDocumentObject

OtherDHTMLObjects
CollectionObjects


DHTMLCOMInterfaces
ObtainingtheDocumentDHTMLInterface
ObtainingtheDHTMLCollectionsInterfaces
UsingtheDHTMLInterface
TheDHTMLElementInterfaceMethods
DocumentNavigation
Summary
CSocketProgramming
HowDoNetworkCommunicationsWork?
Sockets,Ports,andAddresses
WinsockandMFC
InitializingtheWinsockEnvironment
CreatingaSocket
MakingaConnection
SendingandReceivingMessages
ClosingtheConnection
SocketEvents
ControllingEventTriggering
DetectingErrors
GettingSocketInformation
SocketsandI/OSerialization
BuildingaNetworkedApplication
CreatingtheApplicationShell
WindowLayoutandStartupFunctionality
InheritingfromtheCAsyncSocketClass
ConnectingtheApplication

SendingandReceiving
EndingtheConnection
Summary
WinInetProgramming


WebApplicationProtocolsandWinInet
HypertextTransferProtocol
FileTransferProtocol
GopherProtocol
WinInetAPIandMFC
InternetSessionBasics
CInternetSession
CInternetFile
CInternetException
CInternetConnection
BuildingaSimpleWinInetApplication
Application-LevelFunctionality
HTTPClasses
FTPClasses
GopherClasses
BuildingaSimpleFTPClient
Summary
ISAPIExtensions
TheFoundation
FromTheretoHere
FromGETtoPOST
AddingSomeFormElements
ChangetheForm
ChangetheParseMap

DeclareandUsetheHandlerFunction
AddaRadioButton
OtherFormInputElements
ChangetheForm
ChangetheParseMap


ChangetheHandlerFunction
Summary
MAPIandMFC
TheMessagingApplicationProgrammingInterface
ClientApplications
TwoHigher-LevelAlternatives:SimpleMAPIandCMC
SimpleMAPI
CommonMessagingCalls
TheMapiMessageStructure
TheMapiFileDescStructure
LimitedMAPIFunctionalityinMFC
TheCDocumentConnection
DoingMAPItheMFCWay
TheCDocument::OnFileSendMail()Method
SampleProgram:MAPI1.EXE
Summary
TAPEandMFC
Overview
AssistedTelephony
BasicTelephonyService
SupplementalTelephonyService
ExtendedTelephonyService
HistoryofTAPI

TAPI1.3
TAPI1.4
TAPI1.5


TAPI2
TAPI2.1
TAPI2.2
TAPI3
UsingAssistedTelephony
UsingBasicTelephony
ConfiguringTAPI
ConnectingwithTAPI
TransmittingDatawithTAPI
DisconnectionwithTAPI
TerminatingaTAPISession
Summary
MFCandGraphicsProgramming
MFCandOpenGL
WhatIsOpenGL?
GraphicsBootCamp
CoreTermsandKeyConcepts
TheBasicMathematicsofGraphicsProgramming
OpenGLBootCamp
OpenGLDatatypes
OpenGLFunctionNamingConventions
OpenGLRenderFunctionScoping
TheOpenGLMatrixStack
TheOpenGLRenderingContext
MinimalOpenGLProgramandaCustomView

CreatingYourBasicMFCApplication
AddingtheCustomOpenGLBaseClass
IntegratetheCustomViewClassintoYourApplication


BuildYour3DScene
AddtheOpenGLLibrariestoYourProject’sLinkList
2Dand3DModels
BasicModelDevelopment
ModelTransformations
DisplayLists
Light
TheBasicsofLightinOpenGL
TypesofLight
ObjectMaterialProperties
TextureMapping
OpenGLImagesandWindowsDevice-Independent
Bitmaps
ApplyingTexture
SpecialEffects
Blending
Fog
Summary
MFCandDirectX
WhatIsDirectX?
DirectXinaNutshell
DirectXComponents
DirectXBasics
DifferencesinCOMProgrammingStyleandDirectX
DirectXComponentStartupSequence

DirectDrawBasics


×