Obtain the disk serial number

Source: Internet
Author: User

Void cvolserialnumdlg: onvolserial ()
{
// Todo: add your control notification handler code here
Cstring strrootpath = ""; // disk symbol with root directory flag
Char chvolname [20]; // The buffer of the volume label
DWORD dwlength = 20; // size of the volume label Buffer
DWORD dwvolserialnum = 0; // disk serial number
DWORD dwmaxlength = 255; // Maximum File Name Length
Char chfilesysname [20]; // File System Name Buffer
DWORD dwfilesyslength = 20; // file system name buffer size
Strrootpath = "E :\\";
Getvolumeinformation (strrootpath, chvolname, dwlength, & dwvolserialnum, & dwmaxlength,
0, chfilesysname, dwfilesyslength); // obtain the volume Tag Information
M_dwserial = dwvolserialnum;
Updatedata (false); // update the control data in the dialog box
}

 

 

1. getvolumeinformation function declaration

Bool getvolumeinformation (lpctstr lprootpathname, lptstr kernel, DWORD kernel, lpdword kernel, lpdword lpmaximum componentlength, lpdword lpfilesystemflags, lptstr lpfilesystemnamebuffer, DWORD nfilesystemnamesize)

Lprootpathname: disk symbol with the root directory identifier.

Lpvolumenamebuffer: The volume name buffer.

Nvolumenamesize: the buffer size of the volume name.

Lpvolumeserialnumber: disk serial number.

Lpmaximum componentlength: Maximum File Name Length.

Lpfilesystemflags: indicates the compressed disk.

Lpfilesystemnamebuffer: File System name buffer.

Nfilesystemnamesize: the buffer size of the file system name.

Function: obtains information about a disk volume. True is returned if the call succeeds. False is returned if the call fails.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.