读书人

怎么让一个已经运行的外部程序最小化到

发布时间: 2012-03-04 11:13:34 作者: rapoo

如何让一个已经运行的外部程序最小化到托盘,或者隐藏掉
如何让一个已经运行的外部程序最小化到托盘——40分
如何让一个已经运行的外部程序隐藏掉(不在屏幕上,托盘,任务栏,进程中显示)——60分

注意:是 “已经运行” 的 “外部程序 ”

以前没做过WINDOWS开发,所以不知道怎么实现,请教各位达人,谢谢

[解决办法]
有意思,可能要使用API对那个外部程序操作了。
[解决办法]
估计得调用 windows api 去做了
[解决办法]
你去查一下:FindWindow、SetWindowPos、SendMessage这几个API函数,就知道该怎么做了!
[解决办法]
太难了,谁能把一个IE窗口 最小化到托盘,别告诉我IE不是外部程序
我的天啊,这都啥需求啊
[解决办法]
hwnd h=findwindow(nil,pchar( "窗口标题 "));
sendmessage(h,wm_hide,0,);

[解决办法]
隐藏程序,但会在任务管理器中看到
[解决办法]
LS的是Delphi的代码!
[解决办法]
隐藏进程?不会,隐藏图标?还是不会。
[解决办法]
其实只是我不会而已,因为我不知道如何把不具备托盘功能的程序,缩到托盘
不在屏幕上,任务栏//这个其实很简单,用ShowWindow这个API就可以了(msdn写的很详细)
至于脱离进程 我就不会了,因为加载到进程的东西,除非停止是出不去的
除非不叫看任务管理器(呵呵),最通常的方式是以非进程的方式启动(黑客技术的一种)

//知识有限,见谅
[解决办法]
最小化还容易
最小化到托盘就有点困难了
毕竟那个外部程序本身就没有最小化到托盘的

你只能在你的程序中弄个管理托盘图标的模块
当隐藏外部程序时,创建托盘图标(这个图标如果想对应外部程序还得另处理)
当用户点击托盘图标时,响应事件,把外部程序show出来

只能给点思路, 代码不是一两句就可以说清楚的
[解决办法]
可以试试,自己写托盘,然后把外部程序窗口隐藏掉,
[解决办法]
关注,帮顶了
[解决办法]
学习
帮顶

[解决办法]
Mark
[解决办法]
路过,顶一下
[解决办法]
接分!!!!!!!!!!
[解决办法]
外部已经运行的程序???只能UP了
[解决办法]
oo
[解决办法]
想学习~~~

[解决办法]
WinForm窗口最小化到系统托盘

C#编写最小化时隐藏为任务栏图标的Window appllication.

1.设置WinForm窗体属性showinTask=false

2.加notifyicon控件notifyIcon1,为控件notifyIcon1的属性Icon添加一个icon图标。

3.添加窗体最小化事件(首先需要添加事件引用):

this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);

//上面一行是主窗体InitializeComponent()方法中需要添加的引用

private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState==FormWindowState.Minimized)
{
this.Hide();
this.notifyIcon1.Visible=true;
}

}
4.添加点击图标事件(首先需要添加事件引用):

private void notifyIcon1_Click(object sender, EventArgs e)
{
this.Visible = true;

this.WindowState = FormWindowState.Normal;

this.notifyIcon1.Visible = false;
}


5.可以给notifyIcon添加右键菜单:



主窗体中拖入一个ContextMenu控件NicontextMenu ,点中控件,在上下文菜单中添加菜单,notifyIcon1的ContextMenu行为中选中NicontextMenu 作为上下文菜单。

this.notifyIcon1= new System.Windows.Forms.NotifyIcon(this.components);
this.NicontextMenu = new System.Windows.Forms.ContextMenu();
this.menuItem_Hide = new System.Windows.Forms.MenuItem();
this.menuItem_Show = new System.Windows.Forms.MenuItem();
this.menuItem_Aubot = new System.Windows.Forms.MenuItem();
this.menuItem_Exit = new System.Windows.Forms.MenuItem();


this.notifyIcon1.ContextMenu = this.NicontextMenu;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject( "NotifyIcon.Icon ")));
this.notifyIcon1.Text = " ";
this.notifyIcon1.Visible = true;
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click);


this.NicontextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem_Hide,
this.menuItem_Show,
this.menuItem_Aubot,
this.menuItem_Exit});
//
// menuItem_Hide
//
this.menuItem_Hide.Index = 0;
this.menuItem_Hide.Text = "隐藏 ";
this.menuItem_Hide.Click += new System.EventHandler(this.menuItem_Hide_Click);
//
// menuItem_Show
//
this.menuItem_Show.Index = 1;
this.menuItem_Show.Text = "显示 ";
this.menuItem_Show.Click += new System.EventHandler(this.menuItem_Show_Click);
//
// menuItem_Aubot
//
this.menuItem_Aubot.Index = 2;
this.menuItem_Aubot.Text = "关于 ";
this.menuItem_Aubot.Click += new System.EventHandler(this.menuItem_Aubot_Click);
//
// menuItem_Exit
//
this.menuItem_Exit.Index = 3;
this.menuItem_Exit.Text = "退出 ";
this.menuItem_Exit.Click += new System.EventHandler(this.menuItem_Exit_Click);
protected override void OnClosing(CancelEventArgs e)
{
this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
e.Cancel = true;
}
protected override void OnClosing(CancelEventArgs e)
{
//this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
e.Cancel = true;
}


private void CloseCtiServer()
{
timer.Enabled = false;
DJ160API.DisableCard();
this.NotifyIcon.Visible = false;
this.Close();
this.Dispose();
Application.Exit();
}

private void HideCtiServer()
{
this.Hide();

}

private void ShowCtiServer()
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();

}
private void CtiManiForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.CloseCtiServer();
}

private void menuItem_Show_Click(object sender, System.EventArgs e)
{
this.ShowCtiServer();
}

private void menuItem_Aubot_Click(object sender, System.EventArgs e)
{

}

private void menuItem_Exit_Click(object sender, System.EventArgs e)
{
this.CloseCtiServer();
}

private void menuItem_Hide_Click(object sender, System.EventArgs e)
{
this.HideCtiServer();
}

private void CtiManiForm_SizeChanged(object sender, System.EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.HideCtiServer();
}



}

private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{
this.ShowCtiServer();
}

[解决办法]
OOMark
[解决办法]
jrl5365(king007) 正解!
[解决办法]
WinForm窗口最小化到系统托盘

C#编写最小化时隐藏为任务栏图标的Window appllication.

1.设置WinForm窗体属性showinTask=false

2.加notifyicon控件notifyIcon1,为控件notifyIcon1的属性Icon添加一个icon图标。

3.添加窗体最小化事件(首先需要添加事件引用):

this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);

//上面一行是主窗体InitializeComponent()方法中需要添加的引用

private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState==FormWindowState.Minimized)
{
this.Hide();
this.notifyIcon1.Visible=true;
}

}
4.添加点击图标事件(首先需要添加事件引用):

private void notifyIcon1_Click(object sender, EventArgs e)
{
this.Visible = true;

this.WindowState = FormWindowState.Normal;

this.notifyIcon1.Visible = false;
}


5.可以给notifyIcon添加右键菜单:

主窗体中拖入一个ContextMenu控件NicontextMenu ,点中控件,在上下文菜单中添加菜单,notifyIcon1的ContextMenu行为中选中NicontextMenu 作为上下文菜单。

this.notifyIcon1= new System.Windows.Forms.NotifyIcon(this.components);
this.NicontextMenu = new System.Windows.Forms.ContextMenu();
this.menuItem_Hide = new System.Windows.Forms.MenuItem();
this.menuItem_Show = new System.Windows.Forms.MenuItem();
this.menuItem_Aubot = new System.Windows.Forms.MenuItem();
this.menuItem_Exit = new System.Windows.Forms.MenuItem();


this.notifyIcon1.ContextMenu = this.NicontextMenu;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject( "NotifyIcon.Icon ")));
this.notifyIcon1.Text = " ";
this.notifyIcon1.Visible = true;
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click);


this.NicontextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem_Hide,
this.menuItem_Show,
this.menuItem_Aubot,
this.menuItem_Exit});
//
// menuItem_Hide
//
this.menuItem_Hide.Index = 0;
this.menuItem_Hide.Text = "隐藏 ";
this.menuItem_Hide.Click += new System.EventHandler(this.menuItem_Hide_Click);
//
// menuItem_Show
//
this.menuItem_Show.Index = 1;
this.menuItem_Show.Text = "显示 ";
this.menuItem_Show.Click += new System.EventHandler(this.menuItem_Show_Click);
//
// menuItem_Aubot
//
this.menuItem_Aubot.Index = 2;
this.menuItem_Aubot.Text = "关于 ";
this.menuItem_Aubot.Click += new System.EventHandler(this.menuItem_Aubot_Click);
//
// menuItem_Exit
//
this.menuItem_Exit.Index = 3;
this.menuItem_Exit.Text = "退出 ";
this.menuItem_Exit.Click += new System.EventHandler(this.menuItem_Exit_Click);
protected override void OnClosing(CancelEventArgs e)
{
this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
e.Cancel = true;
}
protected override void OnClosing(CancelEventArgs e)
{
//this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
e.Cancel = true;


}


private void CloseCtiServer()
{
timer.Enabled = false;
DJ160API.DisableCard();
this.NotifyIcon.Visible = false;
this.Close();
this.Dispose();
Application.Exit();
}

private void HideCtiServer()
{
this.Hide();

}

private void ShowCtiServer()
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();

}
private void CtiManiForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.CloseCtiServer();
}

private void menuItem_Show_Click(object sender, System.EventArgs e)
{
this.ShowCtiServer();
}

private void menuItem_Aubot_Click(object sender, System.EventArgs e)
{

}

private void menuItem_Exit_Click(object sender, System.EventArgs e)
{
this.CloseCtiServer();
}

private void menuItem_Hide_Click(object sender, System.EventArgs e)
{
this.HideCtiServer();
}

private void CtiManiForm_SizeChanged(object sender, System.EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.HideCtiServer();
}

}

private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{
this.ShowCtiServer();
}

[解决办法]
路过 ,不懂 我也想学!
[解决办法]
LZ是想隐藏程序是吧,直接用工具吧 PS Tray Factory

用程序是肯定能实现的,不过我不知道:)
[解决办法]
学习

读书人网 >C#

热点推荐