Unit1.cpp
上传用户:hkdchy
上传日期:2022-08-07
资源大小:1k
文件大小:1k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- AnsiString res = "";
- AnsiString drive = "c:\";
- unsigned long VolumeSerialNumber = 0;
- GetVolumeInformation(drive.c_str(), 0, 0,&VolumeSerialNumber,0, 0, 0, 0);
- __int64 ii = VolumeSerialNumber;
- res = IntToHex(ii, 8);
- /*
- while(res.Length()<8)
- res = "0"+res;
- if(res.Length()==8)
- res = res.SubString(1,4)+"-"+res.SubString(5,4);
- */
- Memo1->Lines->Text = res;
- int i = GetDriveTypeA("C:\");
- }
- //---------------------------------------------------------------------------