Language:EN
Pages: 5
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
first message parameterlparam lparam second messag

First message parameterlparam lparam second message parameter

4 Isometric Game Programming with DirectX 7.0

No matter what your personal feelings about the Windows OS, the fact that it is truly easy to use—its main selling point—is undeniable. This is a double-edged sword, of course. Because so much work went into making the OS easy to use, it is proportionally more difficult to program for. DOS, which was very hard to use, was easy to program for. So it goes.

Luckily, there is only a small amount of Windows-specific stuff that you absolutely have to know in order to program for Windows (and there was much rejoicing). This chapter is here to get you up to speed on those things. The programs we’ll be doing won’t be very complicated or functional, but they will provide a good base on which to get flying!

Introduction to WIN32 Programming 5

With a a fast-enough processor, the computer can do some of one thing and some of another thing, switching back and forth between the two, and you, as a human being, cannot tell whether the tasks are being done simultaneously or not. Neat, huh?

Switch to another application The computer walking

WALK.EXE

Executes for a time slice

You could also have a program called
WalkAndChewGum.exe, and it would create one thread that walks and another that chews gum. The computer again would switch between the two
threads, and the same effect is achieved within a sin-gle program.

The apparently simultaneous effect is based on idle time in the computer. As you add more and more applications and threads within those applications, more of the computer’s time is taken up. At some

6 Isometric Game Programming with DirectX 7.0

point, depending on your processor (how many you have, how fast they are), you reach a threshold where the simultaneous appearance is gone, and you start to notice some lag in the applications. So how does this concern us as game programmers?

Much of what we do in Windows involves handles—most notably, window handles (HWND). So what are these handles all about, anyway?

Handles are pointers to pointers—sort of. They are a pre-OOP (object-oriented programming) method of keeping track of data in a completely dynamic operating system (namely, Windows). At any moment, an application’s code can be moved from regular memory into virtual memory (that is, saved to disk in a tem-porary swap file). A handle ensures that no matter where something is, you can still talk to it by passing the handle into a function. Keeping track otherwise would be a nightmare!

• HANDLE is what you will use to access files; I’ll get to it in Chapter 8. A normal old HANDLE is pretty generic.

There will be more handle types in the next chapter, so consider yourself warned. They are used quite a bit with graphical objects in Windows.

Figure 1.2

The User

Interacts with

Input Device
(usually Keyboard or mouse)
Simplified schematic of the
inner workings of Windows

Awaits being read by

Application
Message
Pump

TeamLRN

hwnd The window handle corresponding to the window that is to

receive the message

Each WM_ message has a different meaning for lParam.

time Time when this message occurred

any, it must either process them or pass them along to the default processing function. If this is not done,

the messages will just pile up, your application will stop responding, and you might lock up the system.

WPARAM wParam, // first message parameter

LPARAM lParam // second message parameter

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Miss June Armstrong

PageId: DOC990F1B2