RichEdit Errors
-
Hi All, Sorry i am back again. Steve i am getting below errors can please tell me what is cause. --------------------Errors-------------------- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... SearchDlg.cpp SearchDlg.cpp(641) : error C2065: 'textLen' : undeclared identifier SearchDlg.cpp(642) : error C2664: 'SetSelectionCharFormat' : cannot convert parameter 1 from 'struct _charformat *' to 'struct _charformat &' A reference that is not to 'const' cannot be bound to a non-lvalue Error executing cl.exe. 2 error(s), 0 warning(s) -----------Code-------------------------- void CSearchDlg::HilightWords(char* word) { CHARFORMAT cf; memset(&cf, 0, sizeof(CHARFORMAT)); cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_BOLD; cf.dwEffects = CFE_BOLD; FINDTEXTEX findText; int foundCount = 0; int foundPos = 0; int wordLen = lstrlen(word); findText.chrg.cpMin = 0; findText.chrg.cpMax = -1; findText.lpstrText = word; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); while (foundPos != -1) { m_FCONT.SetSel(foundPos, foundPos + textLen); //Error 1 m_FCONT.SetSelectionCharFormat(&cf); //Error 2 findText.chrg.cpMin = foundPos + textLen; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); } } void CSearchDlg::OnDblclkSout() { ----------- ------------------------- ---------------------------------------- FILE *fp = fopen(str,"r"); if (fp) { // goto the end of file fseek(fp, 0L, SEEK_END); // get the length of the file long fileLen = ftell(fp); // go back to the start of the file rewind(fp); // allocate buffer for file contents char* text = new char[fileLen + 1]; // read the file into the buffer fread(text, 1, fileLen, fp); // null terminate the string text[fileLen] = 0; // set the window text m_FCONT.SetWindowText(text); delete [] text; fclose(fp); } else { MessageBox("Select only file name to open.",M
-
Hi All, Sorry i am back again. Steve i am getting below errors can please tell me what is cause. --------------------Errors-------------------- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... SearchDlg.cpp SearchDlg.cpp(641) : error C2065: 'textLen' : undeclared identifier SearchDlg.cpp(642) : error C2664: 'SetSelectionCharFormat' : cannot convert parameter 1 from 'struct _charformat *' to 'struct _charformat &' A reference that is not to 'const' cannot be bound to a non-lvalue Error executing cl.exe. 2 error(s), 0 warning(s) -----------Code-------------------------- void CSearchDlg::HilightWords(char* word) { CHARFORMAT cf; memset(&cf, 0, sizeof(CHARFORMAT)); cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_BOLD; cf.dwEffects = CFE_BOLD; FINDTEXTEX findText; int foundCount = 0; int foundPos = 0; int wordLen = lstrlen(word); findText.chrg.cpMin = 0; findText.chrg.cpMax = -1; findText.lpstrText = word; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); while (foundPos != -1) { m_FCONT.SetSel(foundPos, foundPos + textLen); //Error 1 m_FCONT.SetSelectionCharFormat(&cf); //Error 2 findText.chrg.cpMin = foundPos + textLen; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); } } void CSearchDlg::OnDblclkSout() { ----------- ------------------------- ---------------------------------------- FILE *fp = fopen(str,"r"); if (fp) { // goto the end of file fseek(fp, 0L, SEEK_END); // get the length of the file long fileLen = ftell(fp); // go back to the start of the file rewind(fp); // allocate buffer for file contents char* text = new char[fileLen + 1]; // read the file into the buffer fread(text, 1, fileLen, fp); // null terminate the string text[fileLen] = 0; // set the window text m_FCONT.SetWindowText(text); delete [] text; fclose(fp); } else { MessageBox("Select only file name to open.",M
what is it 'textLen' and where is line that has error struct _charformat_**
**_
whitesky
-
what is it 'textLen' and where is line that has error struct _charformat_**
**_
whitesky
-
Hi All, Sorry i am back again. Steve i am getting below errors can please tell me what is cause. --------------------Errors-------------------- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... SearchDlg.cpp SearchDlg.cpp(641) : error C2065: 'textLen' : undeclared identifier SearchDlg.cpp(642) : error C2664: 'SetSelectionCharFormat' : cannot convert parameter 1 from 'struct _charformat *' to 'struct _charformat &' A reference that is not to 'const' cannot be bound to a non-lvalue Error executing cl.exe. 2 error(s), 0 warning(s) -----------Code-------------------------- void CSearchDlg::HilightWords(char* word) { CHARFORMAT cf; memset(&cf, 0, sizeof(CHARFORMAT)); cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_BOLD; cf.dwEffects = CFE_BOLD; FINDTEXTEX findText; int foundCount = 0; int foundPos = 0; int wordLen = lstrlen(word); findText.chrg.cpMin = 0; findText.chrg.cpMax = -1; findText.lpstrText = word; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); while (foundPos != -1) { m_FCONT.SetSel(foundPos, foundPos + textLen); //Error 1 m_FCONT.SetSelectionCharFormat(&cf); //Error 2 findText.chrg.cpMin = foundPos + textLen; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); } } void CSearchDlg::OnDblclkSout() { ----------- ------------------------- ---------------------------------------- FILE *fp = fopen(str,"r"); if (fp) { // goto the end of file fseek(fp, 0L, SEEK_END); // get the length of the file long fileLen = ftell(fp); // go back to the start of the file rewind(fp); // allocate buffer for file contents char* text = new char[fileLen + 1]; // read the file into the buffer fread(text, 1, fileLen, fp); // null terminate the string text[fileLen] = 0; // set the window text m_FCONT.SetWindowText(text); delete [] text; fclose(fp); } else { MessageBox("Select only file name to open.",M
m_FCONT.SetSel(longnStart,longnEnd) m_FCONT.SetSel(foundPos, foundPos + textLen); //Error 1 m_FCONT.SetSelectionCharFormat(cf); //Error 2_**
**_
whitesky
-
Hi All, Sorry i am back again. Steve i am getting below errors can please tell me what is cause. --------------------Errors-------------------- --------------------Configuration: DesktopSearch - Win32 Debug-------------------- Compiling... SearchDlg.cpp SearchDlg.cpp(641) : error C2065: 'textLen' : undeclared identifier SearchDlg.cpp(642) : error C2664: 'SetSelectionCharFormat' : cannot convert parameter 1 from 'struct _charformat *' to 'struct _charformat &' A reference that is not to 'const' cannot be bound to a non-lvalue Error executing cl.exe. 2 error(s), 0 warning(s) -----------Code-------------------------- void CSearchDlg::HilightWords(char* word) { CHARFORMAT cf; memset(&cf, 0, sizeof(CHARFORMAT)); cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_BOLD; cf.dwEffects = CFE_BOLD; FINDTEXTEX findText; int foundCount = 0; int foundPos = 0; int wordLen = lstrlen(word); findText.chrg.cpMin = 0; findText.chrg.cpMax = -1; findText.lpstrText = word; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); while (foundPos != -1) { m_FCONT.SetSel(foundPos, foundPos + textLen); //Error 1 m_FCONT.SetSelectionCharFormat(&cf); //Error 2 findText.chrg.cpMin = foundPos + textLen; foundPos = m_FCONT.FindText(FR_WHOLEWORD, &findText); } } void CSearchDlg::OnDblclkSout() { ----------- ------------------------- ---------------------------------------- FILE *fp = fopen(str,"r"); if (fp) { // goto the end of file fseek(fp, 0L, SEEK_END); // get the length of the file long fileLen = ftell(fp); // go back to the start of the file rewind(fp); // allocate buffer for file contents char* text = new char[fileLen + 1]; // read the file into the buffer fread(text, 1, fileLen, fp); // null terminate the string text[fileLen] = 0; // set the window text m_FCONT.SetWindowText(text); delete [] text; fclose(fp); } else { MessageBox("Select only file name to open.",M
Alrighty, holy mother of fritos and spicy bean dip (Is that kid sister friendly enough?) I guess I took this on as a personal crusade and I like to finish what I start when I can. :-D Error 1: Just change textLen to wordLen (it was a typo in my code) I didn't know you didn't know C++ (I guess I should've inferred that, but live and learn...) Error 2 change to: m_FCONT.SetSelectionCharFormat(cf); And I'm done, learn how to problem solve or you will be done too. (I mean, that if you can't look something up with google, then you're laaaame). I know you're trying to get your homework done, but come on dude, try, try!!!!
Last modified: Friday, May 26, 2006 12:56:10 AM --
-
Alrighty, holy mother of fritos and spicy bean dip (Is that kid sister friendly enough?) I guess I took this on as a personal crusade and I like to finish what I start when I can. :-D Error 1: Just change textLen to wordLen (it was a typo in my code) I didn't know you didn't know C++ (I guess I should've inferred that, but live and learn...) Error 2 change to: m_FCONT.SetSelectionCharFormat(cf); And I'm done, learn how to problem solve or you will be done too. (I mean, that if you can't look something up with google, then you're laaaame). I know you're trying to get your homework done, but come on dude, try, try!!!!
Last modified: Friday, May 26, 2006 12:56:10 AM --
Hi Steve Echols, Thanks for helping....Now its working... Since my semester is of 4 months I did not get time to attend VC++ classes outside, I just started learning on my own with help of Code Project and with help of masters like u and started working on my academic project. Since VC++ different from C++ I am finding it more difficult to understand the syntax and procedure… Can u please also tell how to increase the font(size) of the selected word,it will be helpfull if u can provide some links. Regards, Vinay Charan.
-
Alrighty, holy mother of fritos and spicy bean dip (Is that kid sister friendly enough?) I guess I took this on as a personal crusade and I like to finish what I start when I can. :-D Error 1: Just change textLen to wordLen (it was a typo in my code) I didn't know you didn't know C++ (I guess I should've inferred that, but live and learn...) Error 2 change to: m_FCONT.SetSelectionCharFormat(cf); And I'm done, learn how to problem solve or you will be done too. (I mean, that if you can't look something up with google, then you're laaaame). I know you're trying to get your homework done, but come on dude, try, try!!!!
Last modified: Friday, May 26, 2006 12:56:10 AM --
Steve Echols wrote:
Alrighty, holy mother of fritos and spicy bean dip (Is that kid sister friendly enough?)
Can't say! :~
Steve Echols wrote:
I guess I took this on as a personal crusade and I like to finish what I start when I can. :-D
:laugh::laugh: Yeah I have seen you helping him out in the past two days and all of them were related to RichEdit. May be you can write an article on this subject. :-D A 5.
Nibu thomas A Developer Programming tips[^] My site[^]
-
Hi Steve Echols, Thanks for helping....Now its working... Since my semester is of 4 months I did not get time to attend VC++ classes outside, I just started learning on my own with help of Code Project and with help of masters like u and started working on my academic project. Since VC++ different from C++ I am finding it more difficult to understand the syntax and procedure… Can u please also tell how to increase the font(size) of the selected word,it will be helpfull if u can provide some links. Regards, Vinay Charan.
Zarking fardwarks! My code worked?! :laugh::cool: Hey dude, I feel your pain, part of learning is asking questions (which you've done, very well, I might add :)) I could tell you how change the font size, but part of learning is research, and you might research this: CHARFORMAT. Come on, you know you want to learn! (Yeah, now I'm just helping you OR being a dickhead)!
-
Zarking fardwarks! My code worked?! :laugh::cool: Hey dude, I feel your pain, part of learning is asking questions (which you've done, very well, I might add :)) I could tell you how change the font size, but part of learning is research, and you might research this: CHARFORMAT. Come on, you know you want to learn! (Yeah, now I'm just helping you OR being a dickhead)!
-
Steve Echols wrote:
Alrighty, holy mother of fritos and spicy bean dip (Is that kid sister friendly enough?)
Can't say! :~
Steve Echols wrote:
I guess I took this on as a personal crusade and I like to finish what I start when I can. :-D
:laugh::laugh: Yeah I have seen you helping him out in the past two days and all of them were related to RichEdit. May be you can write an article on this subject. :-D A 5.
Nibu thomas A Developer Programming tips[^] My site[^]
Nibu thomas wrote:
May be you can write an article on this subject. :-D A 5.
The sad thing is I've never actually used a RichEdit control (in practice). The great thing about helping people out is that you also learn in the process (VinayCool cover your ears!) I've learned alot about RichEdit stuff (Thank you VinayCool!) :)
-
Nibu thomas wrote:
May be you can write an article on this subject. :-D A 5.
The sad thing is I've never actually used a RichEdit control (in practice). The great thing about helping people out is that you also learn in the process (VinayCool cover your ears!) I've learned alot about RichEdit stuff (Thank you VinayCool!) :)
Steve Echols wrote:
The great thing about helping people out is that you also learn in the process (VinayCool cover your ears!) I've learned alot about RichEdit stuff (Thank you VinayCool!)
Very true. Good job. :cool: But sometimes these questions get to you. :) Some understand some don't.
Nibu thomas A Developer Programming tips[^] My site[^]
-
Nibu thomas wrote:
May be you can write an article on this subject. :-D A 5.
The sad thing is I've never actually used a RichEdit control (in practice). The great thing about helping people out is that you also learn in the process (VinayCool cover your ears!) I've learned alot about RichEdit stuff (Thank you VinayCool!) :)
Good idea:)_**
**_
whitesky
-
Steve Echols wrote:
The great thing about helping people out is that you also learn in the process (VinayCool cover your ears!) I've learned alot about RichEdit stuff (Thank you VinayCool!)
Very true. Good job. :cool: But sometimes these questions get to you. :) Some understand some don't.
Nibu thomas A Developer Programming tips[^] My site[^]
Spanks!
Nibu thomas wrote:
But sometimes these questions get to you. :) Some understand some don't.
That's the cool thing about CP, there are some who know "flat out", and some who don't have a clue but will research problems that interest them just for the piece of mind!
-
Nibu thomas wrote:
May be you can write an article on this subject. :-D A 5.
The sad thing is I've never actually used a RichEdit control (in practice). The great thing about helping people out is that you also learn in the process (VinayCool cover your ears!) I've learned alot about RichEdit stuff (Thank you VinayCool!) :)