I'd like to convert a MAPI IMessage into a stream.
I searched the web for an example how to use IConverterSession but this
interface is very rarely documented.
Can somebody please tell me how to use this interface? Or does someone
has a codesnippet? Or should I go a completly other way?
Any help is appreciated.
regards
Martin
You can play wtih various IConverterSession methods and flags in OutlookSpy
(click Misc | IConverterSession).
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Martin Komischke" <makom...@arcor.de> wrote in message
news:46c55a8e$0$4529$9b4e...@newsspool3.arcor-online.net...
Dmitry Streblechenko wrote:
> Are you experiencing a particular problem? IConverterSession is really not
> that hard to use:
> 1. CoCreateInstance(CLSID_IConverterSession, ...)
> 2. IConverterSession::MAPIToMIMEStm(YouMAPIMessage, YourIStream, CCSF_SMTP)
In google groups I have searched for IConverterSession and found a post
which tells to create an own headerfile which defines this interface.
The headerfile contains the following:
#ifndef CONVERTERSESSION_H_INCLUDED
#define CONVERTERSESSION_H_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <comdef.h>
#include <Guiddef.h>
#include <initguid.h>
#if !defined(INITGUID) || defined(USES_IID_IConverterSession)
// {4e3a7680-b77a-11d0-9da5-00c04fd65685}
DEFINE_GUID(CLSID_IConverterSession, 0x4e3a7680, 0xb77a, 0x11d0,
0x9d, 0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
// { }
DEFINE_GUID(IID_IConverterSession, 0x4b401570, 0xb77b, 0x11d0, 0x9d,
0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
#endif // #if !defined(INITGUID) || defined(USES_IID_IConverterSession)
typedef enum tagENCODINGTYPE {
IET_BINARY = 0,
IET_BASE64 = 1,
IET_UUENCODE = 2,
IET_QP = 3,
IET_7BIT = 4,
IET_8BIT = 5,
IET_INETCSET = 6,
IET_UNICODE = 7,
IET_RFC1522 = 8,
IET_ENCODED = 9,
IET_CURRENT = 10,
IET_UNKNOWN = 11,
IET_BINHEX40 = 12,
IET_LAST = 13
} ENCODINGTYPE;
typedef enum tagMIMESAVETYPE {
SAVE_RFC822 = 0,
SAVE_RFC1521 = 1
} MIMESAVETYPE;
typedef enum tagCCSF {
CCSF_SMTP = 0x0002,
CCSF_NOHEADERS = 0x0004,
CCSF_NO_MSGID = 0x4000,
CCSF_USE_RTF = 0x0080,
CCSF_INCLUDE_BCC = 0x0020
} CCSF;
class __declspec(uuid("4e3a7680-b77a-11d0-9da5-00c04fd65685"))
CConverterSession;
/*#define CLSID_IConverterSession __uuidof(CConverterSession)*/
interface __declspec(uuid("4b401570-b77b-11d0-9da5-00c04fd65685"))
IConverterSession;
_COM_SMARTPTR_TYPEDEF(IConverterSession,__uuidof(IConverterSession));
/*#define IID_IConverterSession __uuidof(IConverterSession)*/
/**
* Allows conversions between MIME objects and MAPI messages.
* This can be useful in transporting messages across the Internet.
*
* @remarks Only these methods are supported in this interface:
*
* IConverterSession::SetEncoding, IConverterSession::MAPIToMIMEStm,
* and IConverterSession::MIMEToMAPI.
*
* Call SetEncoding before using the other methods to perform
conversion.
*/
interface IConverterSession : public IUnknown
{
//private:
//STDMETHOD(placeholder0)() PURE;
public:
/**
* Undocumented Function: Call this function before the
MAPIToMIME conversion
* to populate to, from, cc, and bcc fields with email address
information.
* @retval E_INVALIDARG The encoding type passed was invalid.
*/
STDMETHOD(SetAddressBook) ( LPADRBOOK pAddrBook ) PURE;
/**
* Initializes the encoding to be used during conversion.
*
* @retval E_INVALIDARG The encoding type passed was invalid.
*/
STDMETHOD(SetEncoding)(
/**
* An ENCODINGTYPE value. Only the following values are
supported:
*
* IET_BASE64, IET_UUENCODE, IET_QP, IET_7BIT, IET_8BIT
*/
ENCODINGTYPE et) PURE;
private:
STDMETHOD(placeholder1)() PURE;
public:
/**
* Converts a MIME stream to a MAPI message.
*
* @retval E_INVALIDARG pstm is NULL, pmsg is NULL,
* or ulFlags is invalid.
*/
STDMETHOD(MIMEToMAPI)(
/** [in] IStream interface to a MIME stream. */
LPSTREAM pstm,
/** [out] Pointer to the message to load. */
LPMESSAGE pmsg,
/** [in] This value must be NULL. */
LPCSTR pszSrcSrv,
/** [in] Flags. Zero (0) is the only supported value. */
ULONG ulFlags) PURE;
/**
* Converts a MAPI message to a MIME stream.
*
* @retval E_INVALIDARG Invalid flags were passed,
* or pmsg or pstm is NULL.
*
* @remarks Supported only for standard Outlook message types.
*/
STDMETHOD(MAPIToMIMEStm)(
/** [in] Pointer to the message to convert. */
LPMESSAGE pmsg,
/** [out] IStream interface to output the stream. */
LPSTREAM pstm,
/** [in] A flag of one of the following types:
* CCSF_NO_MSGID
* Do not include Message-Id field in outgoing messages.
* CCSF_NOHEADERS
* The converter should ignore the headers of the outside
message.
* CCSF_SMTP
* The converter is being passed an SMTP message.
*/
ULONG ulFlags) PURE;
private:
STDMETHOD(placeholder2)() PURE;
STDMETHOD(placeholder3)() PURE;
STDMETHOD(placeholder4)() PURE;
public:
STDMETHOD(SetTextWrapping(
/** [in] Whether to wrap text or not. */
BOOL fWrapText,
/** [in] The text wrapping width to use. */
ULONG ulWrapWidth)) PURE;
STDMETHOD(SetSaveFormat(
/** [in] The save format to be used for a MIME stream. For more
information, see the enum type MIMESAVETYPE.
SAVE_RFC1521 */
MIMESAVETYPE mstSaveFormat)) PURE;
private:
STDMETHOD(placeholder5)() PURE;
STDMETHOD(placeholder6)() PURE;
};
#endif // #ifndef CONVERTERSESSION_H_INCLUDED
In my cpp-file I have included this file and tried to create the
following instance:
IConverterSession* pConverterSession = NULL;
hr = CoCreateInstance(CLSID_IConverterSession, NULL,
CLSCTX_INPROC_SERVER, IID_IConverterSession, (void**)&pConverterSession);
but I get 2 compile errors which say:
CLSID_IConverterSession is undeclared
IID_IConverterSession is undeclared
Can you tell me what I have forgotten?
> You can play wtih various IConverterSession methods and flags in OutlookSpy
> (click Misc | IConverterSession).
Yes I have checked this out ... very nice!
Martin
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Martin Komischke" <makom...@arcor.de> wrote in message
news:46cbf779$0$4523$9b4e...@newsspool3.arcor-online.net...
Dmitry Streblechenko wrote:
> i do not use C++, but it sure sounds like your compiler does not see the
> definition for these two GUIDs?
> Did you define USES_IID_IConverterSession?
I changed this and now everything is compileable. But I have another
problem: I want to write the stream into a file - but this file is not
created. Can you tell me whats wrong here?
HRESULT CMyMapi::ProcessMessage(LPMESSAGE lpMsg)
{
HRESULT hr = S_OK;
LPTSTR lpszFileName = _T("c:\\temp\\stream.dat");
LPSTREAM pStream = NULL;
IConverterSession* pConvSess = NULL;
hr = CoCreateInstance(CLSID_IConverterSession, NULL,
CLSCTX_INPROC_SERVER, IID_IConverterSession, (void**)&pConvSess);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("CoCreateInstance failed"));
goto failed;
}
hr = pConvSess->SetEncoding(IET_QP);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("SetEncoding failed"));
goto failed;
}
hr = pConvSess->SetSaveFormat(SAVE_RFC822);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("SetSaveFormat failed"));
goto failed;
}
hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer, STGM_CREATE |
STGM_READWRITE, lpszFileName, NULL, &pStream);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("OpenStreamOnFile failed"));
goto failed;
}
hr = pConvSess->MAPIToMIMEStm(lpMsg, pStream, 0);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("MAPIToMIMEStm failed"));
goto failed;
}
hr = pStream->Commit(0);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("Commit failed"));
goto failed;
}
failed:
if (pStream)
pStream->Release();
if (pConvSess)
pConvSess->Release();
return hr;
}
Thanks for your help.
Martin
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Martin Komischke" <makom...@arcor.de> wrote in message
news:46cd52fa$0$7704$9b4e...@newsspool2.arcor-online.net...
When I open the stream over a _temporary created_ file with the
following code:
hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer,
SOF_UNIQUEFILENAME | STGM_DELETEONRELEASE | STGM_CREATE |
STGM_READWRITE, NULL, NULL, &pStream);
the stream is written correctly! I have checked this by searching %temp%
and opening a file called SOF60.tmp. (It seems to be something wrong
when specifying the filename of the temporary file explicitly.)
After calling Commit(0) on the stream I try to get the filename from the
STATSTG structure by:
STATSTG stat;
hr = pStream->Stat(&stat, STATFLAG_DEFAULT);
But pwcsName is allways 0x00000000!
Can you tell me whats wrong here?
thanks for your help!
Martin
when replacing this statement with:
hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer,
STGM_CREATE | STGM_READWRITE, (LPTSTR)("c:\\temp\\temp.tmp"), NULL,
&pStream);
the file is written! Whilst:
hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer,
STGM_CREATE | STGM_READWRITE, _T("c:\\temp\\temp.tmp"), NULL, &pStream);
does not create a file! hr is in both case S_OK. That sucks.
Martin
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Martin Komischke" <makom...@arcor.de> wrote in message
news:46cea56a$0$16110$9b4e...@newsspool1.arcor-online.net...
OK, that flag is not neccessary. But the file was not created event the
flag was not set. The problem was the filename argument.
Thanks for your help so far.
hr = CoCreateInstance(CLSID_IConverterSession, NULL,
CLSCTX_INPROC_SERVER, IID_IConverterSession, (void**)&pConvSess);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("CoCreateInstance failed"));
goto failed;
}
hr = pConvSess->SetEncoding(IET_QP);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("SetEncoding failed"));
goto failed;
}
hr = pConvSess->SetSaveFormat(SAVE_RFC822);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("SetSaveFormat failed"));
goto failed;
}
hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer, STGM_CREATE |
STGM_READWRITE, lpszFileName, NULL, &pStream);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("OpenStreamOnFile failed"));
goto failed;
}
hr = pConvSess->MAPIToMIMEStm(lpMsg, pStream, 0);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("MAPIToMIMEStm failed"));
goto failed;
}
hr = pStream->Commit(0);
if (FAILED(hr))
{
DBGLOG(LOG_ERR, _T("Commit failed"));
goto failed;
}
failed:
if (pStream)
pStream->Release();
if (pConvSess)
pConvSess->Release();
return hr;
}
>>>>
MAPIToMIMEStm API is failing with E_INVALIDARG as returned value.
Any idea? why is this happening?
I have Pmsg and Pstream as non-null.
class NativeMethods
{
public enum CLSCTX
{
CLSCTX_INPROC_SERVER = 0x1,
CLSCTX_INPROC_HANDLER = 0x2,
CLSCTX_LOCAL_SERVER = 0x4,
CLSCTX_REMOTE_SERVER = 0x10,
CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
CLSCTX_ALL = CLSCTX_SERVER | CLSCTX_INPROC_HANDLER
}
public static Guid CLSID_IConverterSession = new Guid("{4e3a7680-b77a-11d0-9da5-00c04fd65685}");
public static Guid IID_IConverterSession = new Guid("{4b401570-b77b-11d0-9da5-00c04fd65685}");
public enum ENCODINGTYPE
{
IET_BINARY = 0,
IET_BASE64 = 1,
IET_UUENCODE = 2,
IET_QP = 3,
IET_7BIT = 4,
IET_8BIT = 5,
IET_INETCSET = 6,
IET_UNICODE = 7,
IET_RFC1522 = 8,
IET_ENCODED = 9,
IET_CURRENT = 10,
IET_UNKNOWN = 11,
IET_BINHEX40 = 12,
IET_LAST = 13
}
public enum MIMESAVETYPE
{
SAVE_RFC822 = 0,
SAVE_RFC1521 = 1
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("4b401570-b77b-11d0-9da5-00c04fd65685")]
public interface IConverterSession
{
[PreserveSig]
int Placeholder0();
[PreserveSig]
int SetEncoding(
[In, MarshalAs(UnmanagedType.I4)] ENCODINGTYPE DispId
);
[PreserveSig]
int Placeholder1();
[PreserveSig]
int MIMEToMAPI(
[In, MarshalAs(UnmanagedType.Interface)]
Stream pstm,
[Out, MarshalAs(UnmanagedType.Interface)]
MailItem pmsg,
object pszSrcSrv,
uint ulFlags
);
[PreserveSig]
int MAPIToMIMEStm(
[In, MarshalAs(UnmanagedType.Interface)]
MailItem pmsg,
[Out, MarshalAs(UnmanagedType.Interface)]
Stream pstm,
uint ulFlags
);
[PreserveSig]
int Placeholder2();
[PreserveSig]
int Placeholder3();
[PreserveSig]
int Placeholder4();
[PreserveSig]
int SetTextWrapping(
bool fWrapText,
uint ulWrapWidth
);
[PreserveSig]
int SetSaveFormat(
[In, MarshalAs(UnmanagedType.I4)]
MIMESAVETYPE mstSaveFormat
);
[PreserveSig]
int Placeholder5();
[PreserveSig]
int Placeholder6();
}
}
I created an Instance of IConverterSession.I tried calling methods SetEncoding(), SetSaveFormat() on that instance, these methods are executed successfully. But when I call MIMEToMAPI() on the same instance it gives following exception - "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Here is the code I am using -
Type converter = Type.GetTypeFromCLSID(NativeMethods.CLSID_IConverterSession);
object obj = Activator.CreateInstance(converter);
NativeMethods.IConverterSession session = (NativeMethods.IConverterSession)obj;
int hr = session.SetEncoding(NativeMethods.ENCODINGTYPE.IET_QP);
hr = session.SetSaveFormat(NativeMethods.MIMESAVETYPE.SAVE_RFC822);
if (session != null)
{
Application olApp = new Application();
NameSpace nSpace = olApp.GetNamespace("MAPI");
MailItem msg = (MailItem)olApp.CreateItem(OlItemType.olMailItem);
FileStream stm = File.OpenRead("C:\\e.eml");
hr = session.MIMEToMAPI(stm, msg, null, 0);
msg.Save();
}
I also tried using CoCreateInstance() instead of Activator.CreateInstance() but that also doesn't helped.
Any input on this will be appreciated.
Thanks.
EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com/default.aspx?ref=ng
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
<sonali gupta> wrote in message news:200911562419...@gmail.com...
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message
news:%2398VDDz...@TK2MSFTNGP02.phx.gbl...
and calling:
session.MIMEToMAPI(file, msg.MAPIOBJECT, null, 2);
where session is a IConverterSession and msg is a MailItem.
It does not work (just the same errore).
Where is the error? Is the signature correct?
Thanks.
Sektor
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message
news:ef7%23shAeJ...@TK2MSFTNGP03.phx.gbl...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sektor" <sek...@sektor.it> wrote in message
news:eiH$6%23BeJH...@TK2MSFTNGP05.phx.gbl...
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int MIMEToMAPI(
[In, MarshalAs(UnmanagedType.Interface)]
Stream pstm,
[Out, MarshalAs(UnmanagedType.Interface)]
IMessage pmsg,
object pszSrcSrv,
uint ulFlags
);
[ComVisible(false)]
[ComImport()]
[Guid("00020307-0000-0000-C000-000000000046")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMessage
{
}
Making the cast:
NativeMethods.IMessage imsg = (NativeMethods.IMessage) msg.MAPIOBJECT;
I have this exception:
Unable to cast COM object of type 'System.__ComObject' to interface type
'IMessage'. This operation failed because the QueryInterface call on the COM
component for the interface with IID
'{00020307-0000-0000-C000-000000000046}' failed due to the following error:
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)).
Thanks
Sektor
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message
news:u5DQnFCe...@TK2MSFTNGP06.phx.gbl...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sektor" <sek...@sektor.it> wrote in message
news:enhz$QCeJH...@TK2MSFTNGP03.phx.gbl...
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message
news:%23nMC9TC...@TK2MSFTNGP04.phx.gbl...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sektor" <sek...@sektor.it> wrote in message
news:eU27SXCe...@TK2MSFTNGP04.phx.gbl...
Unfortunately MIMEToMAPI raises the exception:
The runtime has encountered a fatal error. The address of the error was at
0x7a0981b5, on thread 0x9cc. The error code is 0xc0000005. This error may be
a bug in the CLR or in the unsafe or non-verifiable portions of user code.
Common sources of this bug include user marshaling errors for COM-interop or
PInvoke, which may corrupt the stack.
It's a standard "Access Violation"!
Any other idea?
Thanks.
Sektor
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message
news:ewOeoaCe...@TK2MSFTNGP03.phx.gbl...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sektor" <sek...@sektor.it> wrote in message
news:OYXED0Ce...@TK2MSFTNGP05.phx.gbl...
Thanks a lot.
Sektor
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message
news:eqfMIGDe...@TK2MSFTNGP05.phx.gbl...
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Sektor" <sek...@sektor.it> wrote in message
news:uBcVs%23IeJ...@TK2MSFTNGP06.phx.gbl...
>> On Friday, August 17, 2007 11:38 AM Dmitry Streblechenko wrote:
>> Are you experiencing a particular problem? IConverterSession is really not
>> that hard to use:
>> 1. CoCreateInstance(CLSID_IConverterSession, ...)
>> 2. IConverterSession::MAPIToMIMEStm(YouMAPIMessage, YourIStream, CCSF_SMTP)
>>
>> You can play wtih various IConverterSession methods and flags in OutlookSpy
>> (click Misc | IConverterSession).
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "Martin Komischke" <makom...@arcor.de> wrote in message
>> news:46c55a8e$0$4529$9b4e...@newsspool3.arcor-online.net...
>>> On Wednesday, August 22, 2007 4:40 AM Martin Komischke wrote:
>>> Thanks for your answer.
>>>
>>> Dmitry Streblechenko wrote:
>>>
>>> In google groups I have searched for IConverterSession and found a post
>>> which tells to create an own headerfile which defines this interface.
>>> The headerfile contains the following:
>>>
>>> #define CONVERTERSESSION_H_INCLUDED
>>>
>>> #if _MSC_VER > 1000
>>> #pragma once
>>> #endif // _MSC_VER > 1000
>>>
>>> #include <comdef.h>
>>> #include <Guiddef.h>
>>>
>>> #if !defined(INITGUID) || defined(USES_IID_IConverterSession)
>>> // {4e3a7680-b77a-11d0-9da5-00c04fd65685}
>>> DEFINE_GUID(CLSID_IConverterSession, 0x4e3a7680, 0xb77a, 0x11d0,
>>> 0x9d, 0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
>>> // { }
>>> DEFINE_GUID(IID_IConverterSession, 0x4b401570, 0xb77b, 0x11d0, 0x9d,
>>> 0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
>>> #endif // #if !defined(INITGUID) || defined(USES_IID_IConverterSession)
>>>
>>> typedef enum tagENCODINGTYPE {
>>> IET_BINARY = 0,
>>> IET_BASE64 = 1,
>>> IET_UUENCODE = 2,
>>> IET_QP = 3,
>>> IET_7BIT = 4,
>>> IET_8BIT = 5,
>>> IET_INETCSET = 6,
>>> IET_UNICODE = 7,
>>> IET_RFC1522 = 8,
>>> IET_ENCODED = 9,
>>> IET_CURRENT = 10,
>>> IET_UNKNOWN = 11,
>>> IET_BINHEX40 = 12,
>>> IET_LAST = 13
>>> } ENCODINGTYPE;
>>>
>>> typedef enum tagMIMESAVETYPE {
>>> SAVE_RFC822 = 0,
>>> SAVE_RFC1521 = 1
>>>
>>> IConverterSession* pConverterSession = NULL;
>>> hr = CoCreateInstance(CLSID_IConverterSession, NULL,
>>> CLSCTX_INPROC_SERVER, IID_IConverterSession, (void**)&pConverterSession);
>>>
>>> but I get 2 compile errors which say:
>>> CLSID_IConverterSession is undeclared
>>> IID_IConverterSession is undeclared
>>>
>>> Can you tell me what I have forgotten?
>>>
>>>
>>> Yes I have checked this out ... very nice!
>>>
>>> Martin
>>>> On Wednesday, August 22, 2007 1:03 PM Dmitry Streblechenko wrote:
>>>> i do not use C++, but it sure sounds like your compiler does not see the
>>>> definition for these two GUIDs?
>>>> Did you define USES_IID_IConverterSession?
>>>>
>>>> Dmitry Streblechenko (MVP)
>>>> http://www.dimastr.com/
>>>> OutlookSpy - Outlook, CDO
>>>> and MAPI Developer Tool
>>>>
>>>> "Martin Komischke" <makom...@arcor.de> wrote in message
>>>> news:46cbf779$0$4523$9b4e...@newsspool3.arcor-online.net...
>>>>> On Thursday, August 23, 2007 5:23 AM Martin Komischke wrote:
>>>>> Hi,
>>>>>
>>>>> Dmitry Streblechenko wrote:
>>>>>
>>>>>
>>>>> I changed this and now everything is compileable. But I have another
>>>>> problem: I want to write the stream into a file - but this file is not
>>>>> created. Can you tell me whats wrong here?
>>>>> Thanks for your help.
>>>>> Martin
>>>>>> On Thursday, August 23, 2007 1:19 PM Dmitry Streblechenko wrote:
>>>>>> Looks perfectly fine to me. Do you get any errors? Can you read the data
>>>>>> from the stream?
>>>>>>
>>>>>> Dmitry Streblechenko (MVP)
>>>>>> http://www.dimastr.com/
>>>>>> OutlookSpy - Outlook, CDO
>>>>>> and MAPI Developer Tool
>>>>>>> On Friday, August 24, 2007 4:57 AM Martin Komischke wrote:
>>>>>>> Dmitry Streblechenko wrote:
>>>>>>>
>>>>>>> When I open the stream over a _temporary created_ file with the
>>>>>>> following code:
>>>>>>>
>>>>>>> hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer,
>>>>>>> SOF_UNIQUEFILENAME | STGM_DELETEONRELEASE | STGM_CREATE |
>>>>>>> STGM_READWRITE, NULL, NULL, &pStream);
>>>>>>>
>>>>>>> the stream is written correctly! I have checked this by searching %temp%
>>>>>>> and opening a file called SOF60.tmp. (It seems to be something wrong
>>>>>>> when specifying the filename of the temporary file explicitly.)
>>>>>>>
>>>>>>>
>>>>>>> After calling Commit(0) on the stream I try to get the filename from the
>>>>>>> STATSTG structure by:
>>>>>>>
>>>>>>> STATSTG stat;
>>>>>>> hr = pStream->Stat(&stat, STATFLAG_DEFAULT);
>>>>>>>
>>>>>>> But pwcsName is allways 0x00000000!
>>>>>>>
>>>>>>> Can you tell me whats wrong here?
>>>>>>>
>>>>>>> thanks for your help!
>>>>>>>
>>>>>>> Martin
>>>>>>>> On Friday, August 24, 2007 5:27 AM Martin Komischke wrote:
>>>>>>>> Martin Komischke wrote:
>>>>>>>>
>>>>>>>> when replacing this statement with:
>>>>>>>> hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer,
>>>>>>>> STGM_CREATE | STGM_READWRITE, (LPTSTR)("c:\\temp\\temp.tmp"), NULL,
>>>>>>>> &pStream);
>>>>>>>>
>>>>>>>> the file is written! Whilst:
>>>>>>>> hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer,
>>>>>>>> STGM_CREATE | STGM_READWRITE, _T("c:\\temp\\temp.tmp"), NULL, &pStream);
>>>>>>>>
>>>>>>>> does not create a file! hr is in both case S_OK. That sucks.
>>>>>>>>
>>>>>>>> Martin
>>>>>>>>> On Friday, August 24, 2007 1:21 PM Dmitry Streblechenko wrote:
>>>>>>>>> Why do you specify STGM_DELETEONRELEASE? That will cause the fileto be
>>>>>>>>> deleted when the stream is released.
>>>>>>>>>
>>>>>>>>> Dmitry Streblechenko (MVP)
>>>>>>>>> http://www.dimastr.com/
>>>>>>>>> OutlookSpy - Outlook, CDO
>>>>>>>>> and MAPI Developer Tool
>>>>>>>>>
>>>>>>>>> "Martin Komischke" <makom...@arcor.de> wrote in message
>>>>>>>>> news:46cea56a$0$16110$9b4e...@newsspool1.arcor-online.net...
>>>>>>>>>> On Tuesday, August 28, 2007 6:17 AM Martin Komischke wrote:
>>>>>>>>>> Dmitry Streblechenko wrote:
>>>>>>>>>>
>>>>>>>>>> OK, that flag is not neccessary. But the file was not created event the
>>>>>>>>>> flag was not set. The problem was the filename argument.
>>>>>>>>>>
>>>>>>>>>> Thanks for your help so far.
>>>>>>>>>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>>>>>>>>>> Autocorrelation method in C# for signal analysis
>>>>>>>>>>>> http://www.eggheadcafe.com/tutorials/aspnet/d39ee525-a402-46cf-9989-72b7256f76b1/autocorrelation-method-in-c-for-signal-analysis.aspx