常见MFC函数

1.MFC常用函数:
WinExec()
ExitWindowsEx()
GlobalMemoryStatus()
GetSystemInfo()
GetSystemDirectory()
GetWindowsDirectory()
GetTaskmanWindow() //user32.dll中 获取任务栏窗口句柄
OpenProcessToken()打开一个进程的访问令牌
GetCurrentProcess()获取本进程句柄
LookupPrivilegeValue()修改进程权限
AdjustTokenProvileges()通知WindowsNT修改本进程权利
CreateRectRgn()
CreateEllipticRgnIndirect()
PtInRegion()
CommandToIndex()ID号转换为索引值
菜单类:
DrawMenuBar()重画菜单
SetDefaultItem()设置默认菜单项
CheckMenuItem()设置菜单项Check状态
CreatePopupMenu()创建弹出菜单
窗口类:
MoveWindow()
Invalidate()使窗口无效,窗口无效时会进行窗口重绘
GetParent()获得窗口的父窗口句柄
BringWindowToTop()把窗口放到顶部
SetWindowPos()
DeferWindowPos()
SetActiveWindow()激活顶层窗口
Set/GetForegroundWindow()设置/获取前台窗口,返回句柄
Set/GetWindowLong()改变窗口属性
GetNextWindow()获取下一个窗口句柄
GetWindow()获取窗口句柄
FromHandle()通过句柄获取指针
AfxGetInstanceHandle()获取程序当前实例句柄
AfxRegisterWndClass()
Set/GetClassLong()
Set/GetWindowLong()
GetWindowRect()获取窗口在屏幕中的Rect
对话框:
GetDlgItem()
Set/GetDlgItemText()
Set/GetDlgItemInt()
Set/GetDlgItem()
SendDlgItemMessage()
SetFocus()文本编辑框Edit控件若要响应回车按键消息,必须设置为多行类型
GetNextDlgTabItem()获取下一个有TABStop属性的控件句柄
OnCtlColor()WM_CTLCOLOR窗口绘制消息响应函数
GetDlgCtrlID()
SetButtonText()设置按钮文本CreateRectRgn
GetStartPosition()
GetNextPathName()
SetHorizontalExtent()
SHBrowseForFolder()
属性表单:
SetWizardMode()
SetWizardButtons()
OnSetActive()
工具栏:
RecalcLayout()
ShowControlBar()
状态栏:
CommandToIndex()根据ID号获取索引值
SetMessageText()
GetMessageBar()
GetDescendantWindow()
图形类
OnEraseBkgnd()
CButton::DrawItem()
SetBkMode()设置文字背景
SetTextColor()
SetBkColor()
SetROP2()
SetClipRtn()
DrawText()
BeginPath()
EndPath()
BeginPaint()
EndPaint()
GetTextExtend()
SetWorldTransform()
GetDeviceCaps()
Set/GetViewportOrg()
Set/GetWindowOrg()
DPtoLP()将设备坐标点转换为逻辑坐标点
LPtoDP()将逻辑坐标点转换为设备坐标点
DeleteMetaFile()
CopyMetaFile()
GetMetaFile()
GetEnhMetaFile()
void CView::OnPaint()
{
CPaintDC dc(this);
OnPrepareDC(&dc);
OnDraw(&dc);
}
文件操作:
EncryptFile()
CreateFile()
ReadFile()
WriteFile()
SetFilePointer()
::WriteProfileString()向win.ini写入相关信息
::GetProfileString()从win.ini获取相关信息
CWinApp::WriteProfileString()向注册表中写入相关信息
CWinApp::GetProfileString()从注册表中获取相关信息
::WritePrivateProfileString()
RegCreateKeyEx()创建注册表项
RegCloseKey()关闭注册表项
RegOpenKeyEx()打开注册表项
RegSetValueEx()写入注册表项
RegQueryValueEx()读取注册表项
RegEnumKeyEx()
RegDeleteKey()
文档视图:
钩子:
SetWindowsHookEx()
CallNextHookEx()
UnhookWindowsHookEx()
GetCurrentThreadID()
GetModuleHandle()
动态库:
#pragma data_seg()
#pragma comment(linker,"/section:XXX,RWS") R可读W可写S共享
SEGMENTS
XXX READ WRITE SHARED
MAKEINTRESOURCE()
GetProcAddress()获取函数地址
LoadLibrary()加载Dll
FreeLibrary()减少Dll的引用计数
多线程:
CreateThread()
CloseHandle()
互斥:
CreateMutex()
ReleaseMutex()
WaitForSingleObject()
事件:
CreateEvent()
SetEvent()设置有信号状态
ResetEvent()设置无信号状态
临界区:
EnterCriticalSection()
InitializeCriticalSection()
LeaveCriticalSection()
DeleteCriticalSection()
异步套接字:
WSAAsyncSelect()为一个套接字请求网络消息通知
WSAEnumProtocols()检索可用的网络通信协议
WSASocket()
剪贴板:
OpenClipboard()打开剪贴板
CloseClipboard()关闭剪贴板
EmptyClipboard()清空剪贴板
SetClipboardData()
GetClipboardData()
GlobalAlloc()
GlobalLock()
GlobalUnlock()
IsClipboardFormatAvailable()
匿名管道:
CreatePipe()
CreateProcess()
CreateFile()
ReadFile()
WriteFile()
命名管道:
CreateNamedPipe()
ConnectNamedPipe()
WaitNamedPipe()
CreateFile()
ReadFile()
WriteFile()
邮槽:
CreateMailslot()
多媒体:
mciSendCommand()<mmsystem.h>

2.每个函数都自己单步调试一遍,就明白其中的原理,后续应用起来就非常方便了。

3.每天努力一点点,成功就近一点点,未来可期。

                                改变自己,从现在做起-----------久馆

posted on 2020-11-21 21:44  DanielandCalf  阅读(495)  评论(0编辑  收藏  举报

导航