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. Showing file in edit control

Showing file in edit control

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
5 Posts 3 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.
  • S Offline
    S Offline
    swaapu
    wrote on last edited by
    #1

    Hi!! I have an mfc sdi application. I have a dialog in which , i had put a text box. I want to open some file(text file), entered by user( in another EDIT CONTROL). I want that the Edit Control(for displaying file) to remain invisible, until the user clicks on SHOW FILE BUTTON. Which function should, I use for opening it?? How to do this at button_click?? "If you change then change for the good."

    K 1 Reply Last reply
    0
    • S swaapu

      Hi!! I have an mfc sdi application. I have a dialog in which , i had put a text box. I want to open some file(text file), entered by user( in another EDIT CONTROL). I want that the Edit Control(for displaying file) to remain invisible, until the user clicks on SHOW FILE BUTTON. Which function should, I use for opening it?? How to do this at button_click?? "If you change then change for the good."

      K Offline
      K Offline
      khan
      wrote on last edited by
      #2

      I think you could: Open the dialog editor, and in it, set the Visible property of the Second edit to FALSE. Then on button-click, Open the file using: CFile file; file.Open("filename.txt",CFile::modeRead | CFile::modeNoTruncate); int length = file.GetLength(); char* p = new char[length+1]; memset(p,0,length+1); file.Read(p,length); file.Close(); m_Edit2.SetWindowText(p); delete[] p; m_Edit2.ShowWindow(SW_SHOW); etc. this is this.

      T 1 Reply Last reply
      0
      • K khan

        I think you could: Open the dialog editor, and in it, set the Visible property of the Second edit to FALSE. Then on button-click, Open the file using: CFile file; file.Open("filename.txt",CFile::modeRead | CFile::modeNoTruncate); int length = file.GetLength(); char* p = new char[length+1]; memset(p,0,length+1); file.Read(p,length); file.Close(); m_Edit2.SetWindowText(p); delete[] p; m_Edit2.ShowWindow(SW_SHOW); etc. this is this.

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        don't mix old C and MFC styles in the same code sample, ,even if it works fine. prefer using once style.


        TOXCCT >>> GEII power
        [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]

        K 1 Reply Last reply
        0
        • T toxcct

          don't mix old C and MFC styles in the same code sample, ,even if it works fine. prefer using once style.


          TOXCCT >>> GEII power
          [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]

          K Offline
          K Offline
          khan
          wrote on last edited by
          #4

          Well, you are probably right, which is why I wrote ...etc as I meant to give the user an idea. I would be surprised to see code like this used as-is. this is this.

          T 1 Reply Last reply
          0
          • K khan

            Well, you are probably right, which is why I wrote ...etc as I meant to give the user an idea. I would be surprised to see code like this used as-is. this is this.

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            khan++ wrote:

            I would be surprised to see code like this used as-is.

            don't ! there are so many beginners asking here that they probably think one could give them a full working code...


            TOXCCT >>> GEII power
            [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]

            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