Link to home
Start Free TrialLog in
Avatar of ronibr
ronibr

asked on

OpenStreamOnFile fails

I noticed that I didnt call MAPIInit() , this is obvious
but my question is harder

Hello there !
I'm working on VC++ 6.0 on a Windows 2000 machine.
I'm trying to get IStream interface for a file, and I found the
function OpenStreamOnFile , which is part of the MAPI.

I'm calling this function:

LPSTREAM pStreamFile;
               
HRESULT     hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer,STGM_READ, "C:\\testfile", NULL, &pStreamFile);

The file "testfile" exists.

The functio fails with return code hr = 0x8004010f.

Does anyway has any idea why the function is failing ?

please help - i have no idea !

thanks , Ron
Avatar of jkr
jkr
Flag of Germany image

This error cod is

MAPI_E_NOT_INITIALIZED 0x80040605

Call

MAPIInitialize( NULL);

before using MAPI...
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Please note that editing a Q brings all comments out of context - DO NOT DO THAT unless it is absolutely necessary (and it wasn't necessary here)...
ronibr, please edit your question.  Replace this:

I noticed that I didnt call MAPIInit() , this is obvious
but my question is harder

with this:

jkr has noticed that I forgot to call MAPIInit().  This is now obvious, though I didn't have a clue until it just magically came to me in a dream at 12:25PM PST.  I think that I will now abandon this question like I have often done in the past.
=-=-=-=-=-=-=-=-=-
That will be much more truthful, don't you agree?

-- Dan