NO

Author Topic: A problem here was really caused by a problem way over there  (Read 3529 times)

colepc

  • Guest
A problem here was really caused by a problem way over there
« on: March 18, 2015, 02:52:08 am »
I added WM_LBUTTONDOWN to my MainWndProc() and my entire Win32 program went into meltdown (it crashed). When it was removed my program worked fine. When I tried using WM_SYSKEYUP in place of WM_LBUTTONDOWN my program worked fine. When I used WM_LBUTTONUP and WM_RBUTTONDOWN instead of WM_LBUTTONDOWN my program crashed. It seemed like I couldn't use any mouse features. I was about to pull my hair out when I decided that I needed to methodically drill into the program using "MessageBeep()" to figure out where the crash was actually occurring (OK I'm simple minded and I use simple minded diagnostic tools). I narrowed the crash down to a divide operation and figured out that the denominator was somehow changing to zero. Dividing by zero is a no-no and it was causing my program to crash. Then I had to figure out where the zero was coming from.  MessageBox() and sprintf() helped me (again simple tools). I found the problem in a routine that was a long ways away from MainWndProc(). There I found logic that was initializing an array outside the limits of the array.  Why it didn't cause problems previously and why it waited until I added WM_LBUTTONDOWN will always be a big mystery to me. Having passed that hurdle, I added the mouse operations I wanted and I'm now in the process of fine tuning them.

Grincheux

  • Guest
Re: A problem here was really caused by a problem way over there
« Reply #1 on: March 18, 2015, 06:06:07 pm »
?

colepc

  • Guest
Re: A problem here was really caused by a problem way over there
« Reply #2 on: March 18, 2015, 08:09:09 pm »
Thanks Grinch for the helpful comment. >:( Is there a problem with sharing experiences? Is this site just about questions and answers?

Grincheux

  • Guest
Re: A problem here was really caused by a problem way over there
« Reply #3 on: March 18, 2015, 08:36:01 pm »
I did not understood what you wanted.

colepc

  • Guest
Re: A problem here was really caused by a problem way over there
« Reply #4 on: March 18, 2015, 09:31:06 pm »
I didn't want anything. I was sharing an experience. Is that discouraged on this forum?

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 761
Re: A problem here was really caused by a problem way over there
« Reply #5 on: March 19, 2015, 04:20:48 am »
I didn't want anything. I was sharing an experience. Is that discouraged on this forum?
No. But to be honest, your intention was not clear to me (and apparently others) from your post. I was reading over it three times to see where your question/problem was. And that was before I scrolled further down to see your replies to Grincheaux...  :-\

Ralf
« Last Edit: March 22, 2015, 05:49:27 am by Bitbeisser »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1778
Re: A problem here was really caused by a problem way over there
« Reply #6 on: March 19, 2015, 01:11:16 pm »
Colpec this thread was intended for general discussions on programming, so everybody expected a question  :)
Of course there is space for for sharing experiences generally we refer to the chit-chat thread.
BTW your experience is the demonstration of the most common problem when debugging a complex application: you spend a lot of time looking around the point where it crashes, but the problem come from far.
One time it took me a couple of weeks to find where I was trashing the content of my variables.
In the last days I had a long discussion on another forum with a guy, whose skill in programming is high (looking at his code), complaining that a MS function don't work and will never work. I showed him that compiling in C his own code it worked, but no way, he was convinced that the function cannot work. I'm sure that his problem was elsewhere, I hope he solved by now...  :)

colepc

  • Guest
Re: A problem here was really caused by a problem way over there
« Reply #7 on: March 23, 2015, 02:44:35 pm »
There are folders in the "C language" section especially for asking questions ("Beginner questions" and "Expert questions"). Why would I assume that a folder called "General discussion" and said to be "The place where you can discuss everything related to this forum" can only be used for questions? Perhaps I don't understand your meaning of the word "forum". I see that the folder I used for this post ("General discussion") is in the section called "Pelles C forum" and there is another section called "Pellas C" that also has a folder called "General discussion" (for general questions about Pelles C). However my understanding of the word "forum" is that it means the entire website, not just a sub section of that website that happens to use the word "forum". The sections called "C language", "Assembly language", "Pelles C", "General", and "Test" all do not include the word "forum" so does that mean they are all not forums? As far as the folder "Chit-Chat" in the "General" section is concerned: I would think that would be the place I would discuss politics or other issues that are not related to Pelles C or programming.  No wonder this forum is not very active. I get the impression you trying to chase me away so I won't contribute my experiences and lessons learned.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 761
Re: A problem here was really caused by a problem way over there
« Reply #8 on: March 24, 2015, 04:35:31 am »
Please, calm down. Nobody says you have to post a "question"!

Your post just wasn't as clear to for several people at least that you did not intend to ask one. I am for one, helping out in several forums, for up to 15 years (and longer on email lists), assumed just a badly worded post. Or simply forgetting to post the actual question(s)...

I have seen things like this happen in the past and all that it took from your end was to state that you just intended to post an experience, rather than ask a specific question. Done. Nothing wrong with that.

Ralf