win32编程中使用两次Bitblt函数显示不了图片

qq_35470791 2016-08-18 12:16:48

HDC hdc, hdcmem, hdcm;
HBITMAP BackGround;
BITMAP bm;
/*******中间省略一堆******/
BackGround = LoadBitmap(hinstance, TEXT("BKG")); //BKG是我的背景图
GetObject(BG.hbm, sizeof(BITMAP), &bm);
上面是共同部分。

当代码是这样时:
SelectObject(hdcmem, BG.hbm);
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcmem, 0, 0, SRCCOPY);
这样可以显示图片,
可是当代码是这样时:
SelectObject(hdcm, BG.hbm);
BitBlt(hdcmem, 0, 0, bm.bmWidth, bm.bmHeight, hdcm, 0, 0, SRCCOPY);
BitBlt(hdc, 0,0, bm.bmWidth, bm.bmHeight, hdcmem, 0,0, SRCCOPY);
就显示不了图片

后者代码都是参考网络资源的 发现别人这样做都可以 为什么我这样不可以...
为什么
...全文
686 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_35470791 2016-08-19
  • 打赏
  • 举报
回复
引用 5 楼 qq_35578084 的回复:
//初始化 HBITMAP hBGbmp; HDC hdc; HDC hMemDC; HDC hBGDC; hdc=GetDC(hWnd);//hWnd是窗口句柄 hMemDC=CreateCompatibleDC(hdc); hBGDC=CreateCompatibleDC(hdc); hBGbmp=(HBITMAP)LoadImage(NULL, L"BKG", IMAGE_BITMAP, 0,0, LR_LOADFROMFILE|LR_DEFAULTSIZE); SelectObject(hBGDC,hBGbmp); DeleteObject(hBGbmp); //画图开始 BitBlt(hMemDC, 0,0, W,H, hBGDC, 0,0, SRCCOPY); BitBlt(hdc, 0,0, W,H, hMemDC, 0,0, SRCCOPY); //释放资源 DeleteDC(hMemDC); DeleteDC(hBGDC); ReleaseDC(hdc,hWnd);
对就是这样两次BitBlt贴图 但是发现我这样不行
赵4老师 2016-08-19
  • 打赏
  • 举报
回复
Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError.
qq_35578084 2016-08-19
  • 打赏
  • 举报
回复
楼主根本没用CreateCompatibleDC来创建兼容内存DC,所以BitBlt会无法复制
赵4老师 2016-08-18
  • 打赏
  • 举报
回复
BitBlt The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context. BOOL BitBlt( HDC hdcDest, // handle to destination device context int nXDest, // x-coordinate of destination rectangle's upper-left // corner int nYDest, // y-coordinate of destination rectangle's upper-left // corner int nWidth, // width of destination rectangle int nHeight, // height of destination rectangle HDC hdcSrc, // handle to source device context int nXSrc, // x-coordinate of source rectangle's upper-left // corner int nYSrc, // y-coordinate of source rectangle's upper-left // corner DWORD dwRop // raster operation code ); Parameters hdcDest Handle to the destination device context. nXDest Specifies the logical x-coordinate of the upper-left corner of the destination rectangle. nYDest Specifies the logical y-coordinate of the upper-left corner of the destination rectangle. nWidth Specifies the logical width of the source and destination rectangles. nHeight Specifies the logical height of the source and the destination rectangles. hdcSrc Handle to the source device context. nXSrc Specifies the logical x-coordinate of the upper-left corner of the source rectangle. nYSrc Specifies the logical y-coordinate of the upper-left corner of the source rectangle. dwRop Specifies a raster-operation code. These codes define how the color data for the source rectangle is to be combined with the color data for the destination rectangle to achieve the final color. The following list shows some common raster operation codes: Value Description BLACKNESS Fills the destination rectangle using the color associated with index 0 in the physical palette. (This color is black for the default physical palette.) DSTINVERT Inverts the destination rectangle. MERGECOPY Merges the colors of the source rectangle with the specified pattern by using the Boolean AND operator. MERGEPAINT Merges the colors of the inverted source rectangle with the colors of the destination rectangle by using the Boolean OR operator. NOTSRCCOPY Copies the inverted source rectangle to the destination. NOTSRCERASE Combines the colors of the source and destination rectangles by using the Boolean OR operator and then inverts the resultant color. PATCOPY Copies the specified pattern into the destination bitmap. PATINVERT Combines the colors of the specified pattern with the colors of the destination rectangle by using the Boolean XOR operator. PATPAINT Combines the colors of the pattern with the colors of the inverted source rectangle by using the Boolean OR operator. The result of this operation is combined with the colors of the destination rectangle by using the Boolean OR operator. SRCAND Combines the colors of the source and destination rectangles by using the Boolean AND operator. SRCCOPY Copies the source rectangle directly to the destination rectangle. SRCERASE Combines the inverted colors of the destination rectangle with the colors of the source rectangle by using the Boolean AND operator. SRCINVERT Combines the colors of the source and destination rectangles by using the Boolean XOR operator. SRCPAINT Combines the colors of the source and destination rectangles by using the Boolean OR operator. WHITENESS Fills the destination rectangle using the color associated with index 1 in the physical palette. (This color is white for the default physical palette.) Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError. Remarks If a rotation or shear transformation is in effect in the source device context, BitBlt returns an error. If other transformations exist in the source device context (and a matching transformation is not in effect in the destination device context), the rectangle in the destination device context is stretched, compressed, or rotated as necessary. If the color formats of the source and destination device contexts do not match, the BitBlt function converts the source color format to match the destination format. When an enhanced metafile is being recorded, an error occurs if the source device context identifies an enhanced-metafile device context. Not all devices support the BitBlt function. For more information, see the RC_BITBLT raster capability entry in the GetDeviceCaps function as well as the following functions: MaskBlt, PlgBlt, StretchBlt. BitBlt returns an error if the source and destination device contexts represent different devices. ICM: No color management is performed when blits occur. Windows CE: In Windows CE version 1.0, the dwRop parameter can only be assigned the following values: SRCCOPY SRCAND SRCPAINT SRCINVERT In Windows CE version 2.0, the dwRop parameter can be any ROP3. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. See Also Bitmaps Overview, Bitmap Functions
qq_35578084 2016-08-18
  • 打赏
  • 举报
回复
//初始化 HBITMAP hBGbmp; HDC hdc; HDC hMemDC; HDC hBGDC; hdc=GetDC(hWnd);//hWnd是窗口句柄 hMemDC=CreateCompatibleDC(hdc); hBGDC=CreateCompatibleDC(hdc); hBGbmp=(HBITMAP)LoadImage(NULL, L"BKG", IMAGE_BITMAP, 0,0, LR_LOADFROMFILE|LR_DEFAULTSIZE); SelectObject(hBGDC,hBGbmp); DeleteObject(hBGbmp); //画图开始 BitBlt(hMemDC, 0,0, W,H, hBGDC, 0,0, SRCCOPY); BitBlt(hdc, 0,0, W,H, hMemDC, 0,0, SRCCOPY); //释放资源 DeleteDC(hMemDC); DeleteDC(hBGDC); ReleaseDC(hdc,hWnd);
qq_35578084 2016-08-18
  • 打赏
  • 举报
回复
注意函数前的“以带有颜色区分的格式查看复制到剪贴板” 这个跟函数没关系,是复制的时候出现的。
qq_35578084 2016-08-18
  • 打赏
  • 举报
回复
翻译过来是这样:将源设备上下文的位图到此当前设备上下文。 以带有颜色区分的格式查看复制到剪贴板BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop ); BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop ); 参数 -------------------------------------------------------------------------------- x 指定目标矩形的左上角的逻辑x坐标。 y 指定目标矩形的左上角的逻辑y坐标。 nWidth 指定宽度(以逻辑单位)的目标矩形和源位图。 nHeight 指定高度(以逻辑单位)目标矩形和源位图。 pSrcDC 设置为标识设备上下文位图要复制的 CDC 对象的指针。 它必须是 NULL,如果 dwRop 指定不包括一个源的光栅操作。 xSrc 指定源位图的左上角的逻辑x坐标。 ySrc 指定源位图的左上角的逻辑y坐标。 dwRop 指定要执行的光栅操作。 光栅操作代码定义GDI如何组合在涉及一个当前画笔、一个可能的源位图和一个目标位图的输出操作的颜色。 为光栅操作代码的列表 dwRop 及其说明的参见。Windows SDK 的 BitBlt 有关完整的光栅操作代码,请参见。Windows SDK的 有关光栅操作代码。 返回值 -------------------------------------------------------------------------------- 非零,如果函数运行成功;否则为0。 备注 -------------------------------------------------------------------------------- 应用程序可以对齐窗口或工作区(以字节为单位)界确保 BitBlt 操作在字节对齐的矩形发生。 (设置 CS_BYTEALIGNWINDOW 或 CS_BYTEALIGNCLIENT 标志,在窗口类别的注册。) 在字节对齐的矩形 BitBlt 操作比在不是对齐的字节的矩形 BitBlt 操作大量express。 如果您要对设备上下文指定选件类样式(如字节对齐,则必须注册窗口选件类而不是依赖于Microsoft基础选件类执行断点。 使用全局函数 AfxRegisterWndClass。 通过使用目标设备上下文,使用源设备上下文,GDI转换 nWidth 和 nHeight,一次一次。 如果发生的区域不匹配,GDI使用Windows StretchBlt 功能根据需要压缩或拉伸源位图。 如果目标、源和模式位图没有相同颜色的格式, BitBlt 函数将源和模式位图匹配为目标。 目标位图的前景色和背景色用于转换。 当 BitBlt 函数转换为单色位图转换为颜色时,它将空白位(1)为与黑色(0位)对前景色。 使用目标设备上下文的前景色和背景色。 若要将颜色为将照片, BitBlt 设置为与背景色设置为白色的像素和设置其他像素黑色。 BitBlt 使用彩色设备上下文的前景色和背景色从彩色转换为将图片。 注意不是所有的设备上下文支持 BitBlt。 若要检查特定设备上下文是否支持 BitBlt,请使用 GetDeviceCaps 成员函数并指定 RASTERCAPS 索引。 示例 -------------------------------------------------------------------------------- 为 CDC::CreateCompatibleDC参见示例。 要求 -------------------------------------------------------------------------------- 头文件位置: afxwin.h 请参见 -------------------------------------------------------------------------------- 参考 CDC 类 层次结构图 CDC::GetDeviceCaps CDC::PatBlt CDC::SetTextColor CDC::StretchBlt StretchDIBits BitBlt
qq_35470791 2016-08-18
  • 打赏
  • 举报
回复
引用 1 楼 zhao4zhong1 的回复:
BitBlt The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context. BOOL BitBlt( HDC hdcDest, // handle to destination device context int nXDest, // x-coordinate of destination rectangle's upper-left // corner int nYDest, // y-coordinate of destination rectangle's upper-left // corner int nWidth, // width of destination rectangle int nHeight, // height of destination rectangle HDC hdcSrc, // handle to source device context int nXSrc, // x-coordinate of source rectangle's upper-left // corner int nYSrc, // y-coordinate of source rectangle's upper-left // corner DWORD dwRop // raster operation code ); Parameters hdcDest Handle to the destination device context. nXDest Specifies the logical x-coordinate of the upper-left corner of the destination rectangle. nYDest Specifies the logical y-coordinate of the upper-left corner of the destination rectangle. nWidth Specifies the logical width of the source and destination rectangles. nHeight Specifies the logical height of the source and the destination rectangles. hdcSrc Handle to the source device context. nXSrc Specifies the logical x-coordinate of the upper-left corner of the source rectangle. nYSrc Specifies the logical y-coordinate of the upper-left corner of the source rectangle. dwRop Specifies a raster-operation code. These codes define how the color data for the source rectangle is to be combined with the color data for the destination rectangle to achieve the final color. The following list shows some common raster operation codes: Value Description BLACKNESS Fills the destination rectangle using the color associated with index 0 in the physical palette. (This color is black for the default physical palette.) DSTINVERT Inverts the destination rectangle. MERGECOPY Merges the colors of the source rectangle with the specified pattern by using the Boolean AND operator. MERGEPAINT Merges the colors of the inverted source rectangle with the colors of the destination rectangle by using the Boolean OR operator. NOTSRCCOPY Copies the inverted source rectangle to the destination. NOTSRCERASE Combines the colors of the source and destination rectangles by using the Boolean OR operator and then inverts the resultant color. PATCOPY Copies the specified pattern into the destination bitmap. PATINVERT Combines the colors of the specified pattern with the colors of the destination rectangle by using the Boolean XOR operator. PATPAINT Combines the colors of the pattern with the colors of the inverted source rectangle by using the Boolean OR operator. The result of this operation is combined with the colors of the destination rectangle by using the Boolean OR operator. SRCAND Combines the colors of the source and destination rectangles by using the Boolean AND operator. SRCCOPY Copies the source rectangle directly to the destination rectangle. SRCERASE Combines the inverted colors of the destination rectangle with the colors of the source rectangle by using the Boolean AND operator. SRCINVERT Combines the colors of the source and destination rectangles by using the Boolean XOR operator. SRCPAINT Combines the colors of the source and destination rectangles by using the Boolean OR operator. WHITENESS Fills the destination rectangle using the color associated with index 1 in the physical palette. (This color is white for the default physical palette.) Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError. Remarks If a rotation or shear transformation is in effect in the source device context, BitBlt returns an error. If other transformations exist in the source device context (and a matching transformation is not in effect in the destination device context), the rectangle in the destination device context is stretched, compressed, or rotated as necessary. If the color formats of the source and destination device contexts do not match, the BitBlt function converts the source color format to match the destination format. When an enhanced metafile is being recorded, an error occurs if the source device context identifies an enhanced-metafile device context. Not all devices support the BitBlt function. For more information, see the RC_BITBLT raster capability entry in the GetDeviceCaps function as well as the following functions: MaskBlt, PlgBlt, StretchBlt. BitBlt returns an error if the source and destination device contexts represent different devices. ICM: No color management is performed when blits occur. Windows CE: In Windows CE version 1.0, the dwRop parameter can only be assigned the following values: SRCCOPY SRCAND SRCPAINT SRCINVERT In Windows CE version 2.0, the dwRop parameter can be any ROP3. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. See Also Bitmaps Overview, Bitmap Functions
还是不懂...
第1 章 Delphi 集成开发环境..........1 1.1 Delphi 6.0 简介............................................ 1 1.2 Delphi 可视化开发环境简介...................... 2 1.2.1 对象编辑器(Object Inspector)....3 1.2.2 工程管理器(Project Manager)....5 1.2.3 代码编辑器......................................5 1.2.4 CPU 观察窗口.................................6 1.2.5 对象浏览器......................................7 1.3.1 编程环境设置..................................7 1.3.2 自定义工具栏..................................9 1.3.3 编辑环境设置................................10 1.3.4 工程设置........................................11 1.4 一个简单的Delphi 程序........................... 12 1.5 本章小结.................................................... 13 第2 章 Object Pascal 语言..........14 2.1 Object Pascal 语言基础............................. 14 2.1.1 Object Pascal 入门.........................14 2.1.2 注释语句........................................15 2.1.3 标识符(Identifier) .....................16 2.1.4 保留字(Reserved Word)和指令字 (Directive) ..........................................16 2.1.5 数据类型........................................17 2.1.6 运算符(Operators)..........................27 2.1.7 语句................................................31 2.1.8 过程与函数....................................35 2.1.9 作用范围........................................42 2.1.10 规范化命名..................................43 2.2 Object Pascal 语言的面向对象技术......... 43 2.2.1 对象和类的概念............................44 2.2.2 Object Pascal 类的定义.............46 2.2.3 方法...............................................51 2.2.4 多态性...........................................54 2.2.5 类运算符.......................................57 2.2.6 类方法和类引用............................58 2.2.7 单元文件.......................................61 2.2.8 TObject:所有对象的祖先...........63 2.3 结构化异常处理........................................64 2.3.1 try...except 语句和try...finally 语句 ................................................................65 2.3.2 raise 语句.......................................67 2.3.3 异常类...........................................67 2.4 方法与技巧................................................67 2.4.1 设置代码模板................................67 2.4.2 设置提示信息................................68 2.5 本章小结....................................................69 第3 章 常见组件编程............... 70 3.1 窗体和组件................................................70 3.1.1 概述...............................................70 3.1.2 窗体(Form)...............................71 3.1.3 组件(Component) .....................74 3.1.4 组件的使用....................................75 3.2 文本输入类组件........................................78 3.2.1 TEdit 组件.....................................78 3.2.2 TMemo 组件..................................78 3.2.3 TMaskEdit 组件.............................78 3.2.4 TRichEdit.......................................79 3.2.5 TLabel 组件...................................79 ·ii· 3.2.6 TStaticText .....................................79 3.2.7 几点说明..........................................80 3.3 按钮类组件................................................ 80 3.3.1 TButton 组件..................................81 3.3.2 TBitBtn 组件..................................81 3.3.3 TSpeedButton 组件........................81 3.3.4 TCheckBox 组件组件....................81 3.3.5 TRadioButton 组件........................82 3.4 列表类组件................................................ 82 3.4.1 TListBox 组件................................82 3.4.2 TComboBox 组件..........................83 3.4.3 TTreeView 组件.............................83 3.4.4 TListView 组件..............................84 3.4.5 TImageList 组件............................85 3.4.6 TCheckListBox 组件......................85 3.4.7 TDateTimePicker 组件...................85 3.5 表格类组件................................................ 85 3.5.1 TDrawGrid 组件............................85 3.5.2 TStringGrid 组件...........................86 3.5.3 TDBGrid 组件................................86 3.6 刻度和进度类组件.................................... 86 3.6.1 TProgressBar 组件.........................87 3.6.2 TStatusBar......................................87 3.7 分组组件.................................................... 87 3.7.1 TGroupBox 组件............................87 3.7.2 TRadioGroup 组件.........................87 3.7.3 TPanel 组件....................................87 3.7.4 TScrollBox 组件............................87 3.7.5 TTabControl 组件..........................88 3.7.6 TPageControl 组件.........................88 3.7.7 THeaderControl 组件.....................88 3.7.8 容器组件组件................................89 3.8 特殊输入组件............................................ 89 3.8.1 TScrollBar 组件.............................89 3.8.2 TTrackBar 组件..............................90 3.8.3 TUpDown 组件..............................91 3.8.4 THotKey 组件................................91 3.9 菜单的使用................................................ 91 3.9.1 主菜单............................................92 3.9.2 鼠标右键弹出式菜单....................93 3.9.3 使用菜单模板................................93 3.10 工具栏和状态栏......................................94 3.10.1 ToolBar 组件................................94 3.10.2 TCoolBar 组件.............................94 3.10.3 TControlBar 组件........................95 3.10.4 TStatusBar 组件...........................95 3.11 编程实例..................................................95 3.11.1 小型计算器..................................95 3.11.2 文本编辑器的实现....................108 3.12 本章小结................................................ 116 第4 章 键盘和鼠标事件............ 117 4.1 事件概述.................................................. 117 4.2 键盘事件处理.......................................... 117 4.2.1 常用的键盘事件.......................... 117 4.2.2 特殊的键盘事件.......................... 119 4.3 鼠标事件处理..........................................121 4.3.1 常用鼠标事件..............................121 4.3.2 拖曳事件.....................................122 4.4 本章小结..................................................124 第5 章 打印...................... 125 5.1 TPrinter 对象............................................125 5.2 打印操作常用函数..................................126 5.3 打印操作..................................................128 5.3.1 打印文本.....................................128 5.3.2 打印位图.....................................129 5.3.3 打印TMemo 组件的内容.......130 5.3.4 打印RTF 格式的文本................131 5.4 打印技巧..................................................131 5.4.1 获取显示当前打印机的分辨率..131 5.4.2 尽量不要使用AssignPrn ............131 5.4.3 用打印机的点数做度量单位......131 5.4.4 将打印结果直接送到打印机......132 5.4.5 获取默认打印机的信息..............132 5.5 本章小结..................................................132 第6 章 文件管理.................. 133 6.1 文件类型和标准过程...............................133 6.1.1 文本文件(text file).......................133 6.1.2 类型文件(typed file)....................134 ·iii· 6.1.3 无类型文件..................................136 6.1.4 文件对话框组件..........................137 6.1.5 Win3.1 相关组件.........................139 6.2 文件管理常用函数和过程.......................139 6.2.1 文件操作常用函数和过程..........139 6.2.2 目录操作常用函数和过程..........143 6.2.3 驱动器操作常用函数..................146 6.2.4 文件名操作常用函数..................148 6.3 本章小结...................................................150 第7 章 图形与图像................151 7.1 常用图形对象及简单应用.......................151 7.1.1 画布对象(TCanvas Object) ....151 7.1.2 画笔对象(TPen Object) ..........154 7.1.3 画刷对象(TBrush Object).......158 7.1.4 颜色类型(TColor type)...........160 7.1.5 其它属性......................................161 7.2 基本图形的绘制.......................................162 7.2.1 直线的绘制..................................162 7.2.2 矩形的绘制..................................163 7.2.3 椭圆的绘制..................................164 7.2.4 弧线的绘制..................................164 7.2.5 多边形的绘制..............................165 7.2.6 文本的输出..................................166 7.2.7 插入图像......................................167 7.3 画板程序开发...........................................168 7.3.1 窗体设计......................................168 7.3.2 代码设计......................................172 7.3.3 菜单代码设计..............................177 7.4 动画绘图效果...........................................182 7.5 常用图像对象...........................................185 7.5.1 TGraphics 类................................185 7.5.2 TPicture 类...................................185 7.5.3 位图对象(TBitmap Object) ....186 7.5.4 TImage 组件................................187 7.6 简单图像浏览器的实现...........................188 7.7 本章小结...................................................195 第8 章 多媒体编程技术............196 8.1 多媒体技术简介.......................................196 8.2 图像格式的处理.......................................199 8.2.1 位图.............................................199 8.2.2 JPEG 文件...................................201 8.3 特殊图像显示效果的实现.......................203 8.3.1 基本原理.....................................204 8.3.2 调用BitBlt...................................204 8.3.3 调用CopyRect.............................205 8.3.4 效果与算法实现..........................206 8.4 利用图像控件实现动画效果...................233 8.4.1 TImage 组件变换法....................234 8.4.2 TPanel 组件变换法.....................235 8.4.3 Canvas 画面变换法.....................235 8.5 音频和视频文件的播放...........................236 8.5.1 WAV 与MIDI 文件简介.............236 8.5.2 什么是AVI..................................238 8.5.3 TMediaPlayer 控件的使用..........240 8.6 媒体播放器的实现..................................243 8.7 本章小结..................................................248 第9 章 OpenGL 开发三维图形....... 250 9.1 OpenGL 的基础.......................................250 9.1.1 OpenGL 的功能...........................250 9.1.2 创建OpenGL 应用程序的方法..251 9.1.3 OpenGL 变量和函数的约定.......256 9.1.4 OpenGL 的初始化.......................257 9.2 OpenGL 基本图形的绘制........................260 9.2.1 图形的颜色..................................261 9.2.2 简单图形的绘制..........................262 9.2.3 简单二次曲面..............................268 9.3 OpenGL 的变换...................................273 9.3.1 矩阵操作过程................................273 9.3.2 投影变换.....................................274 9.3.3 几何变换矩阵..............................277 9.4 光照和纹理..............................................281 9.4.1 光照和光源过程及应用..............281 9.4.2 材质和光照模型..........................282 9.4.3 纹理.............................................284 9.5 本章小结..................................................290 第10 章 多线程应用程序........... 291 10.1 进程与线程..............................................291 10.1.1 进程和线程的概念....................291 ·iv· 10.1.2 线程调度....................................292 10.2 TThread 对象..........................................292 10.2.1 Tthread 类的属性.......................292 10.2.2 TThread 类的方法.....................293 10.2.3 TThread 类的事件.....................294 10.2.4 创建线程类................................294 10.2.5 线程的初始化操作....................295 10.2.6 实现线程对象的功能................295 10.3 线程的同步.............................................296 10.4 线程的优先级.........................................302 10.5 本章小结.................................................302 第11 章 动态链接库...............303 11.1 概述.........................................................303 11.1.1 DLL 的概念...............................303 11.1.2 静态链接与动态链接................304 11.1.3 使用DLL 的目的......................305 11.2 创建动态链接库.....................................306 11.3 使用动态链接库.....................................309 11.4 本章小结.................................................310 第12 章 Delphi 数据库的基本概念...311 12.1 数据库系统概述.....................................311 12.1.1 使用数据库................................311 12.1.2 数据库管理系统(DBMS).....311 12.1.3 数据库应用程序........................312 12.2 Delphi 的数据库特性及功能简介.........313 12.2.1 Delphi 的数据库特性................314 12.2.2 Delphi 可以访问的数据源 (DataSource) ....................................315 12.2.3 本地数据库和远程数据库........316 12.3 Delphi 数据库应用程序的体系结构.....317 12.3.1 选择合适的体系结构................318 12.3.2 可伸缩性....................................319 12.3.3 单层的数据库应用程序..........320 12.3.4 两层的数据库应用程序............320 12.3.5 多层的数据库应用程序............321 12.3.6 数据访问组件............................321 12.3.7 数据控制组件............................323 12.4 Delphi 数据库应用程序的开发方法和步骤324 12.4.1 概述............................................324 12.4.2 数据库应用程序的开发步骤....325 12.4.3 交付数据库应用程序................326 12.4.4 安装BDE ..................................327 12.4.5 安装SQL Link...........................328 12.5 本章小结................................................330 第13 章 简单数据库应用程序的创建. 331 13.1 简单的基于单表的数据库应用.............331 13.1.1 选择相关的组件........................331 13.1.2 设置组件的属性........................331 13.1.3 运行程序...................................333 13.2 利用TDBNavigator 组件创建存取程序334 13.2.1 创建应用程序窗体....................334 13.2.2 使用TDBNavigator 组件移动记录 指针......................................................335 13.2.3 定制TDBNavigator 组件..........336 13.3 创建主要──明细数据库应用程序.....336 13.3.1 一对多关系的主要──明细型数据 库应用程序...........................................337 13.3.2 一对多——多关系的数据库应用 ..............................................................338 13.4 字段对象的使用......................................339 13.4.1 字段对象的类型........................340 13.4.2 创建永久性的字段对象............340 13.4.3 字段对象的属性设置................341 13.4.4 字段对象的访问........................343 13.4.5 设定字段对象的显示格式........346 13.4.6 自定义字段以及计算字段对象的创 建..........................................................347 13.5 查询数据库的记录.............................350 13.5.1 使用GotoKey 方法查找数据记录 ..............................................................350 13.5.2 使用FindKey 方法查找数据库的 记录......................................................352 13.5.3 利用GotoNearest 和FindNearest 执 行不精确查找.......................................353 13.6 修改数据库的记录.............................354 13.6.1 Edit 方法Post 方法...................355 13.6.2 实现异常保护的try...finally 语句356 13.7 插入和删除记录....................................359 ·v· 13.7.1 逐步插入方法............................360 13.7.2 调用InsertRecord 插入记录......360 13.8 输入数据的有效性验证.........................363 13.9 本章小结.................................................366 第14 章 数据交换.................367 14.1 Windows 剪贴板及其应用.....................367 14.1.1 概述............................................367 14.1.2 TClipboard 的属性和方法.........367 14.1.3 文本与Windows 剪贴板...........370 14.1.4 图形与剪贴板............................373 14.2 数据的动态交换.....................................374 14.2.1 DDE 概述...................................374 14.2.2 DDE 客户端应用程序...............375 14.2.3 服务端应用程序........................381 14.3 对象的链接与嵌入.................................383 14.3.1 OLE 技术概述...........................383 14.3.2 TOleContainer 的属性...............385 14.3.3 TOleContainer 的方法...............387 14.4 多格式文件浏览器.................................389 14.4.1 OLE 服务器的菜单和工具栏...389 14.4.2 浏览器设计................................391 14.5 本章小结.................................................395 第15 章 应用程序的分发和包装.....396 15.1 应用程序包装技巧.................................396 15.1.1 计算机的关机或重新启动........396 15.1.2 禁止应用程序的第二实例启动397 15.1.3 封面窗口...................................398 15.1.4 椭圆窗口启动封面....................399 15.1.5 读写Windows 95 注册文件......399 15.1.6 创建应用程序组和图标............400 15.2 应用程序的分发....................................401 15.3 本章小结................................................403 第16 章 其它编程技巧............. 404 16.1 获取Windows 版本信息.......................404 16.2 获取CPU 信息.......................................405 16.3 启动屏幕保护........................................407 16.4 使窗口标题栏闪烁................................407 16.5 获取窗口标题栏的文字.....................408 16.6 使窗口背景颜色渐变.............................409 16.7 将WAV 文件做到EXE 文件里...........410 16.8 按字段为TDBGrid 着色....................... 411 16.9 使用资源文件........................................413 16.10 具有不同字体的对话框.......................417 16.11 显示旋转字体.......................................418 16.12 本章小结..............................................419 附录1 Inprise Delphi 属性、函数、事 件参考.................... 420 附录2 Delphi 站点整理............ 429 附录3 Delphi 问题集.............. 431 附录4 Delphi 编译错误信息英文 对照...................... 435

5,530

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 模式及实现
社区管理员
  • 模式及实现社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧