private bool IsAlreadyRunning() { AppSettings setting = new AppSettings(); if (setting.IsAllowRunningMultiApps || Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Count() <= 1) { return(false); } return(ProcessInterop.SendFilePathToApp(m_FeatureFilePath)); }
public void EnsureThat_ProcessInterop_ResolveProgramFullPath_ReturnsCorrect(string program, bool expected) { var result = ProcessInterop.ResolveProgramFullPath(program); if (expected) { Assert.IsNotNull(result); } else { Assert.IsNull(result); } }
// Vista + public static string GetExecutablePath(int dwProcessId) { StringBuilder buffer = new StringBuilder(1024); IntPtr hprocess = ProcessInterop.OpenProcess(ProcessInterop.PROCESS_QUERY_LIMITED_INFORMATION, false, dwProcessId); if (hprocess == IntPtr.Zero) { return(string.Empty); } try { int size = buffer.Capacity; if (ProcessInterop.QueryFullProcessImageName(hprocess, 0, buffer, out size)) { return(buffer.ToString()); } } finally { ProcessInterop.CloseHandle(hprocess); } return(string.Empty); }
private void CreateSeparateProcessButton_Click(object sender, RoutedEventArgs args) { ProcessInterop.CreateProcess(System.Environment.GetEnvironmentVariable("ComSpec"), "/C start notepad.exe text_separate.txt", true, true); }
public OpenUriCommand() : base(path => ProcessInterop.CreateProcess(null, $"cmd.exe /C start {path.AbsoluteUri}", true, true)) { }
public MouseManager() { using (var process = Process.GetCurrentProcess()) using (var module = process.MainModule) { HookCallback = HookProc; HookHandle = WI.SetWindowsHookEx(WI.HookType.WH_MOUSE_LL, HookCallback, ProcessInterop.GetModuleHandle(module.ModuleName), 0); } }