Sign in with
Sign up | Sign in
Your question

Get PCIe slot on Windows7

Last response: in Windows 7
Share
Anonymous
a b $ Windows 7
October 5, 2010 3:56:15 PM

Hello,
Is there an API available on Win7 which can return me reliable PCIe slot number & attached card details.

More about : pcie slot windows7

a c 354 $ Windows 7
October 5, 2010 4:39:01 PM

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.
a b $ Windows 7
October 5, 2010 5:08:05 PM

Use the WMI API extensions from within Visual Studio.

This examples gives you drive information.

  1. Dim oWMI as SWBEMObjectSet
  2. Set oWMI =
  3. GetObject("Winmgmts:impersonationLevel=impersonate}").InstancesOf("Win32_LogicalDisk")
  4. Set oWMI = GetObject("winmgmts:impersonationLevel=impersonate}").ExecQuery("select * from Win32_LogicalDisk where DriveType=3")
  5.  
  6. Dim wmiObject As SwbemObject
  7. For Each wmiObject In oWMI
  8. DriveName = wmiObject.Caption
  9. FreeSpace = wmiObject.FreeSpace
  10. TotalSize = wmiObject.Size
  11. Next


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

  1. ipAddress = Array("10.10.10.10")
  2. subnetMask = Array("255.255.255.0")
  3. for each wmiObject in GetObject("winmgmts:").ExecQuery("select * from Win32_NetworkAdapterConfiguration where description='EL90Xbc0 3Com EtherLink PCI'")
  4.  
  5. if wmiObject.DHCPEnabled = True then
  6. RetVal = Network.EnableStatic(ipAddress, subnetMask)
  7.  
  8. if RetVal = 0 then
  9. MsgBox "DHCP disabled, using static IP address"
  10. else
  11. MsgBox "DHCP disable failed"
  12. end if
  13.  
  14. else
  15. RetVal = wmiObject.EnableDHCP()
  16. if RetVal = 0 then
  17. MsgBox "DHCP enabled, using dynamic IP address"
  18. else
  19. MsgBox "DHCP enable failed"
  20. end if
  21. end if
  22. next
!