我的主程序是这样实现的
void main(string args[])
{
...
}
假如我的最终编译文件是test.exe,他需要带一个命令参数例如"hello"
我运行test.exe hello是可以正常接收的
但我要再继续运行的话就又开启一个新进程了
而我是希望在已经运行的进程里继续接收新参数,例如我再运行text.exe bye时不是新开启一个进程而是使用已经启动的test程序
void main(string args[])
{
...
}
假如我的最终编译文件是test.exe,他需要带一个命令参数例如"hello"
我运行test.exe hello是可以正常接收的
但我要再继续运行的话就又开启一个新进程了
而我是希望在已经运行的进程里继续接收新参数,例如我再运行text.exe bye时不是新开启一个进程而是使用已经启动的test程序
解决方案 »
- VS2010安装不上,快疯掉了
- 你会将Form显示在窗体的最前端吗
- 通过Process.Start("mytest.exe","1")给mytest.exe传递参数1 ,要怎么写mytest.exe里面的代码?
- 各位大虾,请问在pda开发中,如何将numericUpDown空间绑定到datagrid
- 3FA3E97A这个数据如何读取?
- 如何使用很好编码
- 关于操作Dataset问题 比较复杂 求教
- “被呼叫方拒绝接收呼叫 ” C#调用excel时出现的错误
- 请高手指教C#调用DLL的问题
- 关于Socket通信的问题,帮帮小弟吧
- 怎样跨网段访问远程的数据库(SQLserver)。。急急!!!!!!!
- 求教:关于剪贴版函数的问题
public class SECURITY_ATTRIBUTES
{
public int nLength;
public int lpSecurityDescriptor;
public int bInheritHandle;
} [System.Runtime.InteropServices.DllImport("kernel32")]
private static extern int GetLastError();
[System.Runtime.InteropServices.DllImport("kernel32")]
private static extern IntPtr CreateMutex(SECURITY_ATTRIBUTES lpMutexAttributes,bool bInitialOwner,string lpName);
[System.Runtime.InteropServices.DllImport("kernel32")]
private static extern int ReleaseMutex(IntPtr hMutex);
const int ERROR_ALREADY_EXISTS = 0183; [STAThread]
static void Main()
{
IntPtr hMutex;
hMutex=CreateMutex(null,false,"test");
if (GetLastError()!=ERROR_ALREADY_EXISTS)
{
Application.Run(new Form1());
}
else
{
MessageBox.Show("本程序只允许同时运行一个");
ReleaseMutex(hMutex);
}
}