Showing file in edit control
-
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."
-
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."
I think you could: Open the dialog editor, and in it, set the
Visible
property of the Second edit toFALSE
. 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. -
I think you could: Open the dialog editor, and in it, set the
Visible
property of the Second edit toFALSE
. 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.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...] -
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...] -
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.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...]