|
-
Feb 16th, 2002, 11:57 PM
#1
Thread Starter
Addicted Member
in vb.net to get a value back from a function you dont set the return value to the function name.
You do the Return statement. Like this.
Code:
Option Strict On
Module modGetInfo
Public Declare Function GetVolumeInformation Lib "kernel32" _
Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, _
ByVal lpVolumeSerialNumber As Long, _
ByVal lpMaximumComponentLength As Long, _
ByVal lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long
Function GetHardDriveSerialNumber() As Long
Dim Result As Long
Dim RootPathName As String = "C:"
Dim VolumeNameBuffer As String = Space(256)
Dim VolumeNameSize As Long = 256
Dim VolumeSerialNumber As Long = 0
Dim MaximumComponentLength As Long = 256
Dim FileSystemFlags As Long = 0
Dim FileSystemNameBuffer As String = Space(256)
Dim FileSystemNameSize As Long = 256
Result = GetVolumeInformation(RootPathName, _
VolumeNameBuffer, _
VolumeNameSize, _
VolumeSerialNumber, _
MaximumComponentLength, _
FileSystemFlags, _
FileSystemNameBuffer, _
FileSystemNameSize)
'do this
Return VolumeSerialNumber
'instead of this
GetHardDriveSerialNumber = VolumeSerialNumber
End Function
End Module
that should work for you
 ender_pete 
C#,VS.NET Ent Arch, vb6 ee sp5,html,vbscript,jscript,
xml,dhtml,delphi,c++,vc++,java,cgi,php, python, ada(so ancient) ,adasage(also ancient) and others i can't remember.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|