-
July 6th, 2018, 02:17 AM
#1
access violation reading location 0x00000000
hello..
i am running a thread.but when i try to print anything edit box using the line
aa.Format("%d",i);
ts->_this->GetDlgItem(IDC_EDIT3)->SetWindowText(aa);//run time error occurs here.
my code is compilation error free.but i get an error when i run it as
access violation reading location 0x00000000
plz help.
-
July 6th, 2018, 02:30 AM
#2
Re: access violation reading location 0x00000000
You are trying to dereference a pointer that has a value of 0 (null). In the debugger put a breakpoint on that line and examine the contents of the variables. You'll then know which is the one that is 0.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
July 6th, 2018, 02:37 AM
#3
Re: access violation reading location 0x00000000
thanks for the reply..but even though i put a breakpoint on that particular line in debug mode.i am not able check the values of the variables..most of my variables are global variables..plz help.
-
July 6th, 2018, 02:41 AM
#4
Re: access violation reading location 0x00000000
What compiler/debugger are you using?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
July 6th, 2018, 02:46 AM
#5
Re: access violation reading location 0x00000000
Originally Posted by Ramdhyani
hello..
i am running a thread.but when i try to print anything edit box using the line
aa.Format("%d",i);
ts->_this->GetDlgItem(IDC_EDIT3)->SetWindowText(aa);//run time error occurs here.
my code is compilation error free.but i get an error when i run it as
access violation reading location 0x00000000
plz help.
1. What is ts?
2. What is _this?
3. Are you trying to access the IDC_EDIT3 control from within a worker thread? It appears to be a wrong design. Please, check out this great Joe Newcomer's essay: Using Worker Threads
Victor Nijegorodov
-
July 6th, 2018, 03:19 AM
#6
Re: access violation reading location 0x00000000
-
July 6th, 2018, 04:01 AM
#7
Re: access violation reading location 0x00000000
Then when the break point triggers you should be able to view the contents of the variables - and see which pointer is 0.
See
https://blogs.msdn.microsoft.com/dev...visual-studio/
https://msdn.microsoft.com/en-us/lib...v=vs.100).aspx
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
July 26th, 2018, 01:31 PM
#8
Re: access violation reading location 0x00000000
The UI and all its controls should only be modified from the main thread, not from worker threads.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|