最近在看一部教程,需要将教程拖到另一个程序上才能播放,但是这个程序每次打开都弹一次网页,很是烦人,于是就做了一个程序拦截。

具体原理就是调用ShellExecute打开程序并把启动参数传递到目标程序上,但打开前先修改HKEY_CLASSES_ROOT\http\shell\open\command下的默认项,使弹出网页的协议暂时失效,之后调用ShellExecute打开程序,等待程序几秒钟(让目标程序执行完成),之后再恢复改注册表键值即可


BOOL CXxxApp::kill()
{
	CRegistry reg(HKEY_CLASSES_ROOT);
	reg.CreateKey("http\\shell\\open\\command");
	if(name=reg.ReadString(""))
	{
		reg.Write("","CC");
	}
	return TRUE;
}

BOOL CXxxApp::retn()
{
	CRegistry reg(HKEY_CLASSES_ROOT);
	reg.CreateKey("http\\shell\\open\\command");
	reg.Write("",name);
	return TRUE;
}

BOOL CXxxApp::InitInstance()
{
	AfxEnableControlContainer();

	KillProcess("ByPassTlx(JKS).exe");

	char *name = GetCommandLine();
	char cmdLine[50]={0};
	int i =0;
	for(i; i<(strlen(name)-10); i++)
	{
		cmdLine[i] = name[10+i];
	}
	cmdLine[i] = '\0';
	kill();
	ShellExecute(NULL,"open" , "E:\\Documents and Settings\\xuxu\\桌面\\甲壳虫\\ByPassTlx(JKS).exe", cmdLine, NULL, SW_MINIMIZE );
	Sleep(5000);
	retn();

	return FALSE;
}

c7c78a2397dda144ac65dc22b3b7d0a20df486c6

最后修改日期:2013 年 12 月 12 日

留言

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。