Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 17th, 2007, 10:55 AM
Authorized User
 
Join Date: Oct 2006
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ricespn
Default File Details

Hi,

How can I read the details of a file with Visual Basic, like name, size, type, date, dimensions.

=======================
Strange and crazy, but everything is possible
__________________
=======================
Strange and crazy, but everything is possible
 
Old April 17th, 2007, 10:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

best think you can do is to use the filesystemobject.. there way you can get all the data from a file or folder...



HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
 
Old April 17th, 2007, 12:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

for the name, use Dir()
for the size: FileLen()
for the type: GetAttr()
for the date: FileDateTime()

"There are two ways to write error-free programs. Only the third one works."
Unknown
 
Old April 17th, 2007, 07:48 PM
Authorized User
 
Join Date: Oct 2006
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ricespn
Default

Thanks guys!

How about getting the dimensions of a TIFF file or image, when I select an image windows shows the dimension of that image, is there a way to read that information with visual basic?

=======================
Strange and crazy, but everything is possible
 
Old April 18th, 2007, 03:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, use LoadPicture to load the file in a StdPicture object, then use the Width and Height properties of StdPicture (although I do not know if LoadPicture works with TIFF files)

"There are two ways to write error-free programs. Only the third one works."
Unknown
 
Old April 18th, 2007, 03:55 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

So, if LoadPicture does not work with TIFF files, that would be the third way your signature refers to? :)
 
Old April 19th, 2007, 02:10 PM
Authorized User
 
Join Date: Oct 2006
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ricespn
Default

Thanks guys, I found A library that can do that, VIC32.dll (Victor Library www.catenary.com) is kinda expensive for what I need, It has all other capabilities that I'm not interested, but I would like to know how to do it without using that library.

Thanks!

=======================
Strange and crazy, but everything is possible
 
Old April 19th, 2007, 03:31 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Go to http://www.wotsit.org/list.asp?page=5&fc=1&search=&al=, and scroll down to TIFF.

There are several files there that describe the format of a TIFF file. I selected the last one. It gave me a ZIP of a PDF which, on page 18 of 121 describes how to directly read the size info about a TIFF out of the file itself——and its [u]free</u>!
 
Old April 19th, 2007, 04:16 PM
Authorized User
 
Join Date: Oct 2006
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ricespn
Default

Thanks for the link Brian, I was reading the page you mentioned and at the end there is a list of all the tags supported by a TIFF file, The only problem for me is that I don't undestand how to read that information with VB6, I'm kinda new with programming. Do I have to load the TIFF image into memory if so ? How do I address those tags?

=======================
Strange and crazy, but everything is possible
 
Old April 20th, 2007, 01:48 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

What I would do is read the file into a byte array, then examine the bytes at the salient locations.

See FreeFile, Open, Seek and Get() for pretty good details on how you can read a file in groups.

With Seek you can move immediately to the byte of interest. With Get() you can read a byte at a time. There isn't any need to read the whole file into memory, in anwer to your question.





Similar Threads
Thread Thread Starter Forum Replies Last Post
details about datagrid_itemdatabound preetham.sarojavenkatesh Visual Studio 2005 4 August 21st, 2007 12:32 PM
submit details slick704 Javascript How-To 0 June 10th, 2005 01:00 AM
Problem Details 3Moose BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 16th, 2005 10:42 AM
/proc details? jrichemont BOOK Beginning Linux Programming, 3rd Edition 1 April 13th, 2004 10:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.