TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Dirk Stuijfzand
from: Dean Roddey
date: 1994-10-16 05:37:06
subject: Locked focus?

Thanks Dirk for your msg about Locked focus?, on 13 10-13-1994

You need to do the calculations on another thread. If you don't
need to watch it as it happens, then it is easy. You just spin off
a thread who builds a new data structure for you and posts a
message to your window when it is done. If you need to watch it as
you go, then you will need to periodically post messages to your
message queue to tell any display windows referencing the data to
update themselves. Of course you have to control access to the
data via a semaphore so that the two threads don't step on each
other's toes.

Another option is to create a memory based bitmap and make it the
drawing surface of a presentation space. The background thread can
draw directly to this PS, which will effectively keep a memory
copy of the image. The foreground thread then just needs to do a
bitblit from the memory bitmap whenever it gets a WM_PAINT event.
This is a very nice way to work, but it means that you pay for the
bitmapped representation of the image in terms of memory. But,
effectively, you probably have to do this anyway. Otherwise, you
will have to regenerate the image every time that you get a
WM_PAINT. Even in this scenario, make sure that you use a semaphore
to keep the two threads from manipulating the shadow bitmap PS at
the same time.

___
 X KWQ/2 1.2b X Look Ma, I'm a *Beta Tester*: KWQ Mail/2 for OS/2 v2.0!

--- Maximus/2 2.01wb

* Origin: Fernwood - your source for OS/2 files! (1:141/209)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 949 712/353 623 713/888 800/1
@PATH: 141/209 270/101 396/1 3615/50 229/2 12/2442 711/409 54/54 711/808 809
@PATH: 711/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™.