Re: Updating Controls from a Thread Causes Access Violation

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Scott McPhillips [MVP] (org-dot-mvps-at-scottmcp)
Date: 11/10/04


Date: Wed, 10 Nov 2004 18:40:17 -0500

Brad McMillan wrote:
> The problem is that when I run this under Debug I get an access
> violation when UpdateData(FALSE) is executed.
>
> Can anyone tell me why I'm getting an access violation here? Or, is
> there a better way of updating my static control from within the
> thread?

See FAQ 11 for "why" and FAQ 12 for "a better way."
http://www.mvps.org/vcfaq/mfc/index.htm

You also need to use AfxBeginThread instead of _beginthread.

-- 
Scott McPhillips [VC++ MVP]


Relevant Pages

  • Re: variables using ClassView and Class wizard
    ... >> generate debug info the release version can be debugged now. ... >> I am quite new to MFC programming and this problem is puzzling for me. ... > Nobody here can tell you where your access violation is occuring. ... Seems I will have to teach myself lot about debugging in MFC. ...
    (microsoft.public.vc.language)
  • Re: access violation error
    ... i am getting a access violation when i call a UDPconnect function from ... DEBUG versions in the build pane ... Error executing link.exe. ... First-chance exception in player.exe: 0xC0000005: Access ...
    (microsoft.public.vc.mfc)
  • access violation error
    ... i am getting a access violation when i call a UDPconnect function from ... DEBUG versions in the build pane ... First-chance exception in player.exe: 0xC0000005: Access ...
    (microsoft.public.vc.mfc)
  • Re: Updating Controls from a Thread Causes Access Violation
    ... Regards, ... Brad McMillan ... >> The problem is that when I run this under Debug I get an access ... >> Can anyone tell me why I'm getting an access violation here? ...
    (microsoft.public.vc.mfc)
  • First-Chance exception in dlg.exe:0xC0000005:Access Violation
    ... When i debug my programe step by step, ... "First-Chance exception in dlg.exe:0xC0000005:Access Violation.". ...
    (microsoft.public.windowsce.embedded.vc)