Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hard Disk serial number
Message
From
04/01/2006 13:02:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/01/2006 12:52:29
Reza Meamar
Homa Programming Group
Shiraz, Iran
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
01083011
Message ID:
01083233
Views:
269
>>>Hi
>>>I am developing a software in VFP for which i need the serial number of the hard disk. I don't want the Volume Number of the drive (ie c: , d: etc) as according to my information, this volume number changes whenever that volume is formatted. Can anybody help in getting the Hard Disk serial number which is manufacturer defined and which will not change.
>>> Can anyone please tell me the VFP or API function to obtain disk serial number.
>>>
>>> thanks in advance
>>>
>>>Regards,
>>>Somesh
>>
>>
>>loWMI = GetObject("winmgmts:\\.\root\cimv2")
>>oItems = loWMI.ExecQuery("select * from Win32_PhysicalMedia")
>>
>>For each oItem in oItems
>> ? oItem.Tag, oItem.SerialNumber
>>endfor
>>
Cetin
>
>Dear Cetin,
>When i run this code i get this error :library not registered.
>I have VFP7 and WIN98SE

On general for WMI:
"The WMI Redistributable Components version 1.0 file, which requires Windows® 2000 Service Pack 2 or later, is available to download at http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdkredist.htm.

WMI functionality introduced in the Windows 2000 SP 2 operating system is also available to earlier operating systems by downloading the Microsoft® .NET Framework SDK, and the .NET Framework Redistributable. These can be obtained at http://msdn.microsoft.com/netframework/downloads/howtoget.asp.


Run-Time Requirements

Applications that use WMI require Windows® Server 2003, Windows® XP, Windows® Millennium Edition (Me), Windows NT®, Windows® 2000, Windows® 98, or Windows® 95 operating systems. For information about which operating system is required to use a specific API element, see the Requirements section of each topic in the WMI documentation."

win32_PhysicalMedia class:
"Requirements
Client: Requires Windows XP.
Server: Requires Windows Server 2003.
Header: Declared in Wmipcima.mof.
Namespace: Included in \root\cimv2."

You might instead try with another class.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform