By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Application update

P: n/a

I'm trying to update my program to manage bitmap file written in vb 6.0

For bmp files accessing i used functions like those...
Open NameBmp For Binary As #1
Get #1, 11, pixelOffset
Get #1, 19, w 'Width
Get #1, 23, h 'Height

declaring

dim w as long
dim h as long
dim pixelOffset as long

How can obtain the same in VB.NET?
I tried with

Dim fs As FileStream = File.Open(NomeBmp, _
FileMode.Open, _
FileAccess.Read, _
FileShare.None)

fs.Read(pixelOffset, 11, 7)
fs.Read(h, 19, 4)
fs.Read(w, 23, 4)

but Read method retrieved an array of Byte and doesn't store the read bytes
in a Long variables as Get statement, so i can't do something like

CalculateMultiple4(w * 3)

How can i do?

Sep 24 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Marco Biagioni" <ma*******@interfree.itschrieb
>
I'm trying to update my program to manage bitmap file written in vb
6.0

For bmp files accessing i used functions like those...
Open NameBmp For Binary As #1
Get #1, 11, pixelOffset
Get #1, 19, w 'Width
Get #1, 23, h 'Height

declaring

dim w as long
dim h as long
dim pixelOffset as long

How can obtain the same in VB.NET?
I tried with

Dim fs As FileStream = File.Open(NomeBmp, _
FileMode.Open, _
FileAccess.Read, _
FileShare.None)

fs.Read(pixelOffset, 11, 7)
fs.Read(h, 19, 4)
fs.Read(w, 23, 4)

but Read method retrieved an array of Byte and doesn't store the
read bytes in a Long variables as Get statement, so i can't do
something like

CalculateMultiple4(w * 3)

How can i do?
Have you already tried loading the VB6 application in VB.Net? The upgrade
wizard will upgrade the code (AGAP). As you probably know (if not, this is
the first thing you should learn), the Long data type has 64 bits now, and
Integer (equal to Int32) has 32 bits.

You can read directly from the Filestream or you can get help from a
BinaryReader.

dim br as io.binaryreader
br = new io.binaryreader(fs)

fs.seek(11, IO.SeekOrigin.Begin)
pixeloffset = br.readint32

Armin

Sep 24 '07 #2

P: n/a
Thanks i solved my problem...unfortunatly VB.NET can't convert properly my
old project so i have to rewrite all...but what about the REDIM statement?
It retrieves me an error when i try to use it to resize the dimension of a
matrix...

ReDim Object.g(1 To .w3, 1 To .h)
"Armin Zingler" <az*******@freenet.deha scritto nel messaggio
news:eq**************@TK2MSFTNGP05.phx.gbl...
"Marco Biagioni" <ma*******@interfree.itschrieb
>>
I'm trying to update my program to manage bitmap file written in vb
6.0

For bmp files accessing i used functions like those...
Open NameBmp For Binary As #1
Get #1, 11, pixelOffset
Get #1, 19, w 'Width
Get #1, 23, h 'Height

declaring

dim w as long
dim h as long
dim pixelOffset as long

How can obtain the same in VB.NET?
I tried with

Dim fs As FileStream = File.Open(NomeBmp, _
FileMode.Open, _
FileAccess.Read, _
FileShare.None)

fs.Read(pixelOffset, 11, 7)
fs.Read(h, 19, 4)
fs.Read(w, 23, 4)

but Read method retrieved an array of Byte and doesn't store the
read bytes in a Long variables as Get statement, so i can't do
something like

CalculateMultiple4(w * 3)

How can i do?

Have you already tried loading the VB6 application in VB.Net? The upgrade
wizard will upgrade the code (AGAP). As you probably know (if not, this is
the first thing you should learn), the Long data type has 64 bits now, and
Integer (equal to Int32) has 32 bits.

You can read directly from the Filestream or you can get help from a
BinaryReader.

dim br as io.binaryreader
br = new io.binaryreader(fs)

fs.seek(11, IO.SeekOrigin.Begin)
pixeloffset = br.readint32

Armin
Sep 25 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.