LA GERENCIA INTEGRADA DE ASISTENCIA SANITARIA DE SORIA
2.1. Historia y nacimiento de la Gerencia Integrada de Soria.
Other So, just how different is Windows from DOS? Below, I have references summarized some new concepts you’ll need to come to terms with. If you come across a reference to a DOS concept or programming method that you don’t understand, refer to a good DOS assembly language book.
There are a dozen or so introductory Windows programming books that could be used to compliment this book, not the least being Microsoft’s own Microsoft Windows Software Development
Kit: Reference Vol. available separately from the SDK.
You do need a book with in-depth coverage of the Windows functions, and again Microsoft’s own Microsoft Windows
Development Kit: Programmer’s Reference Vol. 2 is excellent.
S k e l e t o n
p r o g r a m The next chapter puts together a simple skeleton program, butbefore we launch into that, let’s consider some of the conceptual differences involved. The output on the screen will look different for Windows 3.x and 95. Figure 3.1 is what the skeleton will produce on the screen when running Windows 3.1.
Figure 3.1: Output of skeleton program.
This is a window, amongst other windows, with its own title, system controls, menu-bar, and demo message.
So, a major conceptual difference DOS is that our program doesn’t output to just anywhere on the screen; normally we are constrained to output only within our application’s window (or windows).
Interestingly. another major difference is the role of the operating system. -Windows a lot
much of the usual upkeep of around, and resizing.
of housekeeping and looks after the window, such as moving it
Event-driv p r o g r a m structure
q u e u e
Event-driven program structure Application queue Multitasking operating system
In fact, Windows does even more than that, allowing us to program at a more abstract level. Instead of being concerned about the precise hardware details of the I/O device that our program is dealing with, we can use the Device Independent Graphics (graphics device interface (GDI)) tools. Translation from our program to the particular device is taken care of by device drivers, and our program can have code that will work on a wide range of different devices, such as various video standards (for example, Hercules, CGA, EGA, and VGA).
Of course, the results appear on the screen, but the fundamental structure of our Windows program is different from a DOS application. The rest of the chapter is devoted to exploring those differences and the design methodology required to implement them (such as handles and messages).
A Windows program is what we call event driven. The entire structure revolves around this concept. Those of you who have done any programming at all under DOS will know how to read a character from the keyboard. In assembly language, you could use INT AH = 0. However with Windows we don’t do that. In fact INT 16h won’t even work Windows will hang.
The essence of being event driven is that for mouse, keyboard, and much other input, we don’t write code to explicitly ask for input. Instead we perform a call to Windows, requesting a message, and Windows will send any message that it thinks is relevant to our program.
Thus our program plays a very passive role, taking whatever Windows dishes out.
With Windows there is a system queue and an application queue for each application. Our program calls Windows and asks for the message at the head of our application’s queue or waits until a message is put into the queue. Returning from the call, our program then deciphers the message and acts upon it.
There are some little wrinkles in this basic explanation, but that’s the gist of it. Technically, Windows 3.x has one application queue for all applications, while Windows 95 32-bit applications have separate queues. This does not affect the programmer. It is an issue for Windows itself, with regard to scheduling of applications. Another major conceptual change is due to the multitasking nature of Windows. Unlike DOS, where everything usually stays put after it is loaded, code and data can move around. Even video-RAM cannot be treated as being at a particular address although it actually is, an application may have to output to a “logical” video
buffer located somewhere else. Consider another example: the heap. You can request local or global heap space (this is just memory that you can use for storing data), but unlike single-tasking DOS, you cannot just get its address and then write to it. The heap could be moved around by Windows (though you can freeze things also).
These shifting sands impose constraints, such as requiring handles
to access all screen and of course using selectors instead of segments for data and code manipulation.
Perhaps the newness of this is making you feel uneasy. However, the hands-on examples a bit later should alleviate that.