windows编程模式------外文翻译.doc

约15页DOC格式手机打开展开

windows编程模式------外文翻译,no matter which development tools you use, programming for windows is different from old-style batch-oriented or transaction-oriented programming. to get starte...
编号:16-213311大小:51.00K
分类: 论文>外文翻译

内容介绍

此文档由会员 wanli1988go 发布

No matter which development tools you use, programming for Windows is different from old-style batch-oriented or transaction-oriented programming. To get started, you need to know some Windows fundamentals. As a frame of reference, we'll use the well-known MS-DOS programming model. Even if you don't currently program for plain MS-DOS, you're probably familiar with it.
Message Processing
When you write an MS-DOS-based application in C, the only absolute requirement is a function named main. The operating system calls main when the user runs the program, and from that point on, you can use any programming structure you want. If your program needs to get user keystrokes or otherwise use operating system services, it calls an appropriate function, such as getchar, or perhaps uses a character-based windowing library.
When the Windows operating system launches a program, it calls the program's WinMain function. Somewhere your application must have WinMain, which performs some specific tasks. Its most important task is creating the application's main window, which must have its own code to process messages that Windows sends it. An essential difference between a program written for MS-DOS and a program written for Windows is that an MS-DOS-based program calls the operating system to get user input, but a Windows-based program processes user input via messages from the operating system.
Windows编程模式
无论使用哪一种开发工具,在Windows环境下编成都不同于旧式的面向批处理或者面向事务处理的编程。在开始前,需要了解一些Windows基本知识。作为参考。我们将使用众所周知的MS-DOS程序,也可能熟悉它。
消息处理
当用C语言编写基于MS-DOS的应用程序时,唯一绝对需要的是一个名为main的函数。当用户运行程序时,操作系统调用main,并且,从这里开始,可以使用任何需要的编程结构。如果程序需要获得用户键击或者使用操作系统服务,他便调用适当的函数,例如getchar,或者可能使用一个基于字符的窗口库。