PCI Vendor-ID auslesen ?

  • VB.NET

Es gibt 9 Antworten in diesem Thema. Der letzte Beitrag () ist von TVX.

    Hab da ein schönes Tutorial gefunden...halt ist ja meines ;)
    Spaß bei Seite schaus dir mal an:

    [VB.NET] Systeminformationen mit WMI auslesen ab .NET 3.0 oder früher
    Mfg: Gather
    Private Nachrichten bezüglich VB-Fragen werden Ignoriert!


    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Gather“ ()

    Also - Gather - die Saite von dir hab ich mir direkt gesichert ,,die wird mir mit Sicherheit noch von nutzen sein +++ :thumbsup:

    Ich habe es nun über - devcon - gemacht - hatte lange gesucht bis ich welche hatte die auf win 7 und 8 gehen !

    Das bot sich mir halt an weil ich den Gerätemanager auch steuern möchte !

    Allerdings schreibt meine listbox wieder alles in eine zeile :!:

    Rich TextBox & Textbox schreiben es genau richtig -- aber ich brauchs in na listbox :!:

    So wirds in der textbox angezeigt:
    #############################################################################

    PCI\VEN_1022&DEV_1202&SUBSYS_00000000&REV_00\3&267A616A&0&C2: PCI Standard-Host-CPU-Brücke
    PCI\VEN_1166&DEV_024A&SUBSYS_571C7ABD&REV_01\4&5D18F2DF&1 : AEO4VU55 IDE Controller
    PCI\VEN_1002&DEV_4396&SUBSYS_43961849&REV_00\3&267A616A&0&B2: Standard PCI-zu-USB erweiterter Hostcontroller
    PCI\VEN_14E4&DEV_16B1&SUBSYS_96B11849&REV_10\4&3227B39C&0&0050: Broadcom NetLink (TM) Gigabit Ethernet
    PCI\VEN_1002&DEV_5A16&SUBSYS_5A141849&REV_00\3&267A616A&0&10: PCI Standard-PCI-zu-PCI-Brücke
    PCI\VEN_1022&DEV_1203&SUBSYS_00000000&REV_00\3&267A616A&0&C3: PCI Standard-Host-CPU-Brücke
    PCI\VEN_1002&DEV_4397&SUBSYS_43971849&REV_00\3&267A616A&0&90: Standard OpenHCD USB-Hostcontroller
    PCI\VEN_1002&DEV_5A19&SUBSYS_5A141849&REV_00\3&267A616A&0&28: PCI Standard-PCI-zu-PCI-Brücke
    PCI\VEN_1B6F&DEV_7023&SUBSYS_70231849&REV_01\4&2E75CD95&0&0028: Etron USB 3.0 Extensible Host Controller
    PCI\VEN_1022&DEV_1204&SUBSYS_00000000&REV_00\3&267A616A&0&C4: PCI Standard-Host-CPU-Brücke
    PCI\VEN_1002&DEV_4383&SUBSYS_78921849&REV_40\3&267A616A&0&A2: High Definition Audio-Controller
    PCI\VEN_1002&DEV_4397&SUBSYS_43971849&REV_00\3&267A616A&0&98: Standard OpenHCD USB-Hostcontroller

    ############################################################################

    Und in der listbox alles am Band hintereinander (( wie mach ich den Zeilenumbruch dafür )) :?:


    CODE MIT LISTBOX AUSGABE:

    VB.NET-Quellcode

    1. Public Class Form1
    2. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    3. TopMost = True
    4. End Sub
    5. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    6. Process.Start("devcon", "disable PCI\VEN_14E4&DEV_16B1&CC_0200")
    7. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    8. End Sub
    9. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    10. Process.Start("devcon", "enable PCI\VEN_14E4&DEV_16B1&CC_0200")
    11. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    12. End Sub
    13. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    14. On Error Resume Next
    15. IO.File.WriteAllBytes("C:\Windows\System32\devcon.exe", My.Resources.devcon32)
    16. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    17. End Sub
    18. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    19. On Error Resume Next
    20. IO.File.WriteAllBytes("C:\Windows\System32\devcon.exe", My.Resources.devcon64)
    21. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    22. End Sub
    23. 'Vendor-ID auslesen.
    24. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
    25. Dim p As New Process
    26. p.StartInfo.UseShellExecute = False
    27. p.StartInfo.RedirectStandardOutput = True
    28. p.StartInfo.FileName = "devcon"
    29. p.StartInfo.Arguments = "find pci\*"
    30. p.Start()
    31. Dim text As String = p.StandardOutput.ReadToEnd
    32. p.WaitForExit()
    33. ListBox1.Items.Add(text)
    34. End Sub
    35. Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
    36. End Sub
    37. End Class


    LG Andre ;(
    Vielleicht mit einem For Each Block?

    VB.NET-Quellcode

    1. Dim p As New Process
    2. p.StartInfo.UseShellExecute = False
    3. p.StartInfo.RedirectStandardOutput = True
    4. p.StartInfo.FileName = "devcon"
    5. p.StartInfo.Arguments = "find pci\*"
    6. p.Start()
    7. For Each text in p.StandardOutput.ReadToEnd
    8. ListBox1.Items.Add(text)
    9. Next
    10. p.WaitForExit()


    PS: Nein ich habe es nicht getestet.
    Mfg: Gather
    Private Nachrichten bezüglich VB-Fragen werden Ignoriert!


    So musste noch Arbeiten --Endlich Wochenende ^^


    Habs jetz so gelöst - kurtz und sauber !

    VB.NET-Quellcode

    1. Dim p As New Process
    2. p.StartInfo.UseShellExecute = False
    3. p.StartInfo.RedirectStandardOutput = True
    4. p.StartInfo.FileName = "devcon"
    5. p.StartInfo.Arguments = "find pci\*"
    6. p.Start()
    7. Dim text As String = p.StandardOutput.ReadToEnd
    8. p.WaitForExit()
    9. ListBox1.Items.AddRange(text.Split(CChar(vbNewLine)))


    LG Andre... :thumbsup:
    ist ja auch nur ne cmd einbindung und ja ich weiss (( On Error Resume Next )) das mach ich immer in der Probe ,,später gibts en catch !

    VB.NET-Quellcode

    1. Try
    2. xxxxxxxxxxxx
    3. Catch ex As Exception
    4. End Try


    :rolleyes:

    Nur die Methode vbnewline hat bei z.b. Cods einen Fehler :

    Als erstes Zeichen steht ein unsichtbares, ein LF = Line Feed :D

    Also:

    VB.NET-Quellcode

    1. Dim sauber As String = (TextBox1.Text & "&" & TextBox2.Text)
    2. sauber = Replace(sauber, vbLf, "")
    3. TextBox3.Text = sauber

    Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von „TVX“ ()

    VB.NET-Quellcode

    1. Public Class Form1
    2. Dim IDTEIL1 As Object
    3. Dim IDTEIL2 As Object
    4. 'FORM IMMER IM FORDERGRUND
    5. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    6. Try
    7. TopMost = True
    8. TextBox3.Text = My.Settings.SAVE_LETZTER_AUFRUF3
    9. TextBox4.Text = My.Settings.SAVE_LETZTER_AUFRUF4
    10. My.Settings.Reload()
    11. 'STATUS ANZEIGE
    12. Dim p As New Process
    13. p.StartInfo.UseShellExecute = False
    14. p.StartInfo.RedirectStandardOutput = True
    15. p.StartInfo.FileName = "devcon"
    16. p.StartInfo.Arguments = "status " & TextBox3.Text.ToString
    17. p.Start()
    18. Dim text1 As String = p.StandardOutput.ReadToEnd
    19. p.WaitForExit()
    20. TextBox5.Text = text1.ToString
    21. TextBox5.Text = TextBox5.Text.Split(":")(1)
    22. Catch ex As Exception
    23. End Try
    24. End Sub
    25. '##############################################################################################################################################
    26. 'Selecktedt Auswahl mit rechter Maustaste aufheben
    27. Private Sub FileListBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
    28. If e.Button = Windows.Forms.MouseButtons.Right Then
    29. ListBox1.SelectedIndex = ListBox.NoMatches
    30. End If
    31. End Sub
    32. 'FORM CLOSE EVENT !
    33. Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    34. My.Settings.SAVE_LETZTER_AUFRUF3 = TextBox3.Text
    35. My.Settings.SAVE_LETZTER_AUFRUF4 = TextBox4.Text
    36. My.Settings.Save()
    37. End Sub
    38. '###########################################################################################################################################
    39. 'DEVCON BEFEHL UMSETZEN
    40. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    41. Try
    42. Process.Start("devcon", "disable " & TextBox3.Text.ToString)
    43. Catch ex As Exception
    44. End Try
    45. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    46. End Sub
    47. 'DEVCON BEFEHL UMSETZEN
    48. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    49. Try
    50. Process.Start("devcon", "enable " & TextBox3.Text.ToString)
    51. Catch ex As Exception
    52. End Try
    53. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    54. End Sub
    55. 'DEVCON 32 BIT INSTALL
    56. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    57. Try
    58. IO.File.WriteAllBytes("C:\Windows\System32\devcon.exe", My.Resources.devcon32)
    59. Catch ex As Exception
    60. End Try
    61. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    62. End Sub
    63. 'DEVCON 64 BIT INSTALL
    64. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    65. Try
    66. IO.File.WriteAllBytes("C:\Windows\System32\devcon.exe", My.Resources.devcon64)
    67. Catch ex As Exception
    68. End Try
    69. My.Computer.Audio.Play(My.Resources.button_3, AudioPlayMode.Background)
    70. End Sub
    71. 'Vendor-ID auslesen.
    72. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
    73. ListBox1.Items.Clear()
    74. Try
    75. Dim p As New Process
    76. p.StartInfo.UseShellExecute = False
    77. p.StartInfo.RedirectStandardOutput = True
    78. p.StartInfo.FileName = "devcon"
    79. p.StartInfo.Arguments = "find pci\*"
    80. p.Start()
    81. Dim text As String = p.StandardOutput.ReadToEnd
    82. p.WaitForExit()
    83. ListBox1.Items.AddRange(text.Split(CChar(vbNewLine)))
    84. Catch ex As Exception
    85. End Try
    86. End Sub
    87. Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
    88. 'ID ANZEIGE
    89. Try
    90. TextBox3.Text = ""
    91. IDTEIL1 = ListBox1.SelectedItem.Split("&")(0)
    92. IDTEIL2 = ListBox1.SelectedItem.Split("&")(1)
    93. TextBox4.Text = ListBox1.SelectedItem.Split(":")(1)
    94. Dim sauber As String = (IDTEIL1 & "&" & IDTEIL2)
    95. sauber = Replace(sauber, vbLf, "")
    96. TextBox3.Text = sauber.ToString
    97. Catch ex As Exception
    98. End Try
    99. Try
    100. 'STATUS ANZEIGE
    101. Dim p As New Process
    102. p.StartInfo.UseShellExecute = False
    103. p.StartInfo.RedirectStandardOutput = True
    104. p.StartInfo.FileName = "devcon"
    105. p.StartInfo.Arguments = "status " & TextBox3.Text.ToString
    106. p.Start()
    107. Dim text1 As String = p.StandardOutput.ReadToEnd
    108. p.WaitForExit()
    109. TextBox5.Text = text1.ToString
    110. TextBox5.Text = TextBox5.Text.Split(":")(1)
    111. Catch ex As Exception
    112. End Try
    113. End Sub
    114. 'FIND ALLE GERÄTE
    115. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
    116. ListBox1.Items.Clear()
    117. Try
    118. Dim p As New Process
    119. p.StartInfo.UseShellExecute = False
    120. p.StartInfo.RedirectStandardOutput = True
    121. p.StartInfo.FileName = "devcon"
    122. p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
    123. p.StartInfo.Arguments = "listclass usb 1394" 'resources
    124. p.Start()
    125. Dim text As String = p.StandardOutput.ReadToEnd
    126. p.WaitForExit()
    127. ListBox1.Items.AddRange(text.Split(CChar(vbNewLine)))
    128. Catch ex As Exception
    129. End Try
    130. End Sub
    131. 'GERÄTE NEU ERKENNEN ( RESCAN )
    132. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
    133. Try
    134. Process.Start("devcon", " rescan")
    135. Catch ex As Exception
    136. End Try
    137. End Sub
    138. Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
    139. Me.WindowState = FormWindowState.Minimized
    140. End Sub
    141. End Class



    Geschlossen :D