Click here to Skip to main content
16,007,443 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: load jpg file in C++ Pin
cedance8-Mar-07 17:54
cedance8-Mar-07 17:54 
GeneralRe: load jpg file in C++ Pin
Mark Salsbery8-Mar-07 18:30
Mark Salsbery8-Mar-07 18:30 
GeneralRe: load jpg file in C++ Pin
cedance8-Mar-07 19:47
cedance8-Mar-07 19:47 
GeneralRe: load jpg file in C++ Pin
Paresh Chitte8-Mar-07 18:34
Paresh Chitte8-Mar-07 18:34 
GeneralRe: load jpg file in C++ Pin
cedance8-Mar-07 19:49
cedance8-Mar-07 19:49 
GeneralRe: load jpg file in C++ Pin
Paresh Chitte8-Mar-07 20:05
Paresh Chitte8-Mar-07 20:05 
AnswerRe: load jpg file in C++ Pin
Paresh Chitte8-Mar-07 21:07
Paresh Chitte8-Mar-07 21:07 
QuestionStrange private boolean member behaviour inside a public function (long question) Pin
Joan M8-Mar-07 10:37
professionalJoan M8-Mar-07 10:37 
Hello all,

This morning I've found something interesting: a boolean that works perfect in all the application but it fails in just one function. Just before going deeper, I know that this is impossible, so I think that I'm missing something or I'm completely stucked on that code and I cannot see why do this is happening.

Let me explain that a little bit more:

1. I have 6 instances of one class that inherits from a MSChart.
2. That class has a private boolean member "m_bGraficaTempsReal"
3. That class has a public member function that returns the value of that private boolean member.
4. That class also has a public member function that modifies the value of that private boolean member.

I've been using AfxTrace in order to know the value of that boolean along the program code (spreading it along the code itself).

Each time I click a MSChart the event that is generated is handled by the respective OnClick message handler. Then is when I call the public function that set the value of that boolean variable, in fact I'm doing this: m_bGraficaTempsReal = !m_bGraficaTempsReal; and after that I've placed one AfxTrace call in order to see if everything has gone right. Of course the value is changed only each time that I click on that graph and each time I click on it only one ONCLICK message is generated so only one time the boolean variable gets modified.

In other parts of the application I'm using the function that returns the value of that boolean variable successfully. I mean that I know the value of that variable and everything is reacting in the way it should. So in other parts of the application I know the right value of the boolean variable.

Well, I also have one OnTimer that is called each 500 milliseconds.

Inside that Ontimer I call SetValor, that is a function that modifies the value of a bar of the graph. I'm passing some parameters to that function: the number of the bar that I'm modifying, the value that I want to place there and if I want to write the little label that is in the bottom of the graph again.

Inside the SetValor function, I'm using this code:
CString buf = "";<br />
if (m_bGraficaTempsReal)<br />
{<br />
  buf.Format("U%i-%.0f", iBar+1, m_vfData[iBar]);<br />
}<br />
else<br />
{<br />
  buf.Format("C%i-%.0f", iBar+1, m_vfData[iBar]);<br />
}<br />
AfxTrace("\n\nBOOL VALUE: %i",m_bGraficaTempsReal);<br />


As you can see I've placed another AfxTrace in order to see which is the value of that variable at that moment.

Well this is my surprise, I'm modifying only the value of that variable in the OnClick event, and I'm clicking it only one time, and I see how the variable changes it's value.

The OnTimer is also dependant and that variable, so SetValor is not being called unless the boolean variable has the right value (false), so if the function is getting called I must understand that the value is false, but I cannot understand why do the CString buf starts always with "U".

What could you recommend me in order to find out what is happening here?

Thank you in advance, an please excuse me for this large post.
QuestionRe: Strange private boolean member behaviour inside a public function (long question) Pin
Mark Salsbery8-Mar-07 12:14
Mark Salsbery8-Mar-07 12:14 
AnswerRe: Strange private boolean member behaviour inside a public function (long question) Pin
Joan M8-Mar-07 20:06
professionalJoan M8-Mar-07 20:06 
GeneralRe: Strange private boolean member behaviour inside a public function (long question) Pin
Mark Salsbery9-Mar-07 6:47
Mark Salsbery9-Mar-07 6:47 
GeneralRe: Strange private boolean member behaviour inside a public function (long question) Pin
Joan M9-Mar-07 7:00
professionalJoan M9-Mar-07 7:00 
Questionfread switching endianness on unformatted binary file Pin
regzim8-Mar-07 9:42
regzim8-Mar-07 9:42 
QuestionRe: fread switching endianness on unformatted binary file Pin
David Crow8-Mar-07 9:52
David Crow8-Mar-07 9:52 
AnswerRe: fread switching endianness on unformatted binary file Pin
Chris Losinger8-Mar-07 11:10
professionalChris Losinger8-Mar-07 11:10 
GeneralRe: fread switching endianness on unformatted binary file Pin
regzim8-Mar-07 19:01
regzim8-Mar-07 19:01 
GeneralRe: fread switching endianness on unformatted binary file Pin
cp98768-Mar-07 19:27
cp98768-Mar-07 19:27 
GeneralRe: fread switching endianness on unformatted binary file Pin
Chris Losinger9-Mar-07 1:14
professionalChris Losinger9-Mar-07 1:14 
GeneralRe: fread switching endianness on unformatted binary file Pin
regzim9-Mar-07 8:16
regzim9-Mar-07 8:16 
GeneralRe: fread switching endianness on unformatted binary file Pin
Chris Losinger9-Mar-07 8:29
professionalChris Losinger9-Mar-07 8:29 
GeneralRe: fread switching endianness on unformatted binary file Pin
regzim9-Mar-07 9:21
regzim9-Mar-07 9:21 
GeneralRe: fread switching endianness on unformatted binary file Pin
regzim9-Mar-07 9:24
regzim9-Mar-07 9:24 
GeneralRe: fread switching endianness on unformatted binary file Pin
Chris Losinger9-Mar-07 9:33
professionalChris Losinger9-Mar-07 9:33 
QuestionComparing Values Pin
Herboren8-Mar-07 8:00
Herboren8-Mar-07 8:00 
AnswerRe: Comparing Values Pin
Maximilien8-Mar-07 8:03
Maximilien8-Mar-07 8:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.