質問

私はCDの識別に興味があります。

私の質問:

プログラムで検索できるシリアル番号はありますか?

編集(解決):

  1. VB version
  2. delphi version
役に立ちましたか?

解決

このコードをvb で試してください

Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Sub Form_Load()
    Dim Serial As Long
    'Get the volume information
    GetVolumeInformation "d:\", vbNullString, 255, Serial, 0, 0, vbNullString, 255

    MsgBox Hex(Serial)
End Sub 
.

これはあなたのための概念の証明として役立つはずです。あなたはこれをあなたの選択の言語に適応させることができます。

ここから撮影:> VBフォーラム

他のヒント

Windows.GetVolume情報構文
  GetVolumeInformation(
    lpRootPathName: PChar; {the path to the root directory}
    lpVolumeNameBuffer: PChar; {the buffer receiving the volume name}
    nVolumeNameSize: DWORD; {the maximum size of the buffer}
    lpVolumeSerialNumber: PDWORD; {a pointer to the volume serial number}
    var lpMaximumComponentLength: DWORD; {maximum file component name}
    var lpFileSystemFlags: DWORD; {file system flags}
    lpFileSystemNameBuffer: PChar; {the buffer receiving the file system name}
    nFileSystemNameSize: DWORD {the maximum size of the file system name}
  ): BOOL; {returns TRUE or FALSE}
.

Delphi Port( Andrei G さんの投稿)

getcdromserialスニペット:

  function GetCDROMSerial(AVolName: Char ) : DWord;
  var
   Dummy1, Dummy2 : DWord;
  begin
   GetVolumeInformation(
     PChar( AVolName+':' ),
     nil,
     0,
     @Result,
     Dummy1,
     Dummy2,
     nil,
     0
     );
  end;
.

使用例:

  ShowMessage(Format('%X', [GetCDROMSerial('F')]));
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top