CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2001
    Posts
    50

    Post How to get CD Label Information

    Hello,

    how can I get the CD label information?

    thx
    kingkong321

  2. #2
    Join Date
    Aug 1999
    Posts
    74
    use

    BOOL GetVolumeInformation(
    LPCTSTR lpRootPathName, // root directory
    LPTSTR lpVolumeNameBuffer, // volume name buffer
    DWORD nVolumeNameSize, // length of name buffer
    LPDWORD lpVolumeSerialNumber, // volume serial number
    LPDWORD lpMaximumComponentLength, // maximum file name length
    LPDWORD lpFileSystemFlags, // file system options
    LPTSTR lpFileSystemNameBuffer, // file system name buffer
    DWORD nFileSystemNameSize // length of file system name buffer
    );

  3. #3
    Join Date
    Jul 2001
    Posts
    50
    Hi curious,

    Thank you for your help. It seems to be that this is the function I searched for. But how to use it? I always get an error.

    Code:
    #include <iostream.h>
    #include <windows.h>
    
    
    
    void main ()
    {
    
    	char	*VolumeNameBuffer,
    			*FileSystemNameBuffer;
    	DWORD	VolumeNameSize,
    			FileSystemNameSize,
    			*VolumeSerialNumber,
    			*MaximumComponentLength,
    			*FileSystemFlags;
    
    
    	VolumeNameBuffer=0;
    	FileSystemNameBuffer=0;
    	VolumeNameSize=0;
    	FileSystemNameSize=0;
    	VolumeSerialNumber=0;
    	MaximumComponentLength=0;
    	FileSystemFlags=0;
    	GetVolumeInformation("c:\\", VolumeNameBuffer, VolumeNameSize, VolumeSerialNumber, MaximumComponentLength, FileSystemFlags, FileSystemNameBuffer, FileSystemNameSize);
    	cout << VolumeNameBuffer << endl;
    }
    thx
    kingkong321

  4. #4
    Join Date
    May 2002
    Posts
    23
    #include <iostream.h>
    #include <windows.h>

    int _tmain(int argc, _TCHAR* argv[])
    {
    _TCHAR VolumeNameBuffer[MAX_PATH+1],
    FileSystemNameBuffer[MAX_PATH+1];
    DWORD VolumeNameSize = sizeof(FileSystemNameBuffer),
    FileSystemNameSize = sizeof(FileSystemNameBuffer),
    VolumeSerialNumber = 0,
    MaximumComponentLength = 0,
    FileSystemFlags = 0,
    lastError;

    VolumeSerialNumber=0;
    MaximumComponentLength=0;
    FileSystemFlags=0;
    if (!::GetVolumeInformation(_T("G:\\"), VolumeNameBuffer, VolumeNameSize, &VolumeSerialNumber, &MaximumComponentLength, &FileSystemFlags, FileSystemNameBuffer, FileSystemNameSize))
    lastError = ::GetLastError();
    cout << VolumeNameBuffer << endl;
    }

    Hi - try this. It worked for me. I changed the NULL pointers to arrays, amongst other things.

    RD

  5. #5
    Join Date
    Jul 2001
    Posts
    50
    Hi R. J. Dunnill

    thank you very much. your posting mehlped me to get what i searched for. ;-)

    thanks!!!
    Regards,
    kingkong321

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured