Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
On clicking directly my c# application.exe file, i am running my application and its process in task manager appears if that process on certain condition kills my application stops. What i want is to re run the application after delay of 5 seconds by it self.
You cannot. That process is gone. What you can do is start a second process with you first, most commonly called a "watchdog" or "guard", to scan for your first process and if it does not find it, start it. It's not foolproof though, somebody could just as easily kill that process, too. It's just another layer.
Advice on how to implement that is far to broad for this format, I suggest you read some good articles on it, try to implement it and come here when you find yourself stuck at a specific problem.
Although my answer might not be that helpful, and also this question isn't a kind related to coding issues, but I suppose, using Windows Task Scheduler might work out for you, as you can add various triggers to your application and repeat your task after any set amount of time.
Hope it helps. Thanks
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
As part of a program, there are situations in which the user has to be quickly notified that something is going on.
I was thinking of using Notify Icons. For some reason, they appear but don't dissapear automatically as I expected. (As in toasts in other platforms)
Then I found the status strip. Which seems convenient too and simpler to program although I have to manually remove the message
or should I go for the old MessageBox as I have been doing so far.
what are the pros or cons on using those methods of communication with the user?
Depending on your usecase and the importance of your message to the user you'll have to consider the following points:
Is the message important enough to stop the users current workflow immediately, like a messagebox does?
Is it okay, if the users misses a message, because it disappears automatically after a certain amount of time?
A messagebox is clearly the most intruding way of communicating with the user. The status strip on the other hand can easily be missed. Notification Icons including a balloon tooltip are somewhere inbetween. The ballon will most certainly close after a few seconds. But you could also add a timer to remove the notification icon itself after a certain amount of time, too.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
after one hour searching I'm writing this question.
how to read,write and modify a text in text editor while the text editor is open, the text editor might be anything such as notepad or vs or word.
the type of c# application isn't matter whatever it be.
Writing to another memory's process is more complex and less stable. Better idea is to send a message/event to another process. This link demonstrates it for notepad, but idea is similar for other editors.
You need to connect to the process, it involves a lot of Windows API and it is different for different applications. My advise, don't do it, I cannot imagine an architecture which includes this kind of actions, it is asking for bugs.
But, if you still want to do it, Google: "connect to a process notepad and change text c#"
You will find many links which explain. For example this one:
https://www.codeproject.com/Articles/670373/Csharp-Read-Write-Another-Process-Memory
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm looking for advice and experiences about proper way to create outputs from one separate application to other independent application which must take this value for own implementation conditions. to make it clearer in primitive way for example output application writes some undated value to the text file, and another running application with available path to this file reads it in time loop and if value is found makes some implementation. But I'm trying to find what is more correct way to do the same to pass it from one application directly to another
Message Queing is certainly what you are looking for.
It will let some applications put messages on the queue and some others (or not actually) consume these messages.
https://msdn.microsoft.com/en-us/library/ms711472(v=vs.85).aspx
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to somehow notify a running process from the "outside"?
I have a C# program that theoretical runs forever. And I would like to notify it to trigger some action manually. It would be best, if this solution is possible on Windows and Linux (mono).
EDIT:
The solution should work without a user interface
My program is, as for now, a part of web service. On initializing, a new Theread is created, which uses the Task class to stay alive
Take your forever-running-process and let it provide a webservice other processes can call.
You might use any cross-plattform webservice framework like WebApi or ServiceStack to achieve this via HTTP calls. This will even work over the internet (if the machines can reach each other).
There are dozens of approaches. You could also use named pipes for example, or put commands into a database (the other process has to query regularly) or - if you're fearless enough - write/read files to communicate. Be creative ...
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am trying pause time using C#/.NET. I am able to set the time but I would like to set the time to pause.
Does anyone know how to do this?
Command Prompt suggestions would also be helpful.
I'm using Visual Studio 2010 if that matters.
For testing? or real life?
For testing you can mock DateTime.Now (although it is easier to have an IClock interface). For real usage - I just wouldn't.
Or do you just mean Thread.Sleep?
I think you are talking about stopping windows time, I imagine this is a not a feature of windows to do this.
What are you actually tryting to achieve (other than break windows) there may be alternate solutions.
Well, I'm not sure why you'd want to do this, but, since there is no such thing as a 'PauseTime' function in windows, why don't you just have a service that marks the current time, and then continously sets the system time to that start time. That should achieve the effect of keeping the system time the same.
If you need to find out elapsed time for some debugging work, there's the System.Diagnotics.Stopwatch class. The page on MSDN has some decent examples on how to use it. I don't know what type of precision you're looking for, so maybe this isn't the class to use if you're looking for high performance timing diagnostics.
Hope this helps!