MFC API小结
来源:互联网 发布:python 前五分钟 编辑:程序博客网 时间:2024/05/16 12:29
最近要用到MFC编程,windows的API感觉很多,总记不住,就把它们写下来:
CWnd::GetDlgCtrlID() 获取控件ID
AfxMessageBox 弹出消息对话框
MessageBox
LoadImage 加载bitmap、icon、cursor,返回各自的handle
GetObject 由HBITMAP来获取BITMAP数据结构,如:
HBITMAP hbmp = LoadImage( … );
BITMAP bmp;
GetObject(hbmp, sizeof(BITMAP), &bmp);
这样就能得到bmp。
DeleteObject、DestroyCursor、DestroyIcon当LoadImage用完后,删除各自的handle
CDialog::DoModal 弹出对话框,调用CDialog::OnOK();时退出对话框
CFileDialog::GetPathName 获取文件名的绝对路径
SendMessage 发送消息给指定对话框,如:
::SendMessage(::GetParent(this->m_hWnd), WM_RBUTTONUP, GetDlgCtrlID(), 0);发送消息WM_RBUTTONUP给它的拥用者,参数1为自己的ID。
想知道窗口有哪些消息,使用MFC ClassWizard,就可看到列出的对话框或者控件的消息。
CWnd:: Invalidate() 让对话框或者控件区域无效,当数据更新后需要更新UI的时候调用。
StretchDIBits 将一设备无关的bitmap数据copy到一个HDC里
CClientDC::CClientDC 引用MSDN里的话: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.也就是说调用下面的语句:
CClientDC pDC(this);
就能为当前的CWnd对象生成对应的DC,再调用:
StretchDIBits(pDC,0,0,bmpWidth,bmpHeight,0,0,bmpWidth,bmpHeight,
lpSrcBits,lpBitmapInfo,DIB_RGB_COLORS,SRCCOPY);
就能将bitmap图片画到这个DC上(其中lpSrcBits和lpBitmapInfo是bitmap图片的数据)。
CDC::GetPixel
CDialog::OnPaint()
CDialog::OnInitDialog()
CWnd::UpdateData
HWND current = ::GetFocus();
::GetWindowText(current, str, 100);
BITMAPFILEHEADER以及BITMAPINFOHEADER
CreateDIBSection
CreateCompatibleDC NULL为参数
BitBlt
DeleteDC
DeleteObject
SelectObject
GridCtrl API
ON_NOTIFY
DDX_GridControl
- MFC API小结
- MFC API小结(持续更新)
- MFC小结
- MFC小结
- MFC学习小结
- MFC CListCtrl 使用小结
- 转:MFC入门小结
- 近期MFC使用小结
- MFC CString 用法小结
- MFC扩展DLL 小结
- mfc知识小结
- MFC线程小结
- MFC对话框小结
- mfc radiobutton 用法小结
- MFC画线小结
- VC++/MFC小结
- MFC连接数据库小结
- MFC _RecordsetPtr 用法小结
- SDK 抓屏程序
- 使用图片创建不规则窗体 windows sdk
- malloc和new区别,进程与线程的区别
- C++变长参数函数的用法(转)
- rhel5配置vsftp提示cannot change directory:/home/...
- MFC API小结
- Google Analytics前三天的统计数据
- GridCtrl使用详解(转)
- thon应用领域介绍
- 囧
- 软件工程精品课程--清华大学
- 窗口子类化
- 被拒于alimama门外
- SAP学习笔记(CO模块学习笔记1)