Hi Steve,

It looks like you've specified the two string parameters returning the information as ByVal. They need to by ByRef (i.e. w/o ByVal in MB) to be able to return anything.

Furthermore, in WinApi you always need to allocate a valid value to a return string variable prior to calling routines, e.g. by using Space$(255).

Then it returns "NTFS" in FSname for me.

Best regards / Med venlig hilsen
Lars Nielsen
GisPro



Nabors, Steve wrote:

Hi,
I am having a problem getting this mapbasic code to work.  I'm trying to
access the API to get the drive volume information. Any ideas whatI'm
doing wrong here?
I'm on Win XP with MI 8.0
Thanks,
Steve

''Main Sub Declarations
Declare Sub Main

'Declare functions
Declare Function GetVolumeInformation Lib "Kernel32" Alias
"GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal
lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer,
lpVolumeSerialNumber As Integer, lpMaximumComponentLength As Integer,
lpFileSystemFlags As Integer, ByVal lpFileSystemNameBuffer As String,
ByVal nFileSystemNameSize As Integer) As Integer

Sub Main

Dim nSize as integer
Dim Serial As Integer
Dim VName As String
Dim FSName As String
Dim thevol as string
Dim maxsize, temp, nLeng as integer

'set some values
nSize = 255
maxsize = 255
temp = 0
Serial = 0
thevol = "C:\"

   'Create buffers
        VName = space$(nSize)
         FSName = space$(nSize)

   'Get the volume information
       nLeng =
GetVolumeInformation(thevol,VName,nSize,Serial,maxsize,temp,FSName,nSize
)

'show retuned values
     note VName
     note FSName

End Sub



Steve Nabors
Systems Analyst
Market Support Services


______________________________________________________________________
This e-mail has been scanned by MCI/MessageLabs Managed Email Service.
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to