Click here to Skip to main content
15,914,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Rect Value AGAIN!!!!!!! Pin
gdocherty13-Mar-05 13:28
gdocherty13-Mar-05 13:28 
GeneralWord wrap puzzle Pin
Ravi Bhavnani13-Mar-05 11:24
professionalRavi Bhavnani13-Mar-05 11:24 
GeneralRe: Word wrap puzzle Pin
Graham Bradshaw13-Mar-05 11:51
Graham Bradshaw13-Mar-05 11:51 
GeneralRe: Word wrap puzzle Pin
Ravi Bhavnani13-Mar-05 13:13
professionalRavi Bhavnani13-Mar-05 13:13 
GeneralRe: Clarification Pin
PJ Arends13-Mar-05 11:56
professionalPJ Arends13-Mar-05 11:56 
GeneralRe: Clarification Pin
PJ Arends13-Mar-05 12:43
professionalPJ Arends13-Mar-05 12:43 
GeneralRe: Clarification Pin
Ravi Bhavnani13-Mar-05 13:12
professionalRavi Bhavnani13-Mar-05 13:12 
GeneralRe: Clarification Pin
Ravi Bhavnani24-Mar-05 4:14
professionalRavi Bhavnani24-Mar-05 4:14 
Hmm, the algorithm sometimes goes into an infinite loop. I worked out an alternate implementation which seems to work. Time will tell... Smile | :)
//! Wraps a string at a user specified boundary and and stores
//! each individual line in a CStringArray.
//! @param  strString   The string to be wrapped.
//! @param  nWrap       Wrap margin.
//! @param  lines       Collection of wrapped lines.
void wrap
  (CString strString,
   int nWrap,
   CStringArray& lines)
{
  int nStart = 0;
  int nEnd = 0;
  do {
 
    // Determine boundaries of next line
    nEnd = nStart + nWrap;
    if (nEnd >= strString.GetLength())
       nEnd = strString.GetLength() - 1;
 
    // If we're not at the end of the string, make sure we're
    // at a word break
    if (nEnd != strString.GetLength() - 1)
       while ((nEnd >= 0) && (strString.GetAt (nEnd) != _T(' ')))
             nEnd--;
 
    // Extract the next line
    CString strNextLine;
    if ((nEnd - nStart) > 0) {
       strNextLine = strString.Mid (nStart, (nEnd - nStart) + 1);
       lines.Add (strNextLine);
    }
 
    // Set the start of the next boundary
    nStart = nEnd + 1;
 
  } while (nStart < strString.GetLength());
  return;
}
/ravi

My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com

GeneralRe: Clarification Pin
Ravi Bhavnani13-Mar-05 12:57
professionalRavi Bhavnani13-Mar-05 12:57 
QuestionNetwork problem? Pin
dSolariuM13-Mar-05 10:11
dSolariuM13-Mar-05 10:11 
AnswerRe: Network problem? Pin
Ravi Bhavnani13-Mar-05 10:24
professionalRavi Bhavnani13-Mar-05 10:24 
GeneralComunications with Dialogs Pin
HackPrince13-Mar-05 6:08
HackPrince13-Mar-05 6:08 
GeneralRe: Comunications with Dialogs Pin
John R. Shaw13-Mar-05 6:25
John R. Shaw13-Mar-05 6:25 
GeneralRe: Comunications with Dialogs Pin
Ravi Bhavnani13-Mar-05 7:58
professionalRavi Bhavnani13-Mar-05 7:58 
GeneralFind the files in a folder Pin
Cedric Moonen13-Mar-05 6:00
Cedric Moonen13-Mar-05 6:00 
GeneralRe: Find the files in a folder Pin
Steve Mayfield13-Mar-05 6:03
Steve Mayfield13-Mar-05 6:03 
GeneralRe: Find the files in a folder Pin
Cedric Moonen13-Mar-05 6:08
Cedric Moonen13-Mar-05 6:08 
GeneralRe: Find the files in a folder Pin
John R. Shaw13-Mar-05 6:31
John R. Shaw13-Mar-05 6:31 
QuestionHow to get Rect value ????? HELP !!!! Pin
13-Mar-05 5:39
suss13-Mar-05 5:39 
AnswerRe: How to get Rect value ????? HELP !!!! Pin
Mohsen Saad13-Mar-05 6:18
Mohsen Saad13-Mar-05 6:18 
GeneralRe: How to get Rect value ????? HELP !!!! Pin
Member 143833713-Mar-05 6:58
Member 143833713-Mar-05 6:58 
GeneralRe: How to get Rect value ????? HELP !!!! Pin
JohnCz18-Mar-05 10:53
JohnCz18-Mar-05 10:53 
AnswerRe: How to get Rect value ????? HELP !!!! Pin
Member 143833713-Mar-05 11:22
Member 143833713-Mar-05 11:22 
AnswerRe: How to get Rect value ????? HELP !!!! Pin
Maximilien13-Mar-05 13:11
Maximilien13-Mar-05 13:11 
QuestionHow can I detect a CODEC was installed? And detect its version. Pin
Behzad Ebrahimi13-Mar-05 5:00
Behzad Ebrahimi13-Mar-05 5:00 

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.