Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting a .NET routine to VFP
Message
 
To
22/07/2014 13:43:23
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01604331
Message ID:
01604341
Views:
133
This message has been marked as the solution to the initial question of the thread.
>Hi,
>
>I was looking for a way to generate a string to identify a machine and found code that does it. Yes !!
>
>However, it is written in C# and I need it in VFP and I am not very practiced at all in C#. Oh no !!
>
>But in the UT there are many people who speak C# and VFP ! Yes !!
>
>I rewrote part of the C# code in VFP but got stuck. Can anyone please help? The C# code is enclosed in a TEXT / ENDTEXT block at the end.
>
>Code is enclosed in zip file. Thank you,
>
>Alex

This is how to query WMI:
CLEAR 
DIMENSION check[21,2]

check[ 1,1] = "Win32_NetworkAdapterConfiguration"
check[ 1,2] = "MACAddress"

check[ 2,1] = "Win32_Processor"
check[ 2,2] = "UniqueId"

check[ 3,1] = "Win32_Processor"
check[ 3,2] =  "ProcessorId"

check[ 4,1] = "Win32_Processor"
check[ 4,2] =  "Name"

check[ 5,1] = "Win32_Processor"
check[ 5,2] =  "Manufacturer"

check[ 6,1] = "Win32_BIOS"
check[ 6,2] = "Manufacturer"

check[ 7,1] = "Win32_BIOS"
check[ 7,2] = "SMBIOSBIOSVersion"

check[ 8,1] = "Win32_BIOS"
check[ 8,2] = "IdentificationCode"

check[ 9,1] = "Win32_BIOS"
check[ 9,2] = "SerialNumber"

check[10,1] = "Win32_BIOS"
check[10,2] = "ReleaseDate"

check[11,1] = "Win32_BIOS"
check[11,2] = "Version"

check[12,1] = "Win32_DiskDrive"
check[12,2] = "Model"

check[13,1] = "Win32_DiskDrive"
check[13,2] = "Manufacturer"

check[14,1] = "Win32_DiskDrive"
check[14,2] = "Signature"

check[15,1] = "Win32_DiskDrive"
check[15,2] =  "TotalHeads"

check[16,1] = "Win32_BaseBoard"
check[16,2] = "Model"

check[17,1] = "Win32_BaseBoard"
check[17,2] = "Manufacturer"

check[18,1] = "Win32_BaseBoard"
check[18,2] = "Name"

check[19,1] = "Win32_BaseBoard"
check[19,2] = "SerialNumber"

check[20,1] = "Win32_VideoController"
check[20,2] = "DriverVersion"

check[21,1] = "Win32_VideoController"
check[21,2] = "Name"

oWmi = GetObject("winmgmts:\\.\root\CIMV2") 
lcStr = []
FOR i = 1 TO ALEN(check,1)
    TEXT TO qry NOSHOW TEXTMERGE PRETEXT 15 
         SELECT <<check[i,2]>> FROM <<check[i,1]>>
         <<IIF(i==1, " WHERE IPEnabled = 'True'",[])>>
    ENDTEXT
    oTest = oWmi.ExecQuery(qry)
    FOR EACH oItem IN oTest
        IF NOT ISNULL(oItem)
           ? EVALUATE([oItem.]+check[i,2])
           EXIT
        ENDIF
    NEXT
NEXT
How to crypt it check Craig Boyd's vfpencryption71.fll
http://www.sweetpotatosoftware.com/spsblog/2009/08/09/MajorVFPEncryptionUpdate.aspx
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform