Solved

OpenStreamOnFile fails

Posted on 2002-05-03
5
779 Views
Last Modified: 2008-03-10
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
0
Comment
Question by:ronibr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6989023
This error cod is

MAPI_E_NOT_INITIALIZED 0x80040605

Call

MAPIInitialize( NULL);

before using MAPI...
0
 
LVL 86

Expert Comment

by:jkr
ID: 6989031
0
 
LVL 86

Accepted Solution

by:
jkr earned 300 total points
ID: 6989103
PLEASE, DO NOT EDIT THE QUESTION!

Obviously, my reply solved your initial Q...

This error code is

MAPI_E_NOT_FOUND 0x8004010f

The docs on 'OpenStreamOnFile()' state:

MAPI_E_NOT_FOUND
The designated file does not exist.

Are you sure the file you want to open is there?


----------------------------------------------------------
(Admin ref.: Q text as I am posting:
"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 ")
0
 
LVL 86

Expert Comment

by:jkr
ID: 6989106
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)...
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6989556
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question