书 名:Programming Windows 程式开发设计指南
出版日期:2000/6/2
书 号:957-8239-73-4
原 作 者:Charles Petzold
译 者:余孟学
书本主旨:
本书是地球上最有名、最受推崇、最多人使用的程式设计用书。
内容简介:
“到 Petzold 的书中找找”——仍然是解决 Windows 程式开发各种疑难
杂症时的灵丹妙药。在第五版的《Windows 程式开发设计指南》中,作者身
为倍受敬重的 Windows Pioneer Award(Windows 开路先锋奖)得主,依据
最新版本 Windows 作业系统,以可靠的取材资料校定这一本经典之作——再
一次深入探索了 Win32 程式设计介面的根本重心。
本书特色:
基本入门:输出、输入、对话方块
对 Unicode 的介绍
图形处理:绘图、文字与字体、点阵图形与 metafile
系统核心与印表机
声音与音乐
动态连结程式库
多工与多执行绪
多重文件介面
网际网路与企业内网路程式设计
使用对象:
ALL
BookMark : 326
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 1 页
目 录
第一章 开始 ......................................................................................................................................1
WINDOWS 环境 .............................................................................................................................1
Windows 简史 ..............................................................................................................................2
Windows 方面 ..............................................................................................................................3
动态连结.......................................................................................................................................5
WINDOWS 程式设计选项 .............................................................................................................6
API 和记忆体模式 .......................................................................................................................7
语言选项.......................................................................................................................................8
程式开发环境...............................................................................................................................9
API 文件 .....................................................................................................................................10
编写第一个 WINDOWS 程式 ......................................................................................................10
文字模式(Character-Mode)模型 ..........................................................................................10
同样效果的 Windows 程式 .......................................................................................................11
表头档案.....................................................................................................................................12
程式进入点.................................................................................................................................13
MessageBox 函式.......................................................................................................................14
编译、连结和执行.....................................................................................................................15
第二章 UNICODE 简介 ................................................................................................................17
字元集简史 ....................................................................................................................................17
美国标准.....................................................................................................................................18
国际方面.....................................................................................................................................19
扩展 ASCII.................................................................................................................................20
双位元组字元集.........................................................................................................................22
Unicode 解决方案 ......................................................................................................................22
宽字元和 C....................................................................................................................................23
char 资料型态.............................................................................................................................24
宽字元.........................................................................................................................................24
宽字元程式库函式.....................................................................................................................25
维护单一原始码.........................................................................................................................27
宽字元和 WINDOWS...................................................................................................................28
Windows 表头档案类型 ............................................................................................................28
Windows 函式呼叫 ....................................................................................................................30
Windows 的字串函式 ................................................................................................................31
在 Windows 中使用 printf..........................................................................................................31
格式化讯息方块.........................................................................................................................33
本书与国际化.............................................................................................................................34
第三章 视窗和讯息 ........................................................................................................................36
自己的视窗 ....................................................................................................................................36
总体结构.....................................................................................................................................36
HELLOWIN 程式.......................................................................................................................38
通盘考量.....................................................................................................................................41
Windows 函式呼叫 ....................................................................................................................41
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 2 页
大写字母识别字.........................................................................................................................42
新的资料型态.............................................................................................................................43
代号简介.....................................................................................................................................44
匈牙利表示法.............................................................................................................................44
注册视窗类别.............................................................................................................................46
建立视窗.....................................................................................................................................51
显示视窗.....................................................................................................................................53
讯息回圈.....................................................................................................................................54
视窗讯息处理程式.....................................................................................................................55
处理讯息.....................................................................................................................................56
播放音效档案.............................................................................................................................57
WM_PAINT 讯息.......................................................................................................................57
WM_DESTROY 讯息................................................................................................................59
WINDOWS 程式设计的难点 .......................................................................................................60
别呼叫我,我会呼叫您.............................................................................................................60
伫列化讯息与非伫列化讯息.....................................................................................................61
行动迅速.....................................................................................................................................63
第四章 输出文字 ............................................................................................................................64
绘制和更新 ....................................................................................................................................64
WM_PAINT 讯息.......................................................................................................................65
有效矩形和无效矩形.................................................................................................................66
GDI 简介 ........................................................................................................................................66
装置内容.....................................................................................................................................67
取得装置内容代号:方法一.....................................................................................................67
绘图资讯结构.............................................................................................................................68
取得装置内容代号:方法二.....................................................................................................71
TextOut:细节............................................................................................................................71
系统字体.....................................................................................................................................73
字元大小.....................................................................................................................................74
文字大小:细节.........................................................................................................................75
格式化文字.................................................................................................................................76
综合使用.....................................................................................................................................77
SYSMETS1.C 视窗讯息处理程式............................................................................................84
空间不够.....................................................................................................................................85
显示区域的大小.........................................................................................................................86
卷动列 ............................................................................................................................................87
卷动列的范围和位置.................................................................................................................88
卷动列讯息.................................................................................................................................90
在 SYSMETS 中加入卷动功能.................................................................................................92
绘图程式的组织.........................................................................................................................96
建立更好的滚动 ............................................................................................................................97
卷动列资讯函式.........................................................................................................................97
卷动范围.....................................................................................................................................99
新 SYSMETS............................................................................................................................100
不用滑鼠怎么办.......................................................................................................................106
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 3 页
第五章 图形基础 ..........................................................................................................................107
GDI 的结构 ..................................................................................................................................107
GDI 原理...................................................................................................................................107
GDI 函式呼叫...........................................................................................................................109
GDI 基本图形...........................................................................................................................110
其他部分...................................................................................................................................110
装置内容 ......................................................................................................................................111
取得装置内容代号...................................................................................................................111
取得装置内容资讯...................................................................................................................113
DEVCAPS1 程式 .....................................................................................................................114
装置的大小...............................................................................................................................117
关於色彩...................................................................................................................................123
装置内容属性...........................................................................................................................124
保存装置内容...........................................................................................................................126
画点和线 ......................................................................................................................................127
设定图素...................................................................................................................................127
直线...........................................................................................................................................128
边界框函式...............................................................................................................................133
贝塞尔曲线...............................................................................................................................139
使用现有画笔(Stock Pens).................................................................................................144
画笔的建立、选择和删除.......................................................................................................145
填入空隙...................................................................................................................................148
绘图方式...................................................................................................................................148
绘制填入区域 ..............................................................................................................................150
Polygon 函式和多边形填入方式 ............................................................................................151
用画刷填入内部.......................................................................................................................155
GDI 映射方式 ..............................................................................................................................157
装置座标和逻辑座标...............................................................................................................159
装置座标系...............................................................................................................................159
视埠和视窗...............................................................................................................................160
处理 MM_TEXT......................................................................................................................162
「度量」映射方式...................................................................................................................164
「自行决定」的映射方式.......................................................................................................168
MM_ISOTROPIC 映射方式....................................................................................................168
MM_ANISOTROPIC:根据需要放缩图像 ...........................................................................171
WHATSIZE 程式......................................................................................................................172
矩形、区域和剪裁 ......................................................................................................................176
矩形函式...................................................................................................................................176
随机矩形...................................................................................................................................177
建立和绘制剪裁区域...............................................................................................................181
矩形与区域的剪裁...................................................................................................................183
CLOVER 程式..........................................................................................................................184
第六章 键盘 ..................................................................................................................................189
键盘基础 ......................................................................................................................................189
忽略键盘...................................................................................................................................189
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 4 页
谁获得了焦点...........................................................................................................................190
伫列和同步...............................................................................................................................191
按键和字元...............................................................................................................................191
按键讯息 ......................................................................................................................................192
系统按键与非系统按键...........................................................................................................192
虚拟键码...................................................................................................................................193
lParam 资讯 ..............................................................................................................................197
重复计数...................................................................................................................................197
OEM 扫描码.............................................................................................................................197
扩充键旗标...............................................................................................................................198
内容代码...................................................................................................................................198
键的先前状态...........................................................................................................................198
转换状态...................................................................................................................................198
位移状态...................................................................................................................................198
使用按键讯息...........................................................................................................................199
为 SYSMETS 加上键盘处理功能...........................................................................................200
字元讯息 ......................................................................................................................................208
四类字元讯息...........................................................................................................................208
讯息顺序...................................................................................................................................209
处理控制字元...........................................................................................................................211
死字元讯息...............................................................................................................................211
键盘讯息和字元集 ......................................................................................................................212
KEYVIEW1 程式.....................................................................................................................212
外语键盘问题...........................................................................................................................218
字元集和字体 ..............................................................................................................................220
Unicode 怎么样? ....................................................................................................................231
TrueType 和大字体 ..................................................................................................................232
插入符号(不是游标) ..............................................................................................................239
插入符号函式...........................................................................................................................239
TYPER 程式.............................................................................................................................240
第三章 滑鼠 ..................................................................................................................................248
滑鼠基础 ......................................................................................................................................248
一些简单的定义.......................................................................................................................249
滑鼠(Mouse)的复数 .................................................................................................................250
显示区域滑鼠讯息 ......................................................................................................................250
简单的滑鼠处理:一个例子...................................................................................................252
处理 Shift 键.............................................................................................................................256
双击滑鼠按键...........................................................................................................................257
非显示区域滑鼠讯息 ..................................................................................................................258
命中测试讯息...........................................................................................................................259
从讯息产生讯息.......................................................................................................................260
程式中的命中测试 ......................................................................................................................261
一个假想的例子.......................................................................................................................261
范例程式...................................................................................................................................262
使用键盘模拟滑鼠...................................................................................................................265