Beispiel #1
0
 private void OnTrayClick_열기(object sender, EventArgs e)
 {
     if (Visible)
     {
         Hide();
     }
     else
     {
         Show();
         NativeFunc.SetForegroundWindow(Handle);
     }
 }
Beispiel #2
0
    public static bool IsSingleInstance()
    {
        Process[] processArray = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
        int       currentID    = Process.GetCurrentProcess().Id;

        for (int i = 0; i < processArray.Length; i++)
        {
            if (processArray[i].Id != currentID)
            {
                IntPtr handle = new IntPtr(NativeFunc.FindWindow(null, "BigPicture"));
                NativeFunc.SetForegroundWindow(handle);
                return(false);
            }
        }
        return(true);
    }