Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Martin Krivka
  Where is Martin Krivka?
 
 Czech Republic
 Martin Krivka
 To: paundian somasundaram
  Where is paundian somasundaram?
 Dindigul
 India
 paundian somasundaram
 Tags
Subject: RE: Disk partition Number
Thread ID: 249006 Message ID: 249007 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Saturday, December 26, 2009 4:10:17 PM         
   


> Hello experts
>
> How do I get the serial number of particular hard disk
> partition through VFP.
>
> Thanks in advance


Hello,

you can use GetVolumeInformation from win api.
At the end of this message is volumeInfo.prg

You can use it like:
m.o=volumeInfo("C:")
? m.o.VolumeSerialNumber

or write your own.

regards
Martin


* save this code as volumeInfo.prg
*
*	GetVolumeInformation(volume as string) as object
*
*
parameters volume as String

declare integer GetVolumeInformation in win32api;
	string @ lpRootPathName,;					&& p1 in
	string @ lpVolumeNameBuffer,;				&& p2 out
	integer nVolumeNameSize,;					&& p3 in
	integer @ lpVolumeSerialNumber,;			&& p4 out
	integer @ lpMaximumComponentLength,;		&& p5 out
	integer @ lpFileSystemFlags,;				&& p6 out
	string @ lpFileSystemNameBuffer,;			&& p7 out
	integer nFileSystemNameSize					&& p8 in

private p2,p4,p5,p6,p7,vysl
m.p2=space(200)
store 0 to m.p4,m.p5,m.p6
m.p7=space(200)

m.vysl=GetVolumeInformation(;
	addbs(m.volume)+chr(0),;
	@m.p2,;
	len(m.p2),;
	@m.p4,;
	@m.p5,;
	@m.p6,;
	@m.p7,;
	len(m.p7);
	)

if m.vysl=0
	return null
else
	private o
	m.o=createobject("empty")
	=addproperty(m.o,"VolumeName",strextract(m.p2,"",chr(0)))
	=addproperty(m.o,"VolumeSerialNumber",m.p4)
	=addproperty(m.o,"MaximumComponentLength",m.p5)
	=addproperty(m.o,"FileSystemFlags",m.p6)
	=addproperty(m.o,"FileSystemName",strextract(m.p7,"",chr(0)))
	return m.o
endif


ENTIRE THREAD

Disk partition Number Posted by paundian somasundaram @ 12/26/2009 3:42:35 PM
RE: Disk partition Number Posted by Martin Krivka @ 12/26/2009 4:10:17 PM
RE: Disk partition Number Posted by paundian somasundaram @ 12/28/2009 3:44:38 AM
RE: Disk partition Number Posted by Mike Gagnon @ 12/28/2009 12:39:37 PM
RE: Disk partition Number Posted by Martin Krivka @ 12/29/2009 9:07:37 AM
RE: Disk partition Number Posted by Mike Gagnon @ 12/29/2009 1:36:17 PM
RE: Disk partition Number Posted by Vladimir Zografski @ 12/26/2009 8:36:47 PM
RE: Disk partition Number Posted by paundian somasundaram @ 12/28/2009 3:47:48 AM