#define ID_PRESSEDLEFTBUTTONONTRAYICON 2018#define ID_TRAYSINGLECLICK 2019#define IDC_PREVIEW 2020#define ID_MINIMIZEDMENUITEM 10000
IDD_RECYCLEBIN DIALOGEX 0, 0, 171, 217STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENUCAPTION "Recycle bin"FONT 8, "MS Sans Serif", 0, 0, 0x1BEGIN DEFPUSHBUTTON "Close",IDOK,114,7,50,14,BS_FLAT PUSHBUTTON "Delete",IDC_DELETE,7,7,50,14,BS_FLAT PUSHBUTTON "Restore",IDC_RESTORE,60,7,50,14,BS_FLAT LTEXT "Title",IDC_STATIC1,7,26,17,8 LISTBOX IDC_TITLES,7,35,157,175,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGEEND
IDD_RECYCLEBIN DIALOGEX 0, 0, 223, 220STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENUCAPTION "Recycle bin"FONT 8, "MS Sans Serif", 0, 0, 0x1BEGIN DEFPUSHBUTTON "Close",IDOK,166,7,50,14,BS_FLAT PUSHBUTTON "Delete",IDC_DELETE,7,7,50,14,BS_FLAT PUSHBUTTON "Restore",IDC_RESTORE,60,7,50,14,BS_FLAT LTEXT "Title",IDC_STATIC1,7,26,17,8 LISTBOX IDC_TITLES,7,38,209,175,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE PUSHBUTTON "Preview",IDC_PREVIEW,113,7,50,14END
Now I'm back to square 1.. actually, I've now successfully added the Preview button. All thats left now is to somehow figure out building the preview class so that this damn message can get previewed.
p.s. just let me know your acct and the funds will be transfered asap
edit: looking at cdlgrecyclebin is like me trying to read chinese.. I don't understand a lick of it lol!
class CRecycleBin {public: void SaveDeletedNote(void *pNote); CRecycleBin(); virtual ~CRecycleBin();protected: void SaveDeletedNotes (); void AddDeletedNote (void *Note);// Struct that holds the key and it value in the XML file struct tagCString { CString szName; CString szValue; }; void ParseXML (); void GetXMLChildren (MSXML2::IXMLDOMNodePtr pParent); void GetXMLChild (MSXML2::IXMLDOMNodePtr pChild);private: MSXML2::IXMLDOMDocumentPtr m_plDomDocument; MSXML2::IXMLDOMElementPtr m_pDocRoot; CList <tagCString, tagCString&> m_sString; // The strings in the XML file CList <tagNote, tagNote&> m_pNote; // The notes in the file deleted notes.xml};
However, how am I to add a preview pane to display the message.. now I'm confused if I should go the button route or just do what you said, seeing as you believe it's easier to manipulate. Now I just don't know where I would start to insert a preview pane. I was just going by what the assignment asked to do. It said to add another frame to display the content of the note that is to be restored.
HINT: It puts the notes in a linked list or else it gets the hose again.Er... I mean:Code: [Select]class CRecycleBin {public: void SaveDeletedNote(void *pNote); CRecycleBin(); virtual ~CRecycleBin();protected: void SaveDeletedNotes (); void AddDeletedNote (void *Note);// Struct that holds the key and it value in the XML file struct tagCString { CString szName; CString szValue; }; void ParseXML (); void GetXMLChildren (MSXML2::IXMLDOMNodePtr pParent); void GetXMLChild (MSXML2::IXMLDOMNodePtr pChild);private: MSXML2::IXMLDOMDocumentPtr m_plDomDocument; MSXML2::IXMLDOMElementPtr m_pDocRoot; CList <tagCString, tagCString&> m_sString; // The strings in the XML file CList <tagNote, tagNote&> m_pNote; // The notes in the file deleted notes.xml};The RecycleBin class keeps its notes in a linked list (CList) called m_pNote.Correspondingly, the CDlgRecycleBin dialog class keeps the titles of the notes in a list box (CListBox).You can ask a CListBox for the indexes of which items are selected. For ex, in CDlgRecycleBin::CreateImportXml: m_pTitle.GetSelItems (BUFFERSIZE, rgIndex);When you ask the CListBox for the index numbers for the items selected by the user, it is then possible to walk the linked list (m_pNote) to find the corresponding note data. I.e. if item number "2" is selected in the CListBox, then the "3rd" node in the linked list is the note you're interested in. (3rd, because the indexes are zero-based... 0,1,2 = 3rd.)
Alright.. I'm lost working with link lists.. I've been trying to grab the text to display it in the preview box, but nothing is happening when I click. I don't think I am inserting the code in the correct place. Do I have to create a whole new class to handle this operation, or can I just add this command somewhere for it to perform this?
private: MSXML2::IXMLDOMDocumentPtr m_plDomDocument; MSXML2::IXMLDOMElementPtr m_pDocRoot; CList <tagCString, tagCString&> m_sString; // The strings in the XML file CList <tagNote, tagNote&> m_pNote; // The notes in the file deleted notes.xml};
void CDlgRecycleBin::CreateImportXml(CString szFile){// Create the import file where the restored note will be in POSITION pos; CString szXML, szTemp; CRect rc1, rc2; if (theApp.m_bSortRecycleBinDescending) pos = m_pNote.GetTailPosition (); else pos = m_pNote.GetHeadPosition (); POSITION delpos; int rgIndex[BUFFERSIZE]; m_pTitle.GetSelItems (BUFFERSIZE, rgIndex); int iRow = 0; int iCount = 0; CXml xml; xml.StartCreateRecycleBinXml (); while (pos) { delpos = pos; tagNote note; if (theApp.m_bSortRecycleBinDescending) note = m_pNote.GetPrev (pos); else note = m_pNote.GetNext (pos); if (iRow == rgIndex[iCount]) { xml.CreateRecycleBinXml (note); // Erase this note from the list m_pNote.RemoveAt (delpos); } iRow++; } xml.EndCreateRecycleBinXml (); szXML = xml.GetCreateRecycleBinXml ();// Save the note now CStdioFile fp; if (!fp.Open (szFile, CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate)) { CErrorLog::CErrorLog (INFO, _T("Could not open the import notes.xml")); return; } TRY {#if (defined (UNICODE) || defined (_UNICODE)) int iLength, iMultibyte; CString szResult; iLength = szXML.GetLength (); WCHAR *pwcUnicode = new WCHAR [sizeof (WCHAR) * (iLength + 1)]; char *pcDest = new char [2 * (iLength + 1)];// To UTF-8 iMultibyte = WideCharToMultiByte (CP_UTF8, 0, szXML, iLength , pcDest, 2*iLength, NULL, NULL); fp.Write (pcDest, iLength); delete []pwcUnicode; delete []pcDest;#else fp.Write (szXML, szXML.GetLength ());#endif fp.Close (); } CATCH (CFileException, e) { CErrorLog::CErrorLog (ERR, _T("Could not write file import notes.xml")); return; } END_CATCH}