How to prevent opening notepad.exe during my application is running?

Herry Markowitz

Well-known member
Joined
Oct 22, 2015
Messages
46
Programming Experience
1-3
Hi beautiful people,
My vbnet application runs 30 minutes to complete.
I need a code which close notepad.exe if user try to open notepad.exe during 30 minutes (during my application is running.).

So, I am trying to find a way to prevent opening notepad.exe during my application is running.

Any idea?

I think solution is related using
Custom event and AddHandler Statement.


Here is a link for AddHandler Statement.
https://msdn.microsoft.com/tr-tr/lib...v=vs.100).aspx


 
I think this is a very bad idea, and will likely be flagged by antivirus software. I know I would curse anyone who would develop such crap. Sorry but it's the truth. You have no business blocking access to other applications on the computer, no matter what you are doing.
 
Hi Herman,
There are a lot of code in this forum like following blocking access to other applications.

VB.NET:
For Each prog As Process In Process.GetProcesses            
            If prog.ProcessName = "NOTEPAD" Then
                prog.Kill()
            End If
Next

The difference is I need dynamic code...
Dynamic code means code should fire whenever notepad.exe open!
 
Answering of this question is so difficult and takes too long to explain.
So, please lets focus on my question:liplick:
A user opening their own instance of Notepad shouldn't have anything to do with your application's usage of it.
Even more so, everything that can be done in Notepad (working with text files) can easily be done internally within your application and you shouldn't be needing Notepad running unless you describe your situation.

Frankly using Notepad at all, let alone trying to force the user(s) to explicitly not use Notepad at the same time sounds like a really bad program design on your end, which is why we've asked: what's your purpose?
 
Back
Top