A evo i koda uz moju prethodnu poruku. Radi se o funkciji OnMail, koja se moze vezati za neku akciju:
Code:
void CPrintDlg::OnMail()
{
// TODO: Add your command handler code here
const HINSTANCE hMAPILib = ::LoadLibrary("MAPI32.DLL");
if (hMAPILib)
{
MAPIFUNC lpMAPISendMail = (MAPIFUNC) GetProcAddress(hMAPILib, "MAPISendMail");
if (lpMAPISendMail != NULL)
{
static MapiMessage Msg;
LPDISPATCH lpDispDoc = m_wndBrowser.GetDocument();
IHTMLDocument2* pDoc;
CString filename = "c:\\" + m_Which + ".htm";
if(SUCCEEDED(lpDispDoc->QueryInterface(IID_IHTMLDocument2, (LPVOID*) &pDoc))) {
IPersistFile* pDocFile = NULL;
if(SUCCEEDED(pDoc->QueryInterface(IID_IPersistFile, (LPVOID*) &pDocFile))) {
LPCOLESTR file = L"c:\\file.htm";
//LPTSTR file = filename
pDocFile->Save(file,TRUE);
pDocFile->Release();
}
}
memset(&Msg, 0, sizeof(Msg));
CString strSubject;
strSubject.Format("PropertyID - %s", m_strPropID);
Msg.lpszSubject = strSubject.GetBuffer(1);
Msg.lpszNoteText = "Edit the message.";
MapiFileDesc attachment = {0,0,(ULONG)-1,"c:\\file.htm", NULL, NULL};
Msg.lpFiles = &attachment;
Msg.nFileCount = 1;
lpMAPISendMail(NULL, NULL, &Msg, (FLAGS) (MAPI_LOGON_UI | MAPI_DIALOG), 0);
lpDispDoc->Release();
}
}
this->BringWindowToTop();
}
Inace, da se ne zbuni neko, ova funkcija takodje odradjuje i attachment, koji vadi iz IHTMLDocument klase, te ako vam to ne treba, slobodno obrisite taj deo koda.
Poz, alex.
Alex: My favorite site is
http://localhost/
R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
tweet.13x ||
linkedin.13x