borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (command button messages)Next Topic (Hook Programming) New Topic New Poll Post Reply
AndreaVB Forum : API : header as BM,MZ
Poster Message
siddhs
Level: Professor

Registered: 02-03-2003
Posts: 92

icon header as BM,MZ

hello everyone

How can i know the header of a file...for e.g.: BMP files have BM(66)or (77),Exe files have MZ (77) or (90)..etc...

any sites ?? codes ?? please help....

Is sheader() using for the above thing ??

please reply,
siddhs

____________________________
FireFox - Its Yours & Its Free
Here it is

45 Gmail Invities left ;) ....PM me to get one...

17-04-2003 at 06:40 PM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1616
icon Re: header as BM,MZ

Are you referring to the first code in the file?

Well, other than checking the extension, which would give a pretty good idea without anything else. You could open the file for reading, and just check the first character for a match. (open the file as binary).

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

17-04-2003 at 07:22 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Lycaon
Level: Guest

icon Re: header as BM,MZ

Try this, but be aware that not all file formats have a two char identifier in the beginning of the file.


Private Sub CheckHeader()
Dim sHeader As String * 2 ' Force to 2 chars in length
Dim ff As Integer              ' Use FreeFile.  Using #1 for all your file input is BAD :p

ff = FreeFile

Open "C:\fake.exe" For Binary Access Read As #ff
Get #ff, , sHeader
Close #ff

MsgBox "Header chars are: " & sHeader, vbInformation Or vbOkOnly, "Result"

End Sub

23-06-2004 at 03:07 PM
| Quote Reply
Afshin_Zavar
Level: Sage

Registered: 17-07-2003
Posts: 64
icon Re: header as BM,MZ

open desired file and read it's first 2 bytes from header of file.
and check it whit "IF"

____________________________
Persia

02-07-2004 at 08:27 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : API : header as BM,MZ
Previous Topic (command button messages)Next Topic (Hook Programming) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder