I have a simple application which stores standard replies in a database, and allows me to copy them to the clipboard on a simple click or double click. That way, I can easily answer questions which come up often with a polite, simple response such as
Don't post this under Questions & Answers - if you got the code from an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
without typing too much.
I recently realized that my Standard Replies app could run multiple instances which could get confusing if I added a new reply to one instance - it wouldn't necessarily show in the other. The simplest answer was to make it a single instance application. It's not difficult to do, but it seems sensible to code it as an extension method to the Process class:
private static extern int SetForegroundWindow(IntPtr hwnd);
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int SW_RESTORE = 9;
public static void SingleInstance(this Process thisProcess)
foreach (Process proc in Process.GetProcessesByName(thisProcess.ProcessName))
if (proc.Id != thisProcess.Id)