Chapter 1:
Getting Started
This book shows you how to write programs that run under Microsoft Windows 98,Microsoft Windows NT4.0,and Windows NT5.0.These programs are written in the C Progrmming language and use the native Windows application programming interfaces(APIs).As I'll discuss later in this chapter,this is not the only way to write programs that run under Windows.However,it is important to understand the Windows APIs regardless of what you eventually use to write your code.
As you probably know,Windows 98 is the lasted incarnation(拉丁语的表述,意思指“事实上”或者“执行上”,而法律上并未宣告。)standard for IBM-compatible personal computer built around 32-bit Intel microprocessors such as the 486 and Pentium.Windows NT is the industrial-strength version(企业版) of Windows that run on PC compatibles(PC兼容机) as well as some RISC(reduced instruction set computing<技术>)workstations. 化身,体现,具体化) of graphical operating system that has become the de facto(De facto<实际上>是一项
There are three prerequisities( for using this book.First, you should be familiar with Windows with Windows 98 from a user's perspective.You cannot hope to write applications for Windows without understanding its user interface.For this reason,I suggest that you do your program development(as well as other work)on a Windows-based machine using Windows applications(我建议你在基于Windows的机器上,采用Windows应用程序进行程序开发<或进行其它工作>).
Second, you should know C.If you don't konw C,Windows programming is probably not a good place to start.I recommend that you learn C in a character-mode environment such as that offered under the Windows 98 MS-DOS Command Prompt window(我建议你通过字符模式环境来学习C语言,比如Windows98 MS-DOS命令提示符窗口).Windows programming sometimes involves aspects of C that don't show up much in charcter-mode programming;in those cases ,I'll devote some discussion to them.But for the most part,you should have a good working familiarity with the language,particularly with C structures and pointers.Some knowledge of the standard C run-time library is helpful but not required.
Third,you should have installed on your machine a 32-bit compiler and development environment suitable for doing Windows progrmming(规划,设计).In this book,I'll be assuming that you're using Microsoft Visual C++ 6.0,which can be purchased separately or as a part of the Visual Studio 6.0 package(软件包).
That's it.I'm not going to assume that you have any experience at all progrmming for a graphical user interface such as Windows(仅此而已,你对类似Windows这样的图形用户界面是否有任何编程经验都无关紧要).
The Windows ENVIRONMENT
Windows hardly needs an introduction(对于Windows,似乎没什么必要介绍。).Yet it's easy to forget the sea change that Windows brought to office and home desktop computing(桌面计算).Windows had a bumpy(bump ride in its early years and was hardly destined to conquer the desktop market(征服桌面市场也扑朔迷离).
A History of Windows(这一小节早就过时,但为了衔接还是写出来了)
Soon after the introduction of the IBM PC in the fall of 1981,it became evident( that the predominant operating system for the PC(and compatibles<以及兼容机>)would be MS-DOS,which originally stood for(代表) Microsoft Disk System.MS-DOS was a minimal operating operating system(MS-DOS是一个非常就简单的操作系统).For the user,MS-DOS provided a command-line interface to commands such as DIR and TYPE and loaded application programs into memory for execution.For the application programmer,MS-DOS offered little more than a set of function calls for doing file input/output(I/O)(对程序员来说,MS-DOS仅仅提供了一套文件输入/输出<I/O>调用函数).For other tasks---in particular,writing text and sometimes graphics to the video display---application accessed the hardware of the PC directly(应用程序就只能和PC的硬件打交道了).
Due to memory and hardware constraints,sophisticated graphical environments were slow in coming to small computers(鉴于内存及硬件方面的限制,在小型计算机上引入复杂的图形环境步履艰难).Apple Computer offered an alternative to character-mode environments when it released its ill-fated Lisa in January 1983(1983年1月,苹果公司发布了短命的Lisa,提出了一种不同于字符模式环境的新思路),and then set a standard for graphical environments with the Macintosh in January 1984(而接踵而来的在1984年1月发布的Macintosh则为图形环境确立了明确地标准).Despite the Mac's declining market share,it is still considered the standard against which other graphical environments are measured(尽管目前Mac的市场占有率正在不断地下降,它所建立的标准仍然经常被人们用来衡量后续其他图形环境的优劣).All graphical environments,inlcuding the Macintosh and Windows,are indebted( to the pioneering work done at the Xerox Palo Alto Reserch Center(PARC)beginning in the mid-1970s.(所有的图形环境,包括Macintosh以及Windows,都应归功于施乐公司<Xerox>的帕洛阿托研究中心<PARC>在20实际70年代中期进行的开创性工作).
Windows was announced by Microsoft Corporation in November 1983(post-Lias but pre-Macintosh)and was released two years later in November 1985(微软公司在1983年11月宣布了Windows<时间在Lisa之后Macintosh之前>,两年之后1985年11月Windows 1.0正式推出发放市场).Over the next two years,Microsoft Windows 1.0 was followed by serveral updates to support the international market and to provide drivers for additional video diaplays and printers(接下来的两年内,为了支持国际市场,并为更多的显示器及打印机硬件提供驱动程序,微软连续发布了若干Windows 1.0的更新升级).
Windows 2.0 was released in November 1987.This version incorporated(incorporated several changes to the user interface.The most significant of these changes involved the use of overlapping windows(重叠窗口) rather than the "tiled(tiletail]瓷砖,用瓦片瓷砖等覆盖)" windows(平铺窗口) found in Windows 1.0.Windows 2.0 also included enhancements to the keyboard and mouse interface,particularly for menus and dialog boxes.