I have managed to achieve what I wanted, except for 1 remaining item.
Having succssfully closed the document, and my View has reverted to the original empty View, I find that I can open new files, except for the one that was just closed. I cannot open the file that was previously open until I have viewed a different file.
Is there a flag I need to reset, or function call I need to make so it is possible to open the fiel immediately after it has been closed?
I've managed to overcome that problem now by using the DocTemplate and Removing the document, but I now find that if I use this method, wi have to close my application multiple times dependent on how many times I have closed a document, e.g. close 2 documents and I have to close the application twice (press the application 'X' button twice). Any suggestions?
I am using DeleteContents() as part of my closure code, see below.........
//if the data has been modified then save the file
if(TRUE == IsModified())
//get the DocTemplate to enable document removal
CDocTemplate* pDocTemplate = GetDocTemplate();
if(NULL != pDocTemplate)
//delete the document content and revert the title to "Untitled"
//refresh the list view
AS I say, the only issue now is that I have to close mutliple times, once for each file opened.
I'm not sure if it could be part of your problem, however it probably is not a good idea to call RemoveDocument. In an SDI, there is only one document, and it lasts for the life of the program - it's never destroyed.
Of course, your DeleteContents is also responsible for resetting any document member data to it's original state.
If I remove the call to RemoveDocument, I'm left with not being able to reopen the last closed file - this is caused by the CDocTemplate::yesAlreadyOpen flag being set.
Is there a way to force this flag, or my DocTemplate, to be something that reflects that I have closed (hopefully!!) the last open file?
I have C++ Simple MAPI routines for sending emails. This works well for straight text emails. I have prepared a HMTL body for emailing but do not know how to flag the fact that the body is HTML to the client when using Simple MAPI.
Can this be done with Simple MAPI ?
If it can't be done using Simple MAPI how is it done using an alternative.
Let's start with Extended MAPI before moving on to something super sophisticated.
Try to keep it simple. I'm only looking at sending a single email body with simple HTML.
An email contains a header (from, to, ...) and a body and 0 or more attachments. Attachments have different mimetypes. A HTML-body is of type multipart/mixed. So your email contans a header, an empty body and 2 attachments both of type multipart/mixed, 1 attachment contains the text in plain ascii, the other one contains the HTML version of this text. multipart/mixed means for the email client: take the variant that suits best resulting in HTML in most email clients and in plain ascii if the client doesn't support HTML.
Hopefully weaponed with this knowledge you can find yor way in MAPI. If not: forget what i wrote.
I am using CFileDialog class in my application to browse a file. when i click on browse always by default application is opening desktop folder. I have one default path how to open that path instead of desktop.
Yep it's been a long time. The main reason is that I've been assigned to do Java-mumbo-jumbo and Eclipse plugins.
Not really my cup of tea.
Besides I've been busy (and still am...) trying to get my spare time to fit into the 24 hours given for each day.
How are things at your end? Busy? Nice things to work with?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
You should set the lpstrInitialDir member of the CFileDialog's m_ofn struct (see [^] and [^]).
Please read carefully the documentation: file dialog behaviour is OS-dependant (for instance, Windows 7 behaves distinctively with respect the initial directory).
Wow! Damned *fast* Roger!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke