| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | OS/2 Object Window? |
JF> I am attempting to learn to program under OS/2 and
JF> well still need to do alot of reading. Can anyone
JF> explain what an Object Window is, and perhaps provide
JF> a scenario as to why one is created ?
An object window is a window that will never be seen. Instead of having
HWND_DESKTOP as the ultimate parent -- as all visible windows do -- an
object window has HWND_OBJECT as the parent.
Because PM uses one special queue for mouse, keyboard and focus change
messages, it is important that this queue always remain responsive. If a
PM program does not return instantly from one of these messages, the user
can not do much (PM is not "hung" as some would say -- pm
programs will continue to run and update their windows; the problem is
that the user has been locked out of the system).
Since an object window (in a different thread, with a different queue)
never receives any of these messages (mouse, keyboard, focus change), it is
incapable of locking the user out. Therefore, you can take your bloody
time processing a message in this "worker thread".
Messages are usually Posted (not Sent) from your main thread, which DOES
create windows the user can see.
Actually creating an Object window is an unnecessary step. All you really
need to so is create a queue and use WinPostQueueMsg() to communicate with
it, instead of WinPostMsg(). I actually prefer this method, since it
removes one layer, and removes any possibility of calling WinSendMsg(),
which defeats the whole purpose of the worker thread.
A specific circumstance:
You should never, ever, ever call DosOpen (and therefore open(),
fopen(), etc) during a PM message. If the file is on
a floppy, cdrom, or network, unexpected delays will cause
the PM queue to get stuck.
For an example of a bad program, make sure you don't have
a disk in A:, and go to your desktop and right-click on
your A: icon (to bring up its pop-up menu). The system will
be stuck while it tries to read from the disk that isn't
in drive A:. (later: I just tried this with FP17, and it
looks like they finally fixed this one).
--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 517 628 713/888 800/1 @PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.