Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. RichEdit Errors

RichEdit Errors

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelpquestionworkspace
14 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VinayCool
    wrote on last edited by
    #1

    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

    H Steve EcholsS 3 Replies Last reply
    0
    • V VinayCool

      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

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      what is it 'textLen' and where is line that has error struct _charformat_**


      **_

      whitesky


      V 1 Reply Last reply
      0
      • H Hamid Taebi

        what is it 'textLen' and where is line that has error struct _charformat_**


        **_

        whitesky


        V Offline
        V Offline
        VinayCool
        wrote on last edited by
        #3

        Hi whiteSky,, Error lines are m_FCONT.SetSel(foundPos, foundPos + textLen); //Error 1 m_FCONT.SetSelectionCharFormat(&cf); //Error 2 Regards, Vinay Charan.

        1 Reply Last reply
        0
        • V VinayCool

          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

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          m_FCONT.SetSel(longnStart,longnEnd) m_FCONT.SetSel(foundPos, foundPos + textLen); //Error 1 m_FCONT.SetSelectionCharFormat(cf); //Error 2_**


          **_

          whitesky


          1 Reply Last reply
          0
          • V VinayCool

            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

            Steve EcholsS Offline
            Steve EcholsS Offline
            Steve Echols
            wrote on last edited by
            #5

            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 --

            • S
              50 cups of coffee and you know it's on!
              Code, follow, or get out of the way.
            V N 2 Replies Last reply
            0
            • Steve EcholsS Steve Echols

              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 --

              V Offline
              V Offline
              VinayCool
              wrote on last edited by
              #6

              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.

              Steve EcholsS 1 Reply Last reply
              0
              • Steve EcholsS Steve Echols

                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 --

                N Offline
                N Offline
                Nibu babu thomas
                wrote on last edited by
                #7

                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[^]

                Steve EcholsS 1 Reply Last reply
                0
                • V VinayCool

                  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.

                  Steve EcholsS Offline
                  Steve EcholsS Offline
                  Steve Echols
                  wrote on last edited by
                  #8

                  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)!

                  • S
                    50 cups of coffee and you know it's on!
                    Code, follow, or get out of the way.
                  V 1 Reply Last reply
                  0
                  • Steve EcholsS Steve Echols

                    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)!

                    V Offline
                    V Offline
                    VinayCool
                    wrote on last edited by
                    #9

                    Thanks Steve... I will do the research on CHARFORMAT ... Thanks a lot :) Regards, Vinay Charan.

                    1 Reply Last reply
                    0
                    • N Nibu babu thomas

                      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[^]

                      Steve EcholsS Offline
                      Steve EcholsS Offline
                      Steve Echols
                      wrote on last edited by
                      #10

                      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!) :)

                      • S
                        50 cups of coffee and you know it's on!
                        Code, follow, or get out of the way.
                      N H V 3 Replies Last reply
                      0
                      • Steve EcholsS Steve Echols

                        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!) :)

                        N Offline
                        N Offline
                        Nibu babu thomas
                        wrote on last edited by
                        #11

                        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[^]

                        Steve EcholsS 1 Reply Last reply
                        0
                        • Steve EcholsS Steve Echols

                          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!) :)

                          H Offline
                          H Offline
                          Hamid Taebi
                          wrote on last edited by
                          #12

                          Good idea:)_**


                          **_

                          whitesky


                          1 Reply Last reply
                          0
                          • N Nibu babu thomas

                            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[^]

                            Steve EcholsS Offline
                            Steve EcholsS Offline
                            Steve Echols
                            wrote on last edited by
                            #13

                            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!

                            • S
                              50 cups of coffee and you know it's on!
                              Code, follow, or get out of the way.
                            1 Reply Last reply
                            0
                            • Steve EcholsS Steve Echols

                              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!) :)

                              V Offline
                              V Offline
                              VinayCool
                              wrote on last edited by
                              #14

                              Cool :) Regards, Vinay Charan.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups