473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Compound file enumeration

Hi all,

I am trying to enumerate the elements of a Compound storage file and I get an error (System.NullReferenceException) when I execute the "EnumElements" of the "UCOMIStorage". I can open the Compound file just fine just can't enumerate it's elements. Am I declaring something incorrectly?

Sample Code:

// Declaration of UCOMIStorage
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown ), Guid("0000000b-0000-0000-C000-000000000046")]
interface UCOMIStorage
{
void CreateStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
int grfMode, //Access mode for the new stream
int reserved1, //Reserved; must be zero
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void OpenStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
IntPtr reserved1, //Reserved; must be NULL
int grfMode, //Access mode for the new stream
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void EnumElements(
int reserved1,
IntPtr reserved2,
int reserved3,
out IEnumSTATSTG ppenum);
}
// Declaration of IEnumSTATSTG
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown ), Guid("0000000d-0000-0000-C000-000000000046")]
interface IEnumSTATSTG
{
void Next(Int64 celt, out STATSTG rgelt, out Int64 pceltFetched);
}

Nov 15 '05 #1
1 3351
nevermind I got it needed to define all of the interface methods.

Regards,
-Max
"Max Akbar" <ma*********@hotmail.com> wrote in message news:OD*************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am trying to enumerate the elements of a Compound storage file and I get an error (System.NullReferenceException) when I execute the "EnumElements" of the "UCOMIStorage". I can open the Compound file just fine just can't enumerate it's elements. Am I declaring something incorrectly?

Sample Code:

// Declaration of UCOMIStorage
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown ), Guid("0000000b-0000-0000-C000-000000000046")]
interface UCOMIStorage
{
void CreateStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
int grfMode, //Access mode for the new stream
int reserved1, //Reserved; must be zero
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void OpenStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
IntPtr reserved1, //Reserved; must be NULL
int grfMode, //Access mode for the new stream
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void EnumElements(
int reserved1,
IntPtr reserved2,
int reserved3,
out IEnumSTATSTG ppenum);
}
// Declaration of IEnumSTATSTG
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown ), Guid("0000000d-0000-0000-C000-000000000046")]
interface IEnumSTATSTG
{
void Next(Int64 celt, out STATSTG rgelt, out Int64 pceltFetched);
}

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Eric Laberge | last post by:
Aloha! This question is meant to be about C99 and unnamed compound objects. As I read, if such a construct as int *p = (int){0}; is used within a function, then it has "automatic storage...
3
by: Polo | last post by:
Hi, We developped an application that save files as a compound document. Now we developp a new version in net and we would like to import old file format. What is the best way. A sample or a...
7
by: Timo Haberkern | last post by:
Hi there, i have some troubles with my TSearch2 Installation. I have done this installation as described in http://www.sai.msu.su/~megera/oddmuse/index.cgi/Tsearch_V2_compound_words...
0
by: delphiconsultingguy | last post by:
Hi all, Spent WAAAYYY too much time trying to figure this out because there's not many good examples out there, so in the interest of sparing y'all from suff'rin same, I've pasted it into...
0
by: kath | last post by:
Hi.... XLRDError: Can't find workbook in OLE2 compound document What does this error means? When I try to open some excel files using XLRD, I encounter this error. Not with every excel, but...
9
by: Jameson.Quinn | last post by:
I have: try: for line in open(myFileName): count += 1 except IOError: print "Can't open myfile" (I know, this is bad, I never close the file, but its just for illustration). But then I...
1
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
27
by: Nate Eldredge | last post by:
Consider the following pseudo-code: #include <opaque.h> struct foo { int a; opaque_t op; int b; };
1
by: sanabeel | last post by:
Hello all, I want to read the following file through java.... Anyone who knows plz help me ... The file is <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns="http://ContextML/1.6c"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.