想背一会英语,qq老弹出些无聊的新闻,提示,烦死人
写了个程序
<code class="lang-c"> [DllImport("User32.dll", EntryPoint = "FindWindow",CharSet = CharSet.Auto) ]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "FindWindowEx", CharSet = CharSet.Auto)]
private extern static IntPtr FindWindowEx(IntPtr parent, IntPtr child, string classname, string captionName);
[DllImport("user32", SetLastError = true, ExactSpelling = true)]
public static extern bool DestroyWindow(IntPtr hndw);
[DllImport("user32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
static void Main(string[] args)
{
IntPtr HWND = new IntPtr(0);
int delay = 100;
string[] Title;
string[] processTitle;
Process[] process;
if (args.Length > 0)
{
delay = Convert.ToInt32(args[0]);
Title = new string[args.Length];
args.CopyTo(Title, 0);
}
else
{
Title = new string[] { "腾讯新闻" };
}
processTitle = new string[] { "YoukuMediaCenter", "wwbizsrv" };
while (true)
{
for (int i = 1; i < Title.Length; i++)
{
HWND = FindWindow(null, Title<i>);
if (HWND != IntPtr.Zero)SendMessage(HWND, 0x0010, 0, 0);
}
foreach (var item in processTitle)
{
process = Process.GetProcessesByName(item);
foreach (var item2 in process) item2.Kill();
}
Thread.Sleep(delay);
}
}
}</i></code>
启动程序的时候需要把要监视关闭的窗口标题传进来
可以用命令行G:\右下角弹窗.exe "10" "腾讯新闻" "腾讯游戏" "京东" "搜狗百科" "腾讯应用宝" "游戏人生消息订阅"
也可以创建一个快捷方式
获取窗口标题可以用 spy++这个软件
如果有更好的办法,请回复,我目前只找到这个办法
QQ右下角弹窗.rar
3.03KB
RAR
27次下载
SPY++.rar
3.72MB
RAR
29次下载
200字以内,仅用于支线交流,主线讨论请采用回复功能。