windows編程模式------外文翻譯.doc
約15頁DOC格式手機(jī)打開展開
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...
內(nèi)容介紹
此文檔由會(huì)員 wanli1988go 發(fā)布
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編程模式
無論使用哪一種開發(fā)工具,在Windows環(huán)境下編成都不同于舊式的面向批處理或者面向事務(wù)處理的編程。在開始前,需要了解一些Windows基本知識。作為參考。我們將使用眾所周知的MS-DOS程序,也可能熟悉它。
消息處理
當(dāng)用C語言編寫基于MS-DOS的應(yīng)用程序時(shí),唯一絕對需要的是一個(gè)名為main的函數(shù)。當(dāng)用戶運(yùn)行程序時(shí),操作系統(tǒng)調(diào)用main,并且,從這里開始,可以使用任何需要的編程結(jié)構(gòu)。如果程序需要獲得用戶鍵擊或者使用操作系統(tǒng)服務(wù),他便調(diào)用適當(dāng)?shù)暮瘮?shù),例如getchar,或者可能使用一個(gè)基于字符的窗口庫。
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編程模式
無論使用哪一種開發(fā)工具,在Windows環(huán)境下編成都不同于舊式的面向批處理或者面向事務(wù)處理的編程。在開始前,需要了解一些Windows基本知識。作為參考。我們將使用眾所周知的MS-DOS程序,也可能熟悉它。
消息處理
當(dāng)用C語言編寫基于MS-DOS的應(yīng)用程序時(shí),唯一絕對需要的是一個(gè)名為main的函數(shù)。當(dāng)用戶運(yùn)行程序時(shí),操作系統(tǒng)調(diào)用main,并且,從這里開始,可以使用任何需要的編程結(jié)構(gòu)。如果程序需要獲得用戶鍵擊或者使用操作系統(tǒng)服務(wù),他便調(diào)用適當(dāng)?shù)暮瘮?shù),例如getchar,或者可能使用一個(gè)基于字符的窗口庫。