Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Vb.net Process Path  (Read 8727 times)

0 Members and 1 Guest are viewing this topic.

almn

  • Guest
Vb.net Process Path
« on: September 06, 2007, 10:33:38 PM »
Hello,

I am trying to wirte a program that lists in a listbox all the running program along with their path on the hard drive.
So far I have the following but it returns an error and deosn't show all of them:

Code: [Select]
Dim Psss As Process()

        Dim P As Process
        Psss = System.Diagnostics.Process.GetProcesses


        For Each P In Psss
            lst.Items.Add(P.MainModule.FileName.ToString)


        Next

The name of my listbox is lst

Any Help appreciated

Thanks

Al968

almn

  • Guest
Re: Vb.net Process Path
« Reply #1 on: September 09, 2007, 12:04:12 AM »
Anyone ???

Al968

Dark Blade

  • Forum Gaming Master


  • Adviser

    Thanked: 24
    • Yes
  • Experience: Experienced
  • OS: Windows XP
Re: Vb.net Process Path
« Reply #2 on: September 09, 2007, 12:45:09 AM »
What is the error returned?


Just hang tight, ghostdog is really good with stuff like this, so once he arrives you'll be fine.
« Last Edit: September 09, 2007, 02:39:48 AM by Dark Blade »

almn

  • Guest
Re: Vb.net Process Path
« Reply #3 on: September 09, 2007, 02:34:36 AM »
"Just hang tight, ghostdog is really good with .vbs, so once he arrives you'll be fine."
This isn't vbs  ::)

I get this message :

Code: [Select]
System.ComponentModel.Win32Exception: Access Denied
   at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
   at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId)
   at System.Diagnostics.Process.get_Modules()
   at System.Diagnostics.Process.get_MainModule()
   at ProcessKiller.Form1.Button2_Click(Object sender, EventArgs e) in C:\A1\Products\ProcessKiller\Form1.vb:line 95
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Thanks for the info

Al968

ghostdog74



    Specialist

    Thanked: 27
    Re: Vb.net Process Path
    « Reply #4 on: September 10, 2007, 08:31:48 PM »
    are you going to kill some processes?  the error you supplied is quite intuitive. Its to do with permissions...make sure the user running the program have the permission to do more privileged tasks other than read (eg kill a process ). If the process is started by say, SYSTEM, a normal user will not be able to kill it...

    ghostdog74



      Specialist

      Thanked: 27
      Re: Vb.net Process Path
      « Reply #5 on: September 10, 2007, 08:34:24 PM »
      Just hang tight, ghostdog is really good with stuff like this, so once he arrives you'll be fine.
      nope.my knowledge is till vb6 :) too lazy to learn new stuffs

      almn

      • Guest
      Re: Vb.net Process Path
      « Reply #6 on: September 14, 2007, 06:51:39 AM »
      Sorry for the late responce   :P

      No I just want to list all the running processes  :)

      Al968

      almn

      • Guest
      Re: Vb.net Process Path
      « Reply #7 on: September 22, 2007, 01:02:57 AM »
      Any one ?

      Thanks

      Al968

      contrex

      • Guest
      Re: Vb.net Process Path
      « Reply #8 on: October 10, 2007, 12:31:57 AM »
      Anyone? LOL




      Up and up goes the thread count...