Re: dynamic window updating from a worker thread
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Mon, 9 Jan 2006 08:27:57 -0500
"Stuart Redmann" <DerTopper@xxxxxx> wrote in message
news:43C2145B.C02C5461@xxxxxx
>> How do I dynamically update my winapp dialog boxes from a working
>> thread
>
> Well, there is little difference to ordinary drawing a window. Your
> worker thread should look
> something like that:
>
> DWORD YourThreadFunction (HWND hImageWindow)
> {
> // paint the dialog
> HDC DC = ::GetDC (hImageWindow);
>
> // paint instructions
>
> ::ReleaseDC (hImageWindow, DC);
> }
Don't do that. Windows are thread-affine, GDI is not thread-safe. There
are very few things you can safely do to a window from a thread other
than the one that created it in the first place, and drawing is not one
of them.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- References:
- dynamic window updating from a worker thread
- From: snamvar
- Re: dynamic window updating from a worker thread
- From: Stuart Redmann
- dynamic window updating from a worker thread
- Prev by Date: Re: dynamic window updating from a worker thread
- Next by Date: Re: Fast way to allocate buffer for producer/consumer scenario
- Previous by thread: Re: dynamic window updating from a worker thread
- Next by thread: Re: dynamic window updating from a worker thread
- Index(es):
Relevant Pages
|