Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HELP] Serious help please, serious code.. [/HELP]
#1
Can someone help me with a code for getting the path of an open application running on the computer, then run the path of the open application. Please, anybody willing to help me out here?...
[Image: t5BWm.png]
Reply
#2
Here is a piece of code I made that finds the location of the running apps:
Code:
For Each Proc As Process In Process.GetProcesses()
            Try
                TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
            Catch
            End Try
    Next
Put this in a button or the form_load and add a TextBox with multiline set to true.
Unfortunately, this does'nt work for all processes because some of them throw a runtime error. That's why I used Try-Catch. Remove it to see what happens.
My software company: Porosis Software
Games: Terrantula
Apps: Mathanasis, ColorGrabber
Reply
#3
(01-16-2011, 05:36 AM)thanasis2028 Wrote: Here is a piece of code I made that finds the location of the running apps:
Code:
For Each Proc As Process In Process.GetProcesses()
            Try
                TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
            Catch
            End Try
    Next
Put this in a button or the form_load and add a TextBox with multiline set to true.
Unfortunately, this does'nt work for all processes because some of them throw a runtime error. That's why I used Try-Catch. Remove it to see what happens.

awesome it works, but it gets every process thats running when I only want the process that the user types in the textbox. Good code, we just have to find something to revolve around that code.
[Image: t5BWm.png]
Reply
#4
Ok here is a way to do this:
Code:
For Each Proc As Process In Process.GetProcessesByName(TextBox2.Text)
            Try
                TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
            Catch
            End Try
        Next

All I did was change GetProcesses to GetProcessesByName and added a textbox to input the name of the processs
My software company: Porosis Software
Games: Terrantula
Apps: Mathanasis, ColorGrabber
Reply
#5
(01-16-2011, 10:54 PM)thanasis2028 Wrote: Ok here is a way to do this:
Code:
For Each Proc As Process In Process.GetProcessesByName(TextBox2.Text)
            Try
                TextBox1.AppendText(Proc.MainModule.FileName & vbCrLf)
            Catch
            End Try
        Next

All I did was change GetProcesses to GetProcessesByName and added a textbox to input the name of the processs

hey thanks bro, I got the code already but really thanks for the effort and help.
[Image: t5BWm.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Get Country Code In 1 Line Of Code. wchar_t 13 4,205 11-28-2012, 06:49 AM
Last Post: Cubs

Forum Jump:


Users browsing this thread: 1 Guest(s)