Click here to Skip to main content
15,908,173 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: fatal error C1189: #error : This add-in is for VC++ 6.0 only Pin
Stuart Dootson14-Feb-09 23:25
professionalStuart Dootson14-Feb-09 23:25 
GeneralRe: fatal error C1189: #error : This add-in is for VC++ 6.0 only Pin
pandit8414-Feb-09 23:39
pandit8414-Feb-09 23:39 
GeneralRe: fatal error C1189: #error : This add-in is for VC++ 6.0 only Pin
Stuart Dootson15-Feb-09 0:39
professionalStuart Dootson15-Feb-09 0:39 
QuestionCEditView Pin
grassrootkit14-Feb-09 22:44
grassrootkit14-Feb-09 22:44 
AnswerRe: CEditView Pin
grassrootkit14-Feb-09 22:56
grassrootkit14-Feb-09 22:56 
GeneralRe: CEditView Pin
Stuart Dootson14-Feb-09 23:13
professionalStuart Dootson14-Feb-09 23:13 
GeneralRe: CEditView Pin
grassrootkit15-Feb-09 0:50
grassrootkit15-Feb-09 0:50 
GeneralRe: CEditView Pin
Stuart Dootson15-Feb-09 3:01
professionalStuart Dootson15-Feb-09 3:01 
I've just created a tiny MFC SDI app (using VS2008) to test this out.

To hold the text you're editting, I added a member to my document class, plus an accessor function.

public:
   CString const& GetText() const { return text_; }
protected:
   CString text_;


To read/write a file, I added functionality to the document's Serialize method:

void CdddDoc::Serialize(CArchive& ar)
{
   if (ar.IsStoring())
   {
      ar.Write(text_, text_.GetLength());
   }
   else
   {
      const UINT fileSize = (UINT)ar.GetFile()->GetLength();
      CStringT<char, StrTraitMFC_DLL<char> > byteString;
      ar.Read(byteString.GetBufferSetLength(fileSize), fileSize);
      text_ = byteString;
      UpdateAllViews(0);
   }
}


The byteString stuff is because I had a file with ASCII text, while my app is Unicode, so I need to read the file into a 'byte per char' string and then convert to the standard CString.

Then I added an OnUpdate handler to my view, to set the view's text:

void CdddView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/)
{
   SetWindowText(GetDocument()->GetText());
}


To update the document in line with the edit view, I'd add a method to the document class that would allow me to update the text somehow.

So, as you can see, by complying with the standard MFC doc/view framework, I've got plenty of functionality for very little effort!

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: CEditView Pin
grassrootkit15-Feb-09 5:34
grassrootkit15-Feb-09 5:34 
GeneralRe: CEditView Pin
grassrootkit15-Feb-09 22:31
grassrootkit15-Feb-09 22:31 
GeneralRe: CEditView Pin
Stuart Dootson15-Feb-09 23:30
professionalStuart Dootson15-Feb-09 23:30 
GeneralRe: CEditView Pin
grassrootkit15-Feb-09 22:54
grassrootkit15-Feb-09 22:54 
GeneralRe: CEditView Pin
Stuart Dootson15-Feb-09 23:26
professionalStuart Dootson15-Feb-09 23:26 
AnswerRe: CEditView // Displaying text Pin
grassrootkit14-Feb-09 23:00
grassrootkit14-Feb-09 23:00 
GeneralRe: CEditView // Displaying text Pin
grassrootkit14-Feb-09 23:11
grassrootkit14-Feb-09 23:11 
GeneralRe: CEditView // Displaying text Pin
Stuart Dootson14-Feb-09 23:17
professionalStuart Dootson14-Feb-09 23:17 
GeneralRe: CEditView // Displaying text Pin
grassrootkit14-Feb-09 23:27
grassrootkit14-Feb-09 23:27 
QuestionCListCtrl "show selection always" doesn't work in vista aero theme Pin
xanagan66614-Feb-09 21:05
xanagan66614-Feb-09 21:05 
AnswerRe: CListCtrl "show selection always" doesn't work in vista aero theme Pin
Stuart Dootson14-Feb-09 23:14
professionalStuart Dootson14-Feb-09 23:14 
Question871127 - intellisense Pin
ilostmyid214-Feb-09 17:30
professionalilostmyid214-Feb-09 17:30 
AnswerRe: 871127 - intellisense Pin
Stuart Dootson14-Feb-09 23:20
professionalStuart Dootson14-Feb-09 23:20 
GeneralRe: 871127 - intellisense Pin
ilostmyid217-Feb-09 18:21
professionalilostmyid217-Feb-09 18:21 
QuestionToUpper and ToLower part of a string in .net C++? Pin
TabascoSauce14-Feb-09 13:00
TabascoSauce14-Feb-09 13:00 
AnswerRe: ToUpper and ToLower part of a string in .net C++? Pin
Stuart Dootson14-Feb-09 13:33
professionalStuart Dootson14-Feb-09 13:33 
GeneralRe: ToUpper and ToLower part of a string in .net C++? Pin
TabascoSauce14-Feb-09 15:27
TabascoSauce14-Feb-09 15:27 

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.