I use Hardcodet.Wpf.TaskbarNotification to create tray menu, but i have some trouble with it, how can i open my app(process) from other process if it was hide to tray
I used this methods, but had not luck
[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern IntPtr SetFocus(HandleRef hWnd);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int cmd);
I have been add events Activated
to MainWindow
, and GotFocus
, Loaded
to TaskbarIcon
(TaskBar WPF Element), but those methods(from user32) didn't trigger any events (it works when app is minimized, but not when is hide to tray)
Any minds what i need to do ?
Update:
It's not duplicate, there are described how to use Mutex in the original post, i already done it. I need "bring to front", Activate or Trigger any event from other instance of my app, when the first instance is in tray There are just show MessageBox
when the second instance created, and the first instance minimized, that post is easy to do, i have more harder task than described in the original post