Click here to Skip to main content
15,914,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralAutomatically determing Save File Dialog filter type Pin
Andy Moore16-Jul-04 7:13
Andy Moore16-Jul-04 7:13 
GeneralRe: Automatically determing Save File Dialog filter type Pin
palbano16-Jul-04 7:29
palbano16-Jul-04 7:29 
GeneralRe: Automatically determing Save File Dialog filter type Pin
Andy Moore16-Jul-04 7:44
Andy Moore16-Jul-04 7:44 
GeneralRe: Automatically determing Save File Dialog filter type Pin
Maximilien16-Jul-04 8:04
Maximilien16-Jul-04 8:04 
GeneralRe: Automatically determing Save File Dialog filter type Pin
Andy Moore16-Jul-04 8:07
Andy Moore16-Jul-04 8:07 
GeneralRe: Automatically determing Save File Dialog filter type Pin
David Crow16-Jul-04 8:16
David Crow16-Jul-04 8:16 
GeneralRe: Automatically determing Save File Dialog filter type Pin
Andy Moore16-Jul-04 10:08
Andy Moore16-Jul-04 10:08 
GeneralRe: Automatically determing Save File Dialog filter type Pin
Maximilien16-Jul-04 7:46
Maximilien16-Jul-04 7:46 
GeneralCustom data type in ActiveX property Pin
iluha16-Jul-04 7:12
iluha16-Jul-04 7:12 
GeneralCEdit's Text Color when Disabled Pin
Vladimir Georgiev16-Jul-04 7:06
Vladimir Georgiev16-Jul-04 7:06 
GeneralRe: CEdit's Text Color when Disabled Pin
David Crow16-Jul-04 7:08
David Crow16-Jul-04 7:08 
GeneralRe: CEdit's Text Color when Disabled Pin
Ulric Auger20-Oct-09 18:36
Ulric Auger20-Oct-09 18:36 
GeneralAccessing Shared Resource from a Windows "Service" Pin
Petrus Scott16-Jul-04 7:03
Petrus Scott16-Jul-04 7:03 
GeneralRe: Accessing Shared Resource from a Windows "Service" Pin
palbano16-Jul-04 7:09
palbano16-Jul-04 7:09 
GeneralRe: Accessing Shared Resource from a Windows "Service" Pin
Petrus Scott16-Jul-04 7:48
Petrus Scott16-Jul-04 7:48 
GeneralRe: Accessing Shared Resource from a Windows "Service" Pin
palbano16-Jul-04 8:29
palbano16-Jul-04 8:29 
GeneralAccessing resources Pin
0v3rloader16-Jul-04 6:46
0v3rloader16-Jul-04 6:46 
GeneralRe: Accessing resources Pin
David Crow16-Jul-04 7:06
David Crow16-Jul-04 7:06 
Questionhow to receive outgoing message Pin
Anton Zarubin16-Jul-04 5:37
Anton Zarubin16-Jul-04 5:37 
GeneralRe: how to receive outgoing message Pin
David Crow16-Jul-04 7:02
David Crow16-Jul-04 7:02 
GeneralRe: how to receive outgoing message Pin
Eugene Grudina16-Jul-04 8:27
sussEugene Grudina16-Jul-04 8:27 
AnswerRe: how to receive outgoing message Pin
Antti Keskinen16-Jul-04 8:22
Antti Keskinen16-Jul-04 8:22 
GeneralRe: how to receive outgoing message Pin
Anton Zarubin17-Jul-04 0:36
Anton Zarubin17-Jul-04 0:36 
GeneralRe: how to receive outgoing message Pin
Antti Keskinen17-Jul-04 5:30
Antti Keskinen17-Jul-04 5:30 
Well, in order to get you going, here's a complete code-paste of a switch statement that catches an outgoing mail message and displays it in a message box:
// At the start of the file, add the following line
// IMailItem interface identifier
const IID IID_IMailItem  = 
{0x00063034,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};<DIV>

.
.
.<DIV>

switch(dispIdMember)
{
case 0x0000f002:        // ItemSend
	{
		// First, find the IDispatch interface parameter
		IDispatch* pDisp = NULL;<DIV>			
		for ( UINT nIndex = 0; nIndex < pDispParams->cArgs; nIndex++ )
		{
			// Check if the VARIANTARG is type VT_DISPATCH
			if ( pDispParams->rgvarg[nIndex].vt == VT_DISPATCH )
			{
				// Yup, so copy
				pDisp = pDispParams->rgvarg[1].pdispVal;
				break;
			}
		}<DIV>
			
		// See if it is a mail item. It is if it supports _MailItem interface
		IUnknown* pMail; 
		HRESULT hr = pDisp->QueryInterface( IID_IMailItem, (void**)&pMail );<DIV>

		if ( SUCCEEDED(hr) )
		{
			CMailItem MailItem;
			MailItem.AttachDispatch( pDisp );<DIV>

			CString csBody = MailItem.get_Body();<DIV>

			AfxMessageBox( (LPCTSTR) csBody );
		}<DIV>

		pMail->Release(); pMail = NULL;<DIV>

		break;
	}
}
I've tested this with my own Outlook XP (2002), and it captures outgoing mail messages correctly, and ignores other outgoing items. Copy the interface identifier to the start of the code file, and replace your switch statement with this code piece. Add a breakpoint, start Outlook, run the app in debug mode and observe the results. Although it works for me, it's not guaranteed to work for you out of the box, so be careful.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralWindows Logon Dialog Pin
Anthony988716-Jul-04 5:11
Anthony988716-Jul-04 5:11 

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.