Public Function GetModules(ByVal ProcessName As String) As List(Of String)
Dim Proc As Process() = Process.GetProcessesByName(ProcessName)
If Proc.Length = 0 Then
Return Nothing
End If
Dim lst As List(Of String) = New List(Of String)
For Each M As ProcessModule In Proc(0).Modules
lst.Add(M.ModuleName)
Next
Return lst
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.DataSource = GetModules("Solitaire")
End Sub
Dim _pmc As ProcessModuleCollection = urProcess.Modules 'i found this by typing in Process.(see period) and looking at intellisense. pretty well named...I just made a guess..
For Each aModule As ProcessModule In _pmc
ListBox1.Items.Add(aModule.ModuleName)
Next
''same as pingo's code: works for me :/
''edit: you must have got 'process name' wrong..probably included ".exe" hehe :/



Public Function GetModules(ByVal ProcessName As String) As List(Of String)
Dim Proc As Process() = Process.GetProcessesByName(ProcessName)
If Proc.Length = 0 Then
Return Nothing
End If
Dim lst As List(Of String) = New List(Of String)
For Each M As ProcessModule In Proc(0).Modules
lst.Add(M.ModuleName)
Next
Return lst
End Function