void CMainFrame::OnTraymainImportexportImport() {// Import notes OPENFILENAME ofn; TCHAR szFile[260]; szFile[0] = NULL; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = m_hWnd; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter=_T("A Note file (*.xml)\0*.xml"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if (GetOpenFileName (&ofn) != TRUE) return; CString szName; szName = CString (ofn.lpstrFile); Load (szName);}
void CMainFrame::OnTraymainImportexportImport(){// Import notes OPENFILENAME ofn; TCHAR szFile[260];\\\\ADDED THE STRING BELOW\\\\ TCHAR szFilter[260]; szFile[0] = NULL; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = m_hWnd; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter=_T("A Note file (*.xml)\0*.xml");\\\\ADDED THE TEXT FILE OPTION BELOW\\\\ ofn.lpstrFilter=_T("A Text File (*.txt)\0*.txt"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if (GetOpenFileName (&ofn) != TRUE) return; CString szName; szName = CString (ofn.lpstrFile); Load (szName);}void CMainFrame::OnTraymainImportexportExport() {// Export notes OPENFILENAME ofn; TCHAR szFile[260]; TCHAR szFilter[260]; szFile[0] = NULL; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = m_hWnd; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter=_T("A Note file (*.xml)\0*.xml"); ofn.lpstrFilter=_T("A Text File (*.txt)\0*.txt"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if (GetSaveFileName (&ofn) != TRUE) return; CString szName; szName = CString (ofn.lpstrFile); // Add .xml szName.MakeLower (); if (szName.Right (4) != _T(".xml")) szName += _T(".xml");// Save the file Save (szName);}
[C++ Error] stdafx.h(15): E2209 Unable to open include file 'afxwin.h'[C++ Error] stdafx.h(18): E2209 Unable to open include file 'afxext.h'[C++ Error] stdafx.h(19): E2209 Unable to open include file 'afxdisp.h'[C++ Error] stdafx.h(20): E2209 Unable to open include file 'afxdtctl.h'[C++ Error] stdafx.h(22): E2209 Unable to open include file 'afxcmn.h'[C++ Error] stdafx.h(25): E2209 Unable to open include file ' msxml3.tlh'[C++ Error] stdafx.h(26): E2282 Namespace name expected[C++ Fatal Error] A Note.h(10): F1003 Error directive: include 'stdafx.h' before including this file for PCH
Code: [Select][C++ Error] stdafx.h(15): E2209 Unable to open include file 'afxwin.h'[C++ Error] stdafx.h(18): E2209 Unable to open include file 'afxext.h'[C++ Error] stdafx.h(19): E2209 Unable to open include file 'afxdisp.h'[C++ Error] stdafx.h(20): E2209 Unable to open include file 'afxdtctl.h'[C++ Error] stdafx.h(22): E2209 Unable to open include file 'afxcmn.h'[C++ Error] stdafx.h(25): E2209 Unable to open include file ' msxml3.tlh'[C++ Error] stdafx.h(26): E2282 Namespace name expected[C++ Fatal Error] A Note.h(10): F1003 Error directive: include 'stdafx.h' before including this file for PCH
I'm using Borland 2006.. and from what I understand I need VS 2003 in order for this to compile correctly.I will try and download VS express, but it doesn't have a debugger.. so that won't be much good
Just sprinkle print statements in the code to narrow things down.
How is the code looking thus far?I honestly don't believe I have to add much, only a couple lines of code to get this feature implemented, however I am unsure if what I've put in is somewhat correct.
quadz, I'm not sure if you d/l'ed the program, but it runs in the task tray area and when you right click the program it has the feature to import/export.. and with the import/export you can only do .xml, however I'm suppose to add the ability to do .txt in the dialogue box that comes up once you select to import. I will add the methods you suggested and see what I can come up with.
I would expect you would have a lot better luck getting it to compile with VS 2005, than with Borland.
Well--no offence intended--but it's sounding like you have only the most vague idea of what you're supposed to do or how to do it. So I would recommend against just "adding the methods I suggested", unless you know they are pertinent and appropriate to your solution.
OK, I downloaded the source and compiled it. (With VS 2003.)How long ago did you get this assignment that's due tomorrow? What led you to believe you only need to add a ".txt" filter to the open/save file dialog to make the program import/export in a text format instead of XML?
Have you looked at the CMainFrame::Save() and CMainFrame::Load() methods? Do you think they will start saving and loading in a text format, if you simply pass them a filename that ends in ".txt"?
You MIGHT be able to finish this by tomorrow... But you are going to have to understand how Save() and Load() work, and how the routines in Xml.cpp work that are used by Save() and Load()... Because you are going to need to write plain text equivalents for all that. I would get started ASAP. BTW, what errors do you get when you try to compile the project with VS 2005?