Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[Source] Is my process running? Check to see if your program is running or not :D

Hi guys,
This is a short little snippet I made that checks to see whether your current application is running or not.
Code
string filename = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
Process[] process = Process.GetProcessesByName(filename);
if (process.Length == 0)
  MessageBox.Show("Your program is not running :(");
else
  MessageBox.Show("Your program is running!");

This is probably the fastest program I have ever coded, it took me only around 40 seconds. 😎
thats just genious. definately have uses for this in my programs thumbs thank you sir.
And why would anybody need this? Do tell. The application would obviously be running if it's able to run this code.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
Troll Mode: [ √ On | Off ]

Nuff said.
(Oct 17, 2012 09:27 PM)0xDEAD10CC Wrote:  And why would anybody need this? Do tell. The application would obviously be running if it's able to run this code.

what're you talking about? theres so much stuff you could do with this...
(Oct 17, 2012 09:32 PM)OperationFatSarah Wrote:  what're you talking about? theres so much stuff you could do with this...

Jokes aside, take off your clown nose and lets be serious here. This is a waste of a thread in the programming forums.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
I think this is a troll if I should be honest.
(Oct 18, 2012 12:10 AM)BaussHacker Wrote:  I think this is a troll if I should be honest.

That, or the guy doesn't know what he is doing.
Actually this has practical uses. For instance, if you are creating a program such as ShiftWindows like I did to create a listBox of all processes that are open, so you don't have to shift through all the random things like JME_LOAD that I would never want to run it on. Instead, right now it would only show that I had Diablo III, Steam and Google Chrome on the list instead of my 25 processes running.

or take my http://pastebin.com/LvC901th for instance. I only wanted to bring programs that are actually running on display to be brought to front, nothing else. This isn't a troll thread, however I don't like how he does it but it does work.

What he does is completely useless, however it can be applied to actual examples.
why not use mutex API instead of doing process checking. mutex is the clean way, a mutex is when you give your application are unique identifier and you can prevent multiple instances of the file. even if you rename the file it will not run twice as the code will not change.
it would be better to check if other process is running instead of checking own process. I don't see any usage of this
No offense but you claim you wrote this like you invented something new.
It looks like it has been jacked from here - http://stackoverflow.com/questions/44538...n-close-it
For the latest crimes linked to marijuana see: AttackerSmokedCannabis.com
(Oct 18, 2012 04:03 AM)Debroski Wrote:  Actually this has practical uses.

Actually it doesn't. It makes no sense to check if the process you're running is running ;)
(Oct 18, 2012 06:27 AM)BaussHacker Wrote:  Actually it doesn't. It makes no sense to check if the process you're running is running ;)

Agreed, there's no point to this thread.
Nice 1 this could come in handy if your high sometime :P


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by gigajewMar 4, 2019 08:44 AM 15 1,611 Mar 4, 2019 08:44 AM
Last Post: Aristocles
[.NET] by Formula 1Mar 3, 2019 02:36 PM 6 230 Mar 3, 2019 02:36 PM
Last Post: Formula 1
[.NET] by BapeZOct 1, 2018 01:09 PM 5 279 Oct 1, 2018 01:09 PM
Last Post: oxidebuffalo