http://expert.csdn.net/Expert/TopicView1.asp?id=2572209
解决方案 »
- if (System.Diagnostics.Debugger.IsAttached) 判断的什么
- 正由另一进程使用,因此该进程无法访问该文件
- cookies创建后 自动丢失
- 关于一个想学习C#的新手的提问????????????????????????
- 把字符串输出的时后带上颜色! 比如 输出红色的字符串! 可以实现吗?
- ESMTP中的验证问题
- 正则表达式筛选数据
- C#使用WebProxy出现的问题
- 对C#的类的理解,自己的笔记贴
- 如何把form1的textbox里的值传给form2的listbox的items里面?在线急等!
- (菜鸟)数据更新问题
- 在自己定义的类中如何改变一个窗体中控件的属性?多线程的时候如何处理呢?有答案后立即结贴。
{
bool ret=false;
if(OpenMutex(0x1F0001,0,appId)==IntPtr.Zero)
{
CreateMutex(IntPtr.Zero,0,appId);
ret=true;
}
return ret;
} [DllImport("Kernel32.dll",CharSet=CharSet.Auto)]
private static extern IntPtr OpenMutex(
uint dwDesiredAccess, // access
int bInheritHandle, // inheritance option
string lpName // object name
); [DllImport("Kernel32.dll",CharSet=CharSet.Auto)]
private static extern IntPtr CreateMutex(
IntPtr lpMutexAttributes, // SD
int bInitialOwner, // initial owner
string lpName // object name
);
http://dotnet.aspx.cc/ShowDetail.aspx?id=E2A17727-765F-4346-8446-5D130622CB54
http://dotnet.aspx.cc/ShowDetail.aspx?id=E2A17727-765F-4346-8446-5D130622CB54
Process instance = RunningInstance();
if (instance == null)
{
Application.Run(New MainForm());
}
else
{
MessageBox.Show("程序已经运行");
}
{
string Path=Application.ExecutablePath;
FileInfo aFile=new FileInfo(Path);
string FileName=aFile.Name;
FileName=FileName.Substring(0,FileName.Length-4);
Process[] aPro=Process.GetProcessesByName(FileName);
if(aPro.Length>1)
{
MessageBox.Show("已经有.");
Application.Exit();
}