能力值:
( LV4,RANK:50 )
|
-
-
2 楼
第一个问题:任何一个进程管理器都可以让它挂起和恢复,这和系统中的其它进程没区别.至于运行一段时间,那只好加个timer了.省事儿的方法大概是先call这个进程并计时,在计时器中call进程管理器挂起刚才call的进程.代码网上搜一下吧,很多. 进程挂起其实就是获取进程ID,遍历其线程并Suspend,恢复则Resume.
您可以参见f0dK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8X3S2A6i4K6u0W2j5X3q4A6k6s2g2Q4x3X3g2U0L8$3#2Q4x3V1k6F1k6i4c8W2L8r3W2X3k6g2)9J5c8X3u0D9L8$3N6Q4x3V1k6A6N6r3g2E0i4K6u0r3x3o6c8T1k6r3k6X3z5o6m8W2k6h3y4S2k6U0u0V1y4o6V1H3x3U0y4V1z5h3c8W2i4K6u0W2K9s2c8E0L8l9`.`.
第二个问题:你用的什么例子?哪年的例子?如果没猜错的话,可能是版本的原因,你的Profiler在实现接口时和你的.net版本没对应.再一种可能就是微软的大例子程序(什么事件都拦截),要等N久才会出现效果.
您可以参见坛中的文章:http://bbs.pediy.com/showthread.php?t=113697
|
能力值:
( LV9,RANK:140 )
|
-
-
3 楼
简单化考虑的话,直接调用ntdll.dll中的API就成了,下面是简单的C#代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Win1
{
public partial class Form1 : Form
{
//引入api
[DllImport("ntdll.dll")]
public static extern int ZwSuspendProcess(IntPtr ProcessId);
[DllImport("ntdll.dll")]
public static extern int ZwResumeProcess(IntPtr ProcessId);
Process myProcess;
public Form1()
{
InitializeComponent();
}
//启动一个.net程序
private void button1_Click(object sender, EventArgs e)
{
myProcess = new Process();
myProcess.StartInfo.FileName = "Win2.exe";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
}
//挂起进程
private void button2_Click(object sender, EventArgs e)
{
ZwSuspendProcess(myProcess.Handle);
}
//恢复进程
private void button3_Click(object sender, EventArgs e)
{
ZwResumeProcess(myProcess.Handle);
}
//到指定时间挂起进程
private void timer1_Tick(object sender, EventArgs e)
{
ZwSuspendProcess(myProcess.Handle);
this.timer1.Enabled = false;//关Timer
}
}
}
|
|
|