Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using VFP to detect hardware
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00427379
Message ID:
00429441
Vues:
16
>Hi Robert,
>
>Thanks for giving the tips to help me get started, but I still have problems trying to find the WMI API to query the information I need or tried find an example on the MSDN Library. Addition help will be greated!
>
>Thanks

Assuming that you have the WMI SDK installed, what you are looking for is the scripting objects. If you don't have the SDK it can be downloaded for free from MS. All of the examples that I used were VBScript and HTML examples that I converted to VFP. For starting you want to do a oLocator = CreateObject("WbemScripting.SWbemLocator"). From here you want to do an oService = oLocator.ConnectServer("ServerName"). With this object you can then do the oObjectSet = oService.Get("Win32_ComputerSystem"). Now is where is gets tricky, the next thing to do is an oObject = oObjectSet.Instance_. The last thing is to do a For Each...EndFor loop on the oObject. Here you will get the properties for the "ComputerSystem". All of the ones listed for the Win32_ComputerSystem class in the documentation will be available, however some may be nulls as not all hardware manufacturers add support for all things. Another example that might help is that in the For Each...EndFor loop of the "Win32_PhysicalMemory" object you will get an sub-object for each physical memory slot that is occupied.

HTH

REM
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform