Re: dynamic window updating from a worker thread

Tech-Archive recommends: Fix windows errors by optimizing your registry



"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


.



Relevant Pages

  • Re: dynamic window updating from a worker thread
    ... there is little difference to ordinary drawing a window. ... DWORD YourThreadFunction (HWND hImageWindow) ... // paint the dialog ...
    (microsoft.public.vc.language)
  • Re: FreeBSD for a high school class? (long)
    ... the standard FreeBSD for a lot of years. ... a window manager on the FreeBSD systems. ... render HTML and execute Javascript identically). ... Am I too lean on the specs for the free AMD/Intel boxes we ...
    (freebsd-questions)
  • Re: should I go back to tables in HTML instead of CSS?
    ... used floating boxes for the top row. ... It doesn't take too much shrinkage for ... window horizontally and you still have 3 columns staying side by side. ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Photo viewers
    ... my time closing those dialogue boxes that always seem scattered all ... over the screen using up valuable window space. ... Photoshop absolutely remembers ... the positions of each palette each time you restart it. ...
    (comp.sys.mac.system)
  • Re: Maximize box with all windows
    ... You need to resize the boxes as appropriate. ... Create an OnSize handler and resize the controls there. ... Use GetWindowRect to get the window sizes, and don't assume you know what they are. ... It also lengthens the edit control c_Filename to fit all the way ...
    (microsoft.public.vc.mfc)