利用c#制作托盘程序,并禁止多个应用实例运行
2007-12-30 17:37
701 查看
托盘程序的制作:
1.把NotifyIcon控件拉一个到窗体上,并设置NotifyIcon的Icon(很重要!否则运行后看不到效果)
2.窗体关闭时,将程序最小化到系统托盘上
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
private void menuShow_Click(object sender, EventArgs e)
private void menuExit_Click(object sender, EventArgs e)
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
namespace LuceneTest
{
static class Program
{
/**//// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
bool bCreatedNew;
Mutex m = new Mutex(false, "Product_Index_Cntvs", out bCreatedNew);
if (bCreatedNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
}
1.把NotifyIcon控件拉一个到窗体上,并设置NotifyIcon的Icon(很重要!否则运行后看不到效果)
2.窗体关闭时,将程序最小化到系统托盘上
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
private void menuShow_Click(object sender, EventArgs e)
private void menuExit_Click(object sender, EventArgs e)
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
namespace LuceneTest
{
static class Program
{
/**//// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
bool bCreatedNew;
Mutex m = new Mutex(false, "Product_Index_Cntvs", out bCreatedNew);
if (bCreatedNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
}
相关文章推荐
- 利用c#制作托盘程序,并禁止多个应用实例运行
- 利用c#制作托盘程序,并禁止多个应用实例运行
- C#(利用c#制作托盘程序,并禁止多个应用实例运行)
- C#实现托盘程序并禁止多个应用实例运行的方法
- C#之使用NotifyIcon实现任务栏托盘菜单,图标闪烁效果及气泡提示 很多程序是只需要后台运行的,甚至不需要自己的应用界面。NotifyIcon提供了程序在任务栏的显示功能 程序下载链接如下
- C#利用Mutex实现只运行一个程序实例
- C#利用Mutex实现只运行一个程序实例
- C# 禁止程序多个实例运行
- [转]C#禁止重复运行程序,并激活原托盘程序
- 关于C#禁止多个实例程序运行的详细解决
- C#禁止重复运行程序,并激活原托盘程序
- c# 程序只能运行一次(多次运行只能打开同一个程序) 并激活第一个实例,使其获得焦点,并在最前端显示.
- 只能运行一个程序,禁止运行多个相同的程序 C#
- C#_WinForm程序只允许运行一个实例
- C#限制程序只能运行一個实例 (防多开)
- 使用Mutex实现程序单实例运行(c#)
- c# Winform 如何实现程序只能同时运行一个实例
- C#winforms如何禁止同一个程序运行两次
- C#程序只允许运行一个实例的解决方案
- C# 确保程序只有一个实例在运行[转]