搜档网
当前位置:搜档网 › MFC函数大全

MFC函数大全

f8f
基础类
类CObject :(派生类CMenu、
AssertValid
函数原型:virtual void AssertValid( ) const;
函数功能:提供对对象内部状态的运行时检查。虽然在从 CObject 派生类时不要求重写 AssertValid,但是这样做可以使类更加可靠。AssertValid 应该对所有对象的成员变量执行断言,以验证它们包含的值是否有效,当重写 AssertValid 时,在执行您自己的检查之前请调用 AssertValid 的基类版本。然后使用 ASSERT 宏检查您的派生类特有的成员,如下所示:
class CPerson : public CObject
{
protected:
CString m_strName;
float m_salary;
public:
#ifdef _DEBUG
// Override
virtual void AssertValid() const;
#endif
// ...
};

#ifdef _DEBUG
void CPerson::AssertValid() const
{
// Call inherited AssertValid first.
CObject::AssertValid();

// Check CPerson members...
// Must have a name.
ASSERT( !m_strName.IsEmpty());
// Must have an income.
ASSERT( m_salary > 0 );
}
#endif


Dump
函数原型:virtual void Dump( CDumpContext& dc ) const;
函数功能:通过重载Dump(CDumpContext& dc)函数,可以向输出窗口输出信息,大部分输出信息都是由一个全局对象CDumpContext afxDump提供,因为afxDump是全局对象,你在任何MFC程序的任何CObject的派生类中都可以操作它。CDumpContext的构造函数关联了一个文件类,MFC自己会往里面写入很多信息,dc指针指向全局对象afxDump
例如:
// example for CObject::Dump
void CAge::Dump( CDumpContext &dc ) const
{
CObject::Dump( dc );
dc << "Age = " << m_years;
}

IsSerializable
函数原型:BOOL IsSerializable( ) const;
函数功能:测试对象是否已被串行化(序列化)。
序列化是将对象状态转换为可保持或传输的格式的过程。与序列化相对的是反序列化,它将流转换为对象这两个过程结合起来,可以轻松地存储和传输数据。
序列化的目的:
1、以某种存储形式使自定义对象持久化;
2、将对象从一个地方传递到另一个地方。
例如:
// example for CObject::IsSerializable
CAge a(21);
ASSERT( a.IsSerializable() );

Serializable
函数原型:

GetRuntimeClass
IsKindOf
CCmdTarget
FromIDispatch
GetIDispatch
IsResultExpected
BeginWaitCursor
DoOleVerb
EnableAutomation
EnableConnections
EndWaitCursor
EnumOleVerbs
RestoreWaitCursor
EnableTypeLib
GetDispatchIID
GetTypeInfoCount
GetTypeInfoOfGuid
GetTypeLib
GetTypeLibCache
IsInvokeAllowed

线程类
CWinThread
CreateThread
GetMainWnd
GetThreadPriority
PostThreadMessage
ResumeThread
SetThreadPriority
SuspendThread
ExitInstance
InitInstance
IsIdleMessage
OnIdle
PreTranslateMessage
ProcessMessageFilter
ProcessWndProcExcetion
PumpMessage
Run
CWinApp
AddDocTemplate
AddToRecentFileList
CreatePrinterDC
Ge

tFirstDocTemplatePosition
GetNextDocTemplate
GetProfileBinary
GetProfileInt
GetProfileString
LoadCursor
LoadIcon
OpenDocumentFile
ParseCommandLine
ProcessShellCommand
RunAutomated
RunEmbedded
WriteProfileBinary
WriteProfileInt
WriteProfileString
CloseAllDocuments p24
DoMessageBox p24
DoWaitCursor p25
EnableShellOpen p25
ExitInstance p25
HideApplication p25
HtmlHelp p26
LoadStdProfileSettings p26
ProcessMessageFilter p26
ProcessWndProcException p27
Register p27
Run p27
SaveAllModified p27
WinHelp p28
SetRegistryKey p28

文档模板
CDocument
Addview p29
GetDocTemplate p30
GetFirstViewPosition p30
GetNextView p30
GetPathName p30
GetTitle p31
IsModified p31
RemoveView p31
SetModifiedFlag p31
SetPathName p32
SetTitle p32
UpdateAllViews p32
CanCloseFrame p32
DeleteContents p33
GetFile p34
PreCloseFrame p34
ReleaseFile p34
ReportSaveLoadException p35
SaveModified p36
CDocTemplate
GetFirstDocPosition p36
GetNextDoc p37
LoadTemplate p37
SetContainerInfo p38
SetServerInfo p38
AddDocument p38
CreateOleFrame p39
GetDocString p39
RemoveDocument p40
CloseAllDocuments p40
CreateNewDocument p40
CreateNewFrame p40
InitialUpdateFrame p41
MatchDocType p42
OpenDocumentFile p43
SaveAllModified p43
SetDefaultTitle p44

框架窗体
CWnd
Attach p50
CalcWindowRect
103f
p51
Create p51
CreateControl p52
CreateEx p53
CalcWindowRect
函数原型:void CalcWindowRect(LPRECT lpClientRect,UINT nAdjustType=adjustBorder)
函数功能:调用这个成员函数以根据所需的客户矩形大小计算窗口矩形的大小
参数:
lpClientRect:指向一个RECT结构或CRect对象,其中包含了窗口矩形的值
nAdjustType:用于现场编辑的枚举类型。它可以具有以下的值:CWnd::adjustBorder = 0,意味着在计算时不考虑滚动条大小;或者CWnd::adjustBorder = 1,意味着它们将被加入最终的矩形大小。

Detach p53
FromHandle p53
GetSafeHwnd p54
EnableWindow p54
GetActiveWindow p54
GetCapture p55
GetDesktopWindow p55
GetFocus p55
GetForegroundWindow p55
GetIcon p56
IsWindowEnable p56
ModifyStyle p56
SetActiveWindow p57
SetCapture p57
SetFocus
SetForegroundWindow p58
SetIcon p58
ArrangeIconicWindows p58
BringWindowToTop p58
CloseWindow p59
GetClientRect p59
GetWindowRect p59
GetWindowRgn p59
IsIconic p60
IsZoomed p60
MoveWindow p60
SetWindowPlacement p61
SetWindowPos p61
SetWindowRgn p62
CenterWindow p63
ChildWindowFromPoint p63
FindWindow p63
FindWindowEx p64
GetDescendantWindow p64
GetDlgCtrlID p65
GetDlgItem p65
GetLastActivePopup p65
GetOwner p66
GetParent p66
GetWindow p66
SendMessageToDescendants p66
SetDlgCtrlID p67
SetOwner p67
UpdateData p68
UpdateDialogControls p68
DrawCaption p68
GetDC p69
GetWindowDC p70
Invalidate p70
IsWindowVisible p71
LockWindowUpdate p72
Print

p72
ReleaseDC p73
ShowWindow p73
UnlockWindowUpdate p73
UpdateWindow p74
ClientToScreen
函数原型:void ClientToScreen(LPPOINT lpPoint)const;
void ClientToScreen(LPRECT lpRect)const;
参数:
lpPoint:指向一个含有要转换的用户坐标的Point结构的指针,如果函数调用成功,新屏幕坐标复制到此结构。
lpRect:指向一个含有要转换的用户坐标的Rect结构的指针,如果函数调用成功,新屏幕坐标复制到此结构
例如:
void OnRButtonDown(UINT nflags,CPoint Point)
ClientToScreen(&Point)


ScreenToClient p75
GetFont p75
GetWindowText p76
SetFont p76
SetWindowText p76
EnableScrollBarCtrl p77
GetScrollPos p77
RepositionBars p77
ScrollWindow p78
SetScrollPos p78
DragAcceptFiles p79
CreateCaret p79
GetCaretPos p80
SetCaretPos p80
CheckDlgButton p80
EndModalLoop p80
ExecuteDlgInit p81
IsDialogMessage p81
RunModalLoop p81
SetDlgItemInt p82
BindDefaultProperty p82
BindProperty p82
DrawMenuBar p83
GetMenu p83
HiliteMenuItem p83
SetMenu p84
CancelToolTips p84
EnableToolTips p84
KillTimer p85
SetTimer p85
FlashWindow p86
MessageBox p86
Default p87
GetCurrentMessage p87
PostMessage p87
PreTranslateMessage p87
SendMessage p88
SendNotifyMessage p88
GetClipboardOwner p89
OpenClipboard p89
SetClipboardViewer p89
GetControlUnknown p89
GetProperty p90
InvokeHelper p90
SetProperty p91
DefWindowProc p91
WindowProc p91
HtmlHelp p92
PaintWindowlessControls p92
CFrameWnd
Create p93
GetDockState p94
LoadBarState p94
LoadFrame p94
SaveBarState p95
SetDockState p95
ShowControlBar p95
ActivateFrame
函数原型:void ActivateFrame(int nCmdShow=-1);
函数功能:主要用于框架的显示方式
例如:
void CChildFrame::ActivateFrame(int nCmdShow)
{
nCmdShow=SW_SHOWMAXIMIZED;
CMDIChildFrame::ActivateFrame(nCmdShow);
}



BeginModalState p96
CreateView p96
DockControlBar p96
EnableDocking p97
EndModalState p97
GetActiveDocument p97
GetActiveFrame p97
GetActiveView p98
GetControlBar p98
GetMessageString p98
InitialUpdateFrame p98
InModalState p99
IsTracking p99
RecalcLayout p100
SetActiveView p100
SetMessageText p100
ShowOwnedWindows p100
GetMessageBar p101
NegotiateBorderSpace p101
CControlBar
CalcDynamicLayout p102
CalcFixedLayout p102
GetBorders p102
GetBarStyle p103
GetCount p103
GetDockingFrame p103
IsFloating p104
SetBarStyle p104
SetBorders p104
SetInPlaceOwner p105
EnableDocking p105
CalcInsideRect p105
DoPaint p106
DrawBorders p106
DrawGripper p106

对话框类
CDialog
Create p107
CreateIndirect p107
InitModalIndirect p108
DoModal p108
EndDialog p109
GetDefID p109
GotoDlgCtrl
103f
p110
MapDialogRect p110
NextDlgCtrl p110
PreDlgCtrl p110
SetDefID p110
SetHelpID p111
OnCancel p111
OnInitDialog p111
OnOK p112
OnSetFont p112
CDHtmlDialog


CanAccessExternal p113
CreateControlSite p114
DDX_DHtml_AxControl p114
DDX_DHtml_CheckBox p114
DDX_DHtml_ElementText p115
DDX_DHtml_Radio p115
DDX_DHtml_SelectIndex p115
DDX_DHtml_SelectString p115
DDX_DHtml_SelectValue p116
DestroyModeless p116
EnableModeless p116
FilterDataObject p117
GetControlDispatch p117
GetControlProperty p117
GetCurrentUrl p118
GetDHtmlDocument p118
GetDropTarget p119
GetElement p119
GetElementHtml p119
GetElementInterface p120
GetElementProperty p120
GetElementText p120
GetEvent p120
GetExternal p121
GetHostInfo p121
GetOptionKeyPath p122
HideUI p122
IsExternalDispatchSafe p122
LoadFromResource p122
Navigate p123
ResizeBorder p123
SetControlProperty p123
SetElementHtml p124
SetElementProperty p124
SetElementText p124
SetExternalDispatch p125
SetHostFlags p125
ShowContextMenu p126
ShowUI p126
TranslateAccelerator p127
TranslateUrl p127
UpdateUI p127
CDataExchange
Fail p128
PrepareCtrl p128
PrepareEditCtrl p129
PrepareOleCtrl p129
CPropertyPag
CancelToClose p130
QuerySiblings p130
SetModified p130
COlePropertyPage
GetControlStatus p131
GetObjectArray p132
GetPageSite p133
IgnoreApply p133
IsModified p133
SetControlStatus p133
SetDialogResource p134
SetHelpInfo p134
SetModifiedFlag p134
SetPageName p135
CPropertySheet
EnableStackedTabs p136
GetActiveIndex p136
GetActivePage p136
GetPage p136
GetPageCount p137
GetPageIndex p137
GetTabControl p137
SetActivePage p138
SetFinishText p138
SetTitle p138
SetWizardButtons p139
SetWizardMode p139
AddPage p139
Create p139
DoModal p140
EndDialog p140
MapDialogRect p140
PressButton p140
RemovePage p141

文档视图
DoPreparePrinting
GetDocument p142
IsSelected p142

设备上下文
Attach p146
CreateCompatibleDC p147
CreateDC p147
CreateIC p148
DeleteDC p148
DeleteTempMap p148
Detach p149
FromHandle p149
GetCurrentBitmap p149
GetCurrentBrush p149
GetCurrentFont p150
GetCurrentPalette p150
GetCurrentPen p150
GetWindow p150
ReleaseAttribDC p150
ReleaseOutputDC p151
SetAttribDC p151
SetOutputDC p151
GetDeviceCaps p152
GetSafeHdc p152
IsPrinting p152
ResetDC p153
RestoreDC p153
SaveDC p153
EnumObjects p154
GetBrushOrg p154
SetBrushOrg p154
SelectObject p155
SelectStockObject p155
GetHalftoneBrush p156
GetNearestColor p156
RealizePalette p157
SelectPalette p157
UpdateColors p157
GetBkColor p158
GetBkMode p158
GetColorAdjustment p158
GetDCBrushColor p158
GetDCPenColor p158
GetPolyFillMode p159
GetROP2 p159
GetStretchBltMode p159
GetTextColor p160
SetBkColor p160
SetBkMode p160
SetColorAdjustment p161
SetDCBrushColor p161
SetDCPenColor p161
SetPolyFillMode p162
SetROP2 p162
SetStretchBltMode p162
SetTextColor p163
GetMapMode p163
GetViewportExt p164
GetViewportOrg p164
GetWindowExt p164
GetWindowOrg p165
Off

setViewportOrg p165
OffsetWindowOrg p165
ScaleViewportExt p165
ScaleWindowEx p166
SetMapMode p166
SetViewportExt p167
SetViewportOrg p167
SetWindowExt p167
SetWindowOrg p168
GetLayout p168
SetLayout p168
DPtoHIMETRIC p169
DPtoLP p170
HIMETRICtoDP p170
HIMETRICtoLP p171
LPtoDP p171
LPtoHIMETRIC p171
FillRgn p172
FrameRgn p172
InvertRgn p172
PaintRgn p173
ExcludeClipRect p173
ExcludeUpdateRgn p173
GetBoundsRect p174
GetClipBox p174
IntersectClipRect p174
OffsetClipRgn p175
PtVisible p175
RectVisible p176
SelectClipRgn p176
SetBoundsRect p176
AngleArc p177
Arc p177
ArcTo p177
GetArcDirection p178
GetCurrentPosition p178
LineTo p178
MoveTo p179
PolyBezier p179
PolyBezierTo p179
PolyDraw p180
PolyLine p180
PolyLineTo p180
PolyPolyLine p181
SetArcDirection p181
Draw3dRect p181
DrawDragRect p182
DrawEdge p182
DrawFrameControl p183
DrawIcon p183
DrawState p184
FillRect p184
FillSolid
103f
Rect p185
FrameRect p185
InvertRect p185
Chord p186
DrawFocusRect p186
Ellipse p187
Pie p187
Polygon p188
PolyLine p188
PolyPolygon p189
Rectangle p189
RoundRect p190
AlphaBlend p190
BitBlt p191
ExtFloodFill p192
FloodFill p192
GetPixel p193
GradientFill p193
MaskBlt p193
PatBlt p194
PlgBlt p194
SetPixel p195
SetPixelV p195
StretchBlt p196
TransparentBlt p196
DrawText p197
ExtTextOut p198
GetCharABCWidthsI p199
GetCharacterPlacement p199
GetCharWidthI p200
GetOutputTabbedTextExtent p200
GetOutputTextExtent p201
GetOutputTextMetrics p201
GetTextAlign p201
GetTextCharacterExtra p201
GetTextExtent p202
GetTextFace p202
GetTextMetrics p202
GrayString p202
SetTextAlign p203
SetTextCharacterExtra p204
SetTextJustification p204
TabbedTextOut p204
TextOut p205
GetAspectRatioFilter p205
GetCharABCWidths p205
GetCharWidth p206
GetFontData p206
GetGlyphOutline p207
GetKerningPairs p207
GetOutlineTextMetrics p207
GetOutputCharWidth p208
SetMapperFlags p208
AbortDoc p208
DrawEscape p209
EndDoc p209
EndPage p210
Escape p210
Query Abort p210
SetAbortProc p211
StartDoc p211
StartPage p211
ScrollDC p212
AddMetaFileComment p212
PlayMetaFile p212
AbortPath p213
BeginPath p213
CloseFigure p213
EndPath p214
FillPath p214
FlattenPath p214
GetMiterLimit p214
GetPath p214
SelectClipPath p215
SetMiterLimit p215
StrokeAndFillPath p215
StrokePath p215
WidenPath p216

图形对象
Attach p216
CreateStockObject p217
DeleteObject p218
DeleteTempMap p218
Detach p218
FromHandle p219
GetObject p219
GetObjectType p219

ODBC数据库
CDatabase
Close p221
Open p222
OpenEx p223
CanTransact p223
CanUpdate p224
GetBookmarkPersistence p224
GetDatabaseName p224
SetQueryTimeout p224
BeginTrans p225
ExecuteSQL p226
Rollbace p226
CRecordset
CanAppend p227
CanRestart p227
CanUpdate p228
GetSQL p228
IsBOF

p228
IsOpen p228
AddNew p229
Delete p229
Update p230
Move p230
Cancel p231
FlushResultSet p231
Requery p232
SetParamNull p233
Open p233
SetRowsetSize p234

DAO数据库
CDaoDatabase
CanTransact p235
GetConnect p235
SetQueryTimeout p235
Close p236
Create p236
CreateRelation p237
Execute p238
GetRelationInfo p238
GetTableDefInfo p239
Open p239
CDaoWorkspace
GetIsolateODBCTrans p240
GetName p240
GetUserName p241
IsOpen p241
SetIsolateODBCTrans p241
Append p241
Close p242
CommitTrans p242
CompactDatabase p242
Create p243
GetDatabaseCount p244
GetDatabaseInfo p244
Idle p245
Open p245
RepairDatabase p245
Rollback p246
CDaoQueryDef
Append p247
Close p247
Create p247
Execute p248
GetFieldCount p249
GetFieldInfo p249
GetParameterCount p250
GetParameterInfo p250
GetParamValue p250
SetParamValue p251
CDaoRecordset
AddNew p251
CancelUpdate p253
Delete p253
Edit p254
Update p254
Find p255
FindFirst p255
FindNext p256
FindPrev p256
GetAbsolutePosition p256
GetBookmark p257
Move p257
Seek p258
FillCache p258
GetFieldInfo p259
Requery p259
DoFieldExchange p260
GetDefaultSQL p260
GetDefaultDBName p261
CDaoTableDef
Append p261
Close p262
Create p262
Open p263
CreateField p263
CreateIndex p264
DeleteField p265
DeleteIndex p265
RefreshLink p266

文件I/O
CFile
Abort p266
Close p267
Duplicate p267
Open p267
Flush p268
Read p268
Write p269
Getlength p269
Seek p269
SeekToBegin p270
SeekToEnd p270
SetLength p271
LockRange p271
GetFileName p271
GetFilePath p272
GetFileTitle p272
GetPosition p272
GetStatus p273
GetStatus p274
Remove p274
Rename p274
SetFilePath p274
SetStatus p275
UnlockRange p275
COleStreamFile
Attach p275
CreateMemoryStream p276
CreateStream p276
GetStream p277
OpenStream p277
CStdioFile
ReadString p278
WriteString p278

Win32 Internet
CInternetConnection
GetContext p279
GetServerName p279
GetSession p280
CHttpConnection
CFtpConnection
Command p282
CreateDirectory p283
GetCurrentDirectory p2
6bc
83
GetCurrentDirectoryAsURL p284
GetFile p285
OpenFile p286
PutFile p286
Remove p287
RemoveDirectory p288
Rename p288
SetCurrentDirectory p288
CFileFind
GetCreationTime p289
GetFileName p289
GetFilePath p290
GetFileTitle p290
GetFileURL p291
GetLastAccessTime p291
GetLastWriteTime p291
GetLength p292
GetRoot p292
IsArchived p293
IsCompressed p293
IsDirectory p293
IsDots p294
IsHidden p294
IsNormal p294
IsReadOnly p294
IsSystem p295
IsTemporary p295
MatchesMask p295
Close p296
FindFile p296
FindNextFile p297
CFtpFileFind
FindFile p297
FindNextFile p298
GetFileURL p298

Windows套接字
CAsyncSocket
GetPeerName p300
GetSockName p300
GetSockOpt p301
SetSockOpt p302
Accept p303
AsyncSelect p304
Bind p304
Close p304
Connect p

305
Listen p305
Receive p306
Send p307
ShutDown p307
CSocket
CArray

GetSize p310
GetUpperBound p311
IsEmpty p312
SetSize p312
FreeExtra p312
RemoveAll p312
ElementAt p313
GetAt p313
SetAt p313
Add p313
Append p314
Copy p314
SetAtGrow p314
InsertAt p315
RemoveAt p315
CList
GetHead p316
GetTail p317
AddHead p317
AddTail p318
RemoveAll p318
RemoveHead p318
RemoveTail p318
GetHeadPosition p318
GetNext p319
GetPrev p319
GetTailPosition p319
GetAt p319
RemoveAt p320
SetAt p320
InsertAfter p320
InsertBefore p321
Find p321
FindIndex p321
GetCount p321
GetSize p322
IsEmpty p322
CMap
GetHashTableSize p322
GetNextAssoc p322
GetStartPosition p324
InitHashTable p324
Lookup p324
PLookup p324
PGetNextAssoc p325
PGetFistAssoc p326
RemoveAll p326
RemoveKey p326
SetAt p327
GetCount p327
IsEmpty p3
6
27


0


相关主题