Get PCIe slot on Windows7

Hello,
Is there an API available on Win7 which can return me reliable PCIe slot number & attached card details.
2 answers Last reply
More about pcie slot windows7
  1. Sure, lots of programs use it, GPUZ hooks into it, so does device manager. Now what you use to expose it will differ, take a web search trip for some programming guides.
  2. Use the WMI API extensions from within Visual Studio.

    This examples gives you drive information.

    Dim oWMI as SWBEMObjectSet
    Set oWMI =
    GetObject("Winmgmts:impersonationLevel=impersonate}").InstancesOf("Win32_LogicalDisk")
    Set oWMI = GetObject("winmgmts:impersonationLevel=impersonate}").ExecQuery("select * from Win32_LogicalDisk where DriveType=3")
    
    Dim wmiObject As SwbemObject
    For Each wmiObject In oWMI
    DriveName = wmiObject.Caption
    FreeSpace = wmiObject.FreeSpace
    TotalSize = wmiObject.Size
    Next


    While this code checks to see if the name dnetwork card is using a static I.P or DHCP.

    ipAddress = Array("10.10.10.10")
    subnetMask = Array("255.255.255.0")
    for each wmiObject in GetObject("winmgmts:").ExecQuery("select * from Win32_NetworkAdapterConfiguration where description='EL90Xbc0 3Com EtherLink PCI'")
    
    if wmiObject.DHCPEnabled = True then
                  RetVal = Network.EnableStatic(ipAddress, subnetMask)
    
    if RetVal = 0 then
                  MsgBox "DHCP disabled, using static IP address"
    else
                  MsgBox "DHCP disable failed"
    end if
    
    else
                  RetVal = wmiObject.EnableDHCP()
                  if RetVal = 0 then
                         MsgBox "DHCP enabled, using dynamic IP address"
                  else
                         MsgBox "DHCP enable failed"
                  end if
    end if
    next
Ask a new question

Read More

Configuration Windows 7 API