VisualC++6.0与MFC初学者教程:位图信息头解析

需积分: 0 2 下载量 137 浏览量 更新于2024-07-14 收藏 3.27MB PPT 举报
这篇资源主要介绍了MFC初学者入门的基础知识,特别是关于位图信息头的概念。位图信息头是Windows操作系统中处理位图图像时的关键数据结构,它包含了一系列描述位图特性的字段。以下是对这些字段的详细解释: 1. `biSize`:这个字段指明了位图信息头结构的大小,以字节为单位,通常为40字节,对于BITMAPINFOHEADER结构。 2. `biWidth`:这个字段定义了位图的宽度,即横向像素的数量。这决定了图像在屏幕上的水平尺寸。 3. `biHeight`:位图的高度,即纵向像素的数量,决定了图像的垂直尺寸。注意,如果是无压缩的位图,正数表示下边缘朝下,负数表示上边缘朝下。 4. `biPlanes`:位面数,一般应设置为1,表示单个位深度平面。如果值不为1,可能表示图像使用了特殊的颜色格式或压缩方式。 5. `biBitCount`:表示每个像素占用的位数,常见的有8位(256色)、16位(65K色)、24位(真彩色)和32位(带透明度的真彩色)。 6. `biCompression`:此字段标识图像数据的压缩类型,可以是BI_RGB(无压缩)或其他压缩算法,如BI_RLE8、BI_RLE4等。 7. `biSizeImage`:位图的实际大小,以字节为单位。根据压缩方式,这可能不同于位图宽度和高度简单相乘的结果。 8. `biXPelsPerMeter` 和 `biYPelsPerMeter`:分别表示设备的水平和垂直分辨率,用于定义图像的打印或显示质量。 9. `biClrUsed`:如果位图使用了颜色表,这个字段表示实际使用的颜色数量。如果为0,表示颜色数等于由`biBitCount`决定的值。 10. `biClrImportant`:表示显示位图时需要的最小颜色数。如果0,表示所有颜色都重要。 这份资料以PPT的形式,共14章、442页,覆盖了从VC++基础到MFC应用的多个方面,包括Visual C++集成开发环境的介绍,MFC程序框架,C++语言基础,面向对象编程,菜单、工具栏和状态栏的使用,对话框,控件,MFC常用类,多媒体编程,DLL的开发与调用,文档和视图,数据库编程,多线程,以及WinSock网络通信开发。特别适合那些想学习MFC但不知从何入手的初学者,提供了一个全面且深入的学习路径。
2014-04-09 上传
用MFC 显示PPT //启动 PowerPoint: void CMainFrame::OnPowerpointStartpowerpoint() { /// Check if the IDispatch connection exists with PowerPoint, // if not create one. if (m_ppt.m_lpDispatch == NULL) { // Create IDispatch connection to PowerPoint. m_ppt.CreateDispatch("PowerPoint.Application"); }; // Bring the PowerPoint application to the front. m_ppt.Activate(); } void CMainFrame::OnPowerpointStartslideshow() { _Presentation oPresentation; SlideShowSettings oShow; // Attach to the Active Presentation. oPresentation.AttachDispatch(m_ppt.GetActivePresentation()); // Attach to the slide-show settings. oShow.AttachDispatch(oPresentation.GetSlideShowSettings()); // Run the slide show. oShow.Run(); } // 创建幻灯片: void CMainFrame::OnPowerpointCreateslide() { // Connect to the active presentation. There is no error trapping. // If the active presentation the framework traps // the error and displays a message box. _Presentation ActivePresentation(m_ppt.GetActivePresentation()); // Connect to the slides collection. Slides oSlides(ActivePresentation.GetSlides()); // This constant is defined in the PowerPoint Object model. // You can use the Object Browser, with Visual Basic Editor // (VBE), to look up the different constant values. const ppLayoutTitleOnly = 11; // Add a new slide to the presentation. This code adds the new // slide to the end of the presentation. oSlides.Add(oSlides.GetCount() + 1l, ppLayoutTitleOnly); } // 创建演示文稿: void CMainFrame::OnPowerpointCreatepresentation() { Presentations PresCollection; // Make sure there is a dispatch pointer for PowerPoint. if(m_ppt.m_lpDispatch == NULL) { // Display a message indicating that PowerPoint is not running. MessageBox("PowerPoint is not running.", "Start PowerPoint"); } else { // Bring PowerPoint to the front. m_ppt.Activate(); // Attach the presentations collection to the PresCollection // variable. PresCollection.AttachDispatch(m_ppt.GetPresentations()); // Create a new presentation. PresCollection.Add(1);