Click here to Skip to main content
15,913,090 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Subclassing problem: WM_LBUTTONDOWN is missing Pin
Axonn Echysttas25-Jan-06 0:16
Axonn Echysttas25-Jan-06 0:16 
GeneralRe: Subclassing problem: WM_LBUTTONDOWN is missing Pin
Ryan Binns25-Jan-06 0:18
Ryan Binns25-Jan-06 0:18 
GeneralRe: Subclassing problem: WM_LBUTTONDOWN is missing Pin
Axonn Echysttas25-Jan-06 0:22
Axonn Echysttas25-Jan-06 0:22 
QuestionManifest == dud ? Pin
Swinefeaster24-Jan-06 11:47
Swinefeaster24-Jan-06 11:47 
AnswerRe: Manifest == dud ? Pin
Christian Graus24-Jan-06 14:14
protectorChristian Graus24-Jan-06 14:14 
GeneralRe: Manifest == dud ? Pin
S Douglas24-Jan-06 20:37
professionalS Douglas24-Jan-06 20:37 
GeneralRe: Manifest == dud ? Pin
Swinefeaster25-Jan-06 15:26
Swinefeaster25-Jan-06 15:26 
QuestionErase Window Pin
sidkraft24-Jan-06 11:39
sidkraft24-Jan-06 11:39 
AnswerRe: Erase Window Pin
Christian Graus24-Jan-06 14:16
protectorChristian Graus24-Jan-06 14:16 
QuestionHow to get the handle of a Popup Menu for a window? Pin
Xiangyang Liu 刘向阳24-Jan-06 9:38
Xiangyang Liu 刘向阳24-Jan-06 9:38 
AnswerRe: How to get the handle of a Popup Menu for a window? Pin
Laxman924-Jan-06 17:33
Laxman924-Jan-06 17:33 
AnswerRe: How to get the handle of a Popup Menu for a window? Pin
Ryan Binns24-Jan-06 17:58
Ryan Binns24-Jan-06 17:58 
GeneralRe: How to get the handle of a Popup Menu for a window? Pin
Xiangyang Liu 刘向阳25-Jan-06 13:56
Xiangyang Liu 刘向阳25-Jan-06 13:56 
AnswerRe: How to get the handle of a Popup Menu for a window? Pin
Hans Ruck24-Jan-06 22:30
Hans Ruck24-Jan-06 22:30 
QuestionMRU in a popup submenu Pin
manosza24-Jan-06 9:17
manosza24-Jan-06 9:17 
QuestionPassword protect a document Pin
arnoldkempt24-Jan-06 8:41
arnoldkempt24-Jan-06 8:41 
AnswerRe: Password protect a document Pin
Maximilien24-Jan-06 8:47
Maximilien24-Jan-06 8:47 
GeneralRe: Password protect a document Pin
arnoldkempt25-Jan-06 7:27
arnoldkempt25-Jan-06 7:27 
AnswerRe: Password protect a document Pin
sps-itsec4624-Jan-06 12:56
sps-itsec4624-Jan-06 12:56 
QuestionMS Access ODBC Compact and Repair Pin
Anfernius24-Jan-06 6:20
Anfernius24-Jan-06 6:20 
QuestionWTF: std::string.find_first_of woes Pin
Sebastian Schneider24-Jan-06 5:25
Sebastian Schneider24-Jan-06 5:25 
Hi guys,

I hope I do not have overlooked something small in my code, or you probably will make fun of me:

I have a function that determines if a critical error has occured in really old code which just returns a list of structs containing error information. Someone already added a std::string containing the error-message to these structs, and I can simply get that one.

I need to ignore a certain error message (which virtually always occurs), so I wrote the following code:

<br />
std::string noRecords = "no records found"; // Dont ask me why, but this message always is wrong.<br />
for (int i = curr.numberOfElements(); i > 0; --i) <br />
   {<br />
      if (std::string::npos != curr.currentElement.info.find_first_of(noRecords))<br />
      {<br />
          return true;<br />
      }<br />
      curr.setToPreviousElement();<br />
   }<br />
return false;<br />
<br />

which is supposed to return true ("a real error occured") if there is any other error than "no records found" and false otherwise (i.e. "just noRecords errors").

As mentioned before, I cannot change the implementation of the errorList. Just ignore the naming, please, as I had to "obfuscate" a little.

Well, the result: obviously "no records found" is a part of "unexpected end of file". Thats what currElement.info (the std::string) contains.

I also tried the following comparisons:
curr.currentElement.info.find_first_of(noRecords) < 0

curr.currentElement.info.find_first_of("no records found") < 0

curr.currentElement.info.find_first_of("no records found") != std::string::npos

but to no avail. I tried over 100 info strings with the above function, it never got inside the conditional.

I HOPE that this is really simple (that means, I messed up somewhere). find_first_of actually IS the string::find_first_of(), I double-checked that.

GNAH.




Cheers,
Sebastian

--
Contra vim mortem non est medicamen in hortem.

-- modified at 11:25 Tuesday 24th January, 2006
AnswerRe: WTF: std::string.find_first_of woes Pin
Christian Graus24-Jan-06 14:20
protectorChristian Graus24-Jan-06 14:20 
GeneralRe: WTF: std::string.find_first_of woes Pin
Sebastian Schneider25-Jan-06 2:07
Sebastian Schneider25-Jan-06 2:07 
Question__gc* equivalent in VC++ 2005 Pin
madhusri24-Jan-06 4:32
madhusri24-Jan-06 4:32 
AnswerRe: __gc* equivalent in VC++ 2005 Pin
toxcct24-Jan-06 4:34
toxcct24-Jan-06 4:34 

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.