当前位置:IT168首页 > 技术开发 >
[收藏此页] [打印] [推荐] [评论]

使用Hook(钩子)阻止Flash启动浏览器打开URL

责任编辑:nancy作者:ITPUB论坛   2008-07-03   
【内容导航】
  • 第1页:
文本Tag: 微软 sql
  为了达到禁止Flash打开浏览器的目的,从Hook(Hook不知道?天极里面资料很多的)入手,截获到Flash的相关事件信息,提前启动一个专杀浏览器的线程,使得Flash打开浏览器的瞬间关闭。我们先要找到Flash在播放电子杂志时候的一些相关数据,比如系统消息,发送给外部的消息结构为:
[StructLayout(LayoutKind.Sequential)] public struct CWPSTRUCT { public IntPtr lparam; public IntPtr wparam; public int message; public IntPtr hwnd; } //在C#中使用钩子 public delegate int HookProc(int code, IntPtr wparam, ref CWPSTRUCT cwp); public static int WH_CALLWNDPROC = 0x004; //安装钩子的函数 [DllImport("user32.dll", CharSet = CharSet.Auto,CallingConvention = CallingConvention.StdCall)] public static extern IntPtr SetWindowsHookEx(int type, HookProc hook, IntPtr instance, int threadID); //调用下一个钩子的函数 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern int CallNextHookEx(IntPtr hookHandle, int code, IntPtr wparam, ref CWPSTRUCT cwp); //卸载钩子 [DllImport("User32.dll", CharSet = CharSet.Auto)] public static extern bool UnhookWindowsHookEx(IntPtr hookHandle); //获取窗体线程ID [DllImport("User32.dll", CharSet = CharSet.Auto)] public static extern int GetWindowThreadProcessId(IntPtr hwnd, int ID); private HookProc hookProc; private IntPtr hookHandle = IntPtr.Zero;
上一页
1
2下一页
收藏到: 添加到“百度搜藏”添加到“QQ书签”添加到“Google书签”添加到“Yahoo收藏”添加到“和讯网摘”
【内容导航】
  • 第1页:
本文欢迎转载,转载请注明:转载自IT168 [ http://www.it168.com/ ]
本文链接:http://tech.it168.com/d/2008-07-03/200807030912482.shtml
技术开发相关文章  
  • 暂无
友情推介