473,405 Members | 2,141 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,405 software developers and data experts.

Dumb Question

How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read all of
it in a stream.

Thanks for any help,

Bob
Feb 28 '07 #1
3 1750


"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read all of
it in a stream.

Thanks for any help,

Bob

Code off top of my head:

Dim bytes As Byte()
Dim fileStream As FileStream = File.OpenRead("C:\myfile.emf")

Try
Dim len As Integer = CInt(fileStream.Length)
fileStream.Read(bytes, 0, len)
Finally
fileStream.Close()
End Try

Dim memStream As MemoryStream = New MemoryStream(bytes)

HTH,
Mythran
Mar 1 '07 #2
Thanks
"Mythran" <ki********@hotmail.comwrote in message
news:E3**********************************@microsof t.com...
>

"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
>How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read all
of it in a stream.

Thanks for any help,

Bob


Code off top of my head:

Dim bytes As Byte()
Dim fileStream As FileStream = File.OpenRead("C:\myfile.emf")

Try
Dim len As Integer = CInt(fileStream.Length)
fileStream.Read(bytes, 0, len)
Finally
fileStream.Close()
End Try

Dim memStream As MemoryStream = New MemoryStream(bytes)

HTH,
Mythran


Mar 1 '07 #3
Mythran wrote:
>

"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
>How do you read all the data from an enhanced metafile and put it in a
memory stream?

Myfile.emf is part of my solution but I can't get the trick to read
all of it in a stream.

Thanks for any help,

Bob


Code off top of my head:

Dim bytes As Byte()
Dim fileStream As FileStream = File.OpenRead("C:\myfile.emf")

Try
Dim len As Integer = CInt(fileStream.Length)
fileStream.Read(bytes, 0, len)
Finally
fileStream.Close()
End Try

Dim memStream As MemoryStream = New MemoryStream(bytes)

HTH,
Mythran

You ignore the return value of the call to the Read method. That means
that the entire file might not have been read, but you will silently
ignore that.

Get the return value of the call to see how much of the array that has
been filled, and loop until you have gotten the entire file.

If you are using framework 2.0+, you can instead use File.ReadAllBytes
to read the entire file.

--
Göran Andersson
_____
http://www.guffa.com
Mar 1 '07 #4

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

Similar topics

16
by: squash | last post by:
a dumb question i had on my mind: Say you have a dynamically created web page . Isn't it more secure to write it in php since a visitor will not be able to tell it is dynamically created? But...
15
by: Good Man | last post by:
Hey there I have a dumb question.... Let's say i have a database full of 4000 people.... I select everything from the database by: $result = mysql_query("SELECT * FROM People");
3
by: ed | last post by:
I've just started working with .Net, so appologize for what is probably a really dumb question. Did Windows XP originally come with the .Net framework installed, and if so which version? ...
2
by: InvisibleMan | last post by:
Hi, I feel a little dumb for asking this (considering im writing TSQL) but there doesn't seem to be any definitive answers on the search engines... Okay I understand that if you open the ADO...
2
by: TGF | last post by:
How do you copy a String type into a native char buffer? Dumb question, but not sure how to do it :( TGF
5
by: Need Help | last post by:
This might be an extremely dumb question; I'm new to Visual C++, and am trying to use the simple Spooler API, OpenPrinter, but when I try to compile my source file, it says OpenPrinter is an...
10
by: Edward | last post by:
I've just taken over maintaining a system from a colleague who has left. I find the following line in her code: Dim params(2) As SqlClient.SqlParameter params(0) = New...
4
by: Stelrad Doulton | last post by:
Hi, Apologies if this isn't the correct forum. I am writing a communication solution (actually on the Compact Framework) based on HttpWebRequests hooking up with custom handlers on the...
2
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new...
6
by: Robert Dufour | last post by:
What is the meaning of the word marshal and unmarshal in plain english as applied to an exe file? Does it mean the application has started and ended? Thanks for any help, Happy new year, Bob
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.