This question already has answers here:
C# : Making an exe to not run directly
(4 answers)
Closed 7 years ago.
I want to have a WPF C# program launch a second WPF C# program, and prevent this second program from being launched any other way. Any ideas?
You could pass the 1st application's Process Id as a parameter, and have the 2nd application look up and validate the calling process.
Compile the second program as a dll, make the entry point internal, and have both applicatios share namespaces. Depending on your level of security, you might want to implement some handshake protocol between both applications.
Related
This question already has answers here:
Check if an executable exists in the Windows path
(8 answers)
Closed 3 years ago.
I am working on a WPF app, and I would like to include a button that directs it to another app. I would like it to have the following functionality:
If the app is installed on the user's computer, it opens the app for them.
If the app is not yet installed, it sends them to a link where they can download the app.
I know I will need to use Process.Start to open the app, but I am stuck on how to check if the app exists. If anyone could point me in the right direction it would be appreciated!
Two things you can use:
File.Exists(string) - Checks if the file exists.
try-catch - Simply try to open it, and handle any exceptions.
I would probably opt for the first solution...
This question already has answers here:
How can I write on another process memory?
(4 answers)
How to remote invoke another process method from C# application
(2 answers)
Closed 3 years ago.
I've been starting to do some decompiling of my C# programs and got some interesting results by editing the dlls, but is it possible to change values and call functions in a running process given that I know what the names of the variables or functions are?
Doesn't any cheat to any game do exactly that?
I mean, if I understand you correctly, there is software called
Cheat Engine which allows you to modify process variables values, inject dll's and much more.
This question already has answers here:
Notification when a file changes?
(3 answers)
Closed 8 years ago.
I have inherited application that, among many other things, has to watch if user writes/deletes text file into specific folder.
Currently, the application uses timer and polls after 5 seconds. I find this ineffective, and wish to improve this part of code.
My question is about existence of the .NET function that monitors changes in directory. Is there such function I can use to detect when a file is written/deleted in a specified folder?
Thank you.
Yes, you have the FileSystemWatcher class. It does exactly what you're looking for
Yes there is. I would suggest you take a look at the FileSystemWatcher class:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher%28v=vs.110%29.aspx
It's quite easy to set up, and it monitors for Win32 events, so is relatively inexpensive to use.
This question already has answers here:
Auto-update library for .NET? [closed]
(12 answers)
Closed 9 years ago.
I have simple question - is it possible, to replace *.exe file (application file), when it's running? I mean i know that i cannot do that when app is running, but maybe it's possible to do something like:
do application.shutdown()
replace oldExe -> newExe
application.restart().
Create a helper application. You will run this "helper" application when you need it, and it can monitor/replace the main application when it has been closed. Once replaced, the helper application can launch your main application again.
You can also run command line arguments to your helper app, telling it what you need it to do.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
single instance and notify in system tray
I am trying to implement a program in C#.NET. My program uses the notification icon. I have made my program a single instance program using the class singleinstance.cs from codeproject.
Now, what I am trying to do is, if I close the main window and then if I run the application again, it should open the main window of the already running program instance in the system tray.
I have googled a lot over this but didn't find something useful for me.
You need to maximize the window of an existing process, correct?
Here is an example of another question: Maximize another process' Window in .NET
To note, in the future, this is a borderline duplicate question, in my opinion. You could have used the search box in the top right of this page to find this answer on your own.