Single Instance Application


Bilindiği üzere uygulamaların T anında birden fazla örneği olabilir(Multiple Instance Applications) Uygulamanın herhangi T anında tekil olması için ele alınabilecek bir kaç teknik vardır. Bunlardan birisi de Mutex tipinden yararlanmaktır. Aynen aşağıdaki fotoğrafta olduğu gibi.

indir

 

WPF Masa Üstüne Kısayol Ekleme


using IWshRuntimeLibrary;

private void CreateShortcut()
{
  object shDesktop = (object)"Desktop";
  WshShell shell = new WshShell();
  string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\Notepad.lnk";
  IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);
  shortcut.Description = "New shortcut for a Notepad";
  shortcut.Hotkey = "Ctrl+Shift+N";
  shortcut.TargetPath = Environment.GetFolderPath(Environment.SpecialFolders.System) + @"\notepad.exe";
  shortcut.Save();
}