banner



Access Violation Writing Location C++

You must Sign In to use this message board.

Pinned HOW TO ANSWER A QUESTION Pin Popular

12-Jul-09 23:37

cofounder Chris Maunder 12-Jul-09 23:37
Apologies for the shouting but this is important.

When answering a question please:

  1. Read the question carefully
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
  3. If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
  4. If the question is inappropriate then click the 'vote to remove message' button

Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.

cheers,
Chris Maunder

The Code Project Co-founder
Microsoft C++ MVP


Sign In·View Thread
Pinned HOW TO ASK A QUESTION Pin Popular

Chris Maunder 12-Feb-09 18:19

cofounder Chris Maunder 12-Feb-09 18:19
For those new to message boards please try to follow a few simple rules when posting your question.
  1. Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
  2. Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
  3. Keep the subject line brief, but descriptive. eg "File Serialization problem"
  4. Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
  5. Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
  6. Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
  7. If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
  8. Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
  9. Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
  10. Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
  11. If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
  12. No advertising or soliciting.
  13. We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.

cheers,
Chris Maunder

The Code Project Co-founder

Microsoft C++ MVP


Sign In·View Thread
Question c++ code interpreter/debugging tool Pin

CalinNegru(fearless_) 10-Nov-21 2:40

Member CalinNegru(fearless_) 10-Nov-21 2:40
A while ago I`m started making a c++ code debugger tool in Forms (C#). The tool is designed to spot faults in a c++ code file and works such that in the process no compilation is taking place. It`s basically a simulation of execution without a binary file being involved. Are there similar projects around?
Sign In·View Thread
Answer Re: c++ code interpreter/debugging tool Pin

jeron1 10-Nov-21 7:09

Member jeron1 10-Nov-21 7:09

CalinNegru(fearless_) wrote:

It`s basically a simulation of execution without a binary file being involved
Sorry, I don't have an answer for you, but wow, that's sounds incredibly ambitious. OMG | :OMG:

"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle


Sign In·View Thread
General Re: c++ code interpreter/debugging tool Pin

CalinNegru(fearless_) 10-Nov-21 8:36

Member CalinNegru(fearless_) 10-Nov-21 8:36

It`s similar to what Visual Studio Intellisense does just driven one step further
Sign In·View Thread
General Re: c++ code interpreter/debugging tool Pin

jeron1 10-Nov-21 8:47

Member jeron1 10-Nov-21 8:47

Simulating execution versus providing context sensitive help seems like a BIG step, at least to me. I'm not dismissing Intellisense, which I imagine is a very large and complex task itself.

"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle


Sign In·View Thread
General [edit] Re: c++ code interpreter/debugging tool Pin

CalinNegru(fearless_) 10-Nov-21 9:25

Member CalinNegru(fearless_) 10-Nov-21 9:25

Itellisense keeps track of variables (which involves the creation of some sort of structures to hold at least the variable name and type) and brackets, but I agree it`s all on a very shallow level. I thought storing variable values would be the next logical step. Getting on this track started from me being frustrated with silent errors one gets when accessing an array outside its bounds. You could fix this by adding safety checks around the array in the c++ code but I thought you could also have an Intellisense like system that would spot the error. Evolving it into something that can `understand` classes or other advanced c++ features is an ambitious undertaking indeed I`m not sure I`m aiming that high.

here`s a short video of my program performing some basic operations:
Simulating code execution - YouTube[^]

modified 16hrs ago.


Sign In·View Thread
Answer Re: c++ code interpreter/debugging tool Pin

k5054 10-Nov-21 9:23

mve k5054 10-Nov-21 9:23

I'm not sure, excactly, what it is you're trying to accomplish. If you're thinking of creating a full C++ interpreter, then maybe you want to look at the Cling - ROOT project. However, that is a Linux only project, so it probably wont fit your needs. There might be a good C++ interpreter available for windows out there, you'll just have to google for it.
If what you are trying to achieve is more along the lines of code analysis, then maybe clang-tidy is more what you are thinking of, in which case see here: Using Clang-Tidy in Visual Studio | Microsoft Docs
But maybe I've misunderstood what it is you're trying to do. Perhaps the exercise of writing a C++ parser is in itself worth the effort for you, in which case, have at it!

Keep Calm and Carry On


Sign In·View Thread
General Re: c++ code interpreter/debugging tool Pin

CalinNegru(fearless_) 19hrs 11mins ago

Member CalinNegru(fearless_) 19hrs 11mins ago

thanks I`ll take a look at those projects to see if they are a match to what I`m trying to build. Note: I could be misusing the term `interpreter` here, that could be a word that is used to designate a very specific thing in software development.

modified 19hrs ago.


Sign In·View Thread
General Re: c++ code interpreter/debugging tool Pin

Greg Utas 12hrs 45mins ago

mva Greg Utas 12hrs 45mins ago
General Re: c++ code interpreter/debugging tool Pin

CalinNegru(fearless_) 11hrs 53mins ago

Member CalinNegru(fearless_) 11hrs 53mins ago

I`m making proper use of the term then. Thanks for the article link Greg
Sign In·View Thread
General Re: c++ code interpreter/debugging tool Pin

Greg Utas 11hrs 36mins ago

mva Greg Utas 11hrs 36mins ago

The code in the article could evolve into a C++ interpreter, but I decided this wouldn't be as useful as enhancing its static analysis capabilities. There are also C++11 language features that it doesn't support, and it doesn't do folding (calculating compile-time constants).

Sign In·View Thread
General Re: c++ code interpreter/debugging tool Pin

CalinNegru(fearless_) 8hrs 2mins ago

Member CalinNegru(fearless_) 8hrs 2mins ago

I`ll probably won`t end-up much further than getting my feet wet but that good to know.
Sign In·View Thread
Question Message Closed Pin

3-Nov-21 8:17

Member puntergill 3-Nov-21 8:17
Question Where to find resource on "how to analyze " system call output Pin

Member 14968771 22-Oct-21 8:10

Member Member 14968771 22-Oct-21 8:10
I like to bypass some of the Bluetooth "resources" in my C / C++ code by using (direct) system calls.
I can czech for return value, but like to analyze more of the output, in including errors.

Where do I start ?

Contrary to my opinion ( about RTFM ) - can somebody give me link to "RTFM" how to do it ?

system(" hcitool dev");   return to stdout (?)   Devices: 	hci1	00:50:B6:80:4D:5D 	hci0	00:15:83:15:A2:CB

Sign In·View Thread
Answer Re: Where to find resource on "how to analyze " system call output Pin

k5054 22-Oct-21 9:31

mve k5054 22-Oct-21 9:31

Rather than system(), you want to use popen(). The only problem is that popen() doesn't supply a separate FILE for stderr, so you have to use output redirection to capture both e.g.
FILE *cmd = popen("                                      hcitool dev 2>&1",                                      "                                      r");                                      char                                      *buffer = NULL;                                      size_t                                      len =                                      0; ssize_t readlen;                                      while                                      ( (readlen = getline(&buffer, len, cmd))                                      >                                      0) {     } free(buffer); pclose(cmd);
You could perhaps also use output redirection to capture output separately e.g.
FILE *cmd = popen("                                      hcitool dev 2>/tmp/hcierrs",                                      "                                      r");     FILE *cmd_errs = fopen("                                      /tmp/hcierrs",                                      "                                      r");     unlink("                                      /tmp/hcierrs");
If you're going to do that, you might want to look at creating unique temporary file names, so that you don't clobber output if you happen to have more than one instance of the program running at the same time. mkstemp() can help you here.
For the really advanced, you might look into trying "roll your own" version of popen that uses fork() and one of the exec() functions to separate out stdout and stderr to two separate FILES.

Keep Calm and Carry On


Sign In·View Thread
Question Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

rdeekonda 20-Oct-21 22:05

Member rdeekonda 20-Oct-21 22:05
I am using an outlook bar style property sheet with 3 property pages as the main window of my application.I am unable to change the tab icons displayed on the property sheet.Please suggest any strategy to change the icons.I have gone through all the documentation related to property sheets
and also googled but I couldn't get a solution. I have code which is not working and will post it if required.

Deekonda Ramesh

modified 21-Oct-21 3:19am.


Sign In·View Thread
Answer Re: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

Richard MacCutchan 20-Oct-21 23:21

mve Richard MacCutchan 20-Oct-21 23:21
General Re: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

rdeekonda 21-Oct-21 22:47

Member rdeekonda 21-Oct-21 22:47

SetIconsList works only once before the call to DoModal() on the property sheet. When It called a second time it asserts in afxpropertysheet.cpp : at line ENSURE(m_Icons.GetSafeHandle()==NULL).

Deekonda Ramesh


Sign In·View Thread
General Re: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

Victor Nijegorodov 21-Oct-21 23:55

Member Victor Nijegorodov 21-Oct-21 23:55

In such a case I'd recommend to subclass the CMFCPropertySheet (derive your own class from it) and overload the SetIconsList method. Or better implement the new method (say, ReplaceIcon) that would directly manipulate (remove/add/replace an image) with the m_Icons imagelist.
Sign In·View Thread
General Re: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

rdeekonda 22-Oct-21 7:10

Member rdeekonda 22-Oct-21 7:10

I have derived a class from CMFCPropertySheet and I changed m_Icons member with the new bitmaps.It does not show any change in the displayed icons/bitmaps.

Deekonda Ramesh

modified 22-Oct-21 12:38pm.


Sign In·View Thread
General Re: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

Victor Nijegorodov 22-Oct-21 7:55

Member Victor Nijegorodov 22-Oct-21 7:55

Then investigate the afxpropertysheet.cpp (and probably some more (friend and other classes) source code to see where and how the m_Icons imagelist is involved and try to change it according to your needs! Laugh | :laugh:
Sign In·View Thread
General Re: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

rdeekonda 24-Oct-21 7:12

Member rdeekonda 24-Oct-21 7:12

CMFCPropertySheet has a member called m_wndPane1. Following approach also did not work. Button images are jumbled up
m_wndPane1.RemoveAllButtons(); m_wndPane1.ClearAll();   retval=m_wndPane1.AddButton(m_bmpimgs[0],                                      "                                      Create a Job",                                      10050,                                      0); retval=m_wndPane1.AddButton(m_bmpimgs[1],                                      "                                      Manage a Job",                                      10051,                                      1); retval=m_wndPane1.AddButton(m_bmpimgs[2],                                      "                                      Restore a Job",                                      10052,                                      2);  m_wndPane1.InvalidateButton(0); m_wndPane1.InvalidateButton(1); m_wndPane1.InvalidateButton(2);                                    

Deekonda Ramesh


Sign In·View Thread
General Re: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

rdeekonda 25-Oct-21 3:31

Member rdeekonda 25-Oct-21 3:31

Got the answer mostly due to Microsoft Q&A This code placed in the derived property sheet works if the bitmap images are all of exactly the same size Thanks also to Victor Nijegorodov for his suggestions:

m_wndPane1.RemoveAllButtons();

retval=m_wndPane1.AddButton(m_bmpimgs[0], "Create a Job", 10050, 0);
retval=m_wndPane1.AddButton(m_bmpimgs[1], "Manage a Job", 10051, 1);
retval=m_wndPane1.AddButton(m_bmpimgs[2], "Restore a Job", 10052, 2);

m_wndPane1.InvalidateButton(0);
m_wndPane1.InvalidateButton(1);
m_wndPane1.InvalidateButton(2);

Deekonda Ramesh


Sign In·View Thread
Rant [REPOST] Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin

Richard Deeming 21-Oct-21 0:31

mve Richard Deeming 21-Oct-21 0:31

Access Violation Writing Location C++

Source: https://www.codeproject.com/Forums/1647/C-Cplusplus-MFC

Posted by: bustostholdrie1970.blogspot.com

0 Response to "Access Violation Writing Location C++"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel