User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 427,177 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,133 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser: Programming Forums
Mar 18th, 2006
Views: 7,377
ShowDriveSerialNo shows it with ShowMessage GetDriveSerialNo returns a string. You don't need both.
delphi Syntax | 5 stars
  1. Procedure ShowDriveSerialNo(Drive : String); // Drive as 'c:' or 'd:', ...
  2. var VolSerNum: DWORD;
  3. Dummy1, Dummy2: DWORD;
  4. begin
  5. if GetVolumeInformation(drive+'\', NIL, 0, @VolSerNum, Dummy1, Dummy2, NIL, 0) then ShowMessage(Format('%.4x:%.4x', [HiWord(VolSerNum), LoWord(VolSerNum)]));
  6. End;
  7.  
  8. Function GetDriveSerialNo(Drive : String) : String; // Drive as 'x:' ...
  9. var VolSerNum: DWORD;
  10. Dummy1, Dummy2: DWORD;
  11. begin
  12. if GetVolumeInformation(drive+'\', NIL, 0, @VolSerNum, Dummy1, Dummy2, NIL, 0) then Result := Format('%.4x:%.4x', [HiWord(VolSerNum), LoWord(VolSerNum)]);
  13. End;
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 9:28 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC