我最近用C#在做一个多窗口的浏览器,但是不知道怎么实现添加到收藏夹这个功能
哪位大侠能指点一下,给出代码和提示都可以,小弟新来的,暂时没什么分能给大家,非常抱歉!!
------解决方案--------------------我的调试环境是.NET 2.0
你可以通过spy++ "?:\Program Files\Microsoft Visual Studio ?\Common?\Tools\spyxx.exe "
分析一下窗体的层级关系
主要是用FindWindowEx();找到 "Internet Explorer_Server "的窗体句柄
IntPtr vHandle = _ActiveWebBrowser.Handle;
ShowMessage(vHandle.ToString());
vHandle = FindWindowEx(vHandle, IntPtr.Zero, "Shell Embedding ", null);
ShowMessage(vHandle.ToString());
vHandle = FindWindowEx(vHandle, IntPtr.Zero, "Shell DocObject View ", null);
ShowMessage(vHandle.ToString());
vHandle = FindWindowEx(vHandle, IntPtr.Zero, "Internet Explorer_Server ", null);
ShowMessage(vHandle.ToString());
SendMessage(vHandle, WM_COMMAND, IDM_ADDFAVORITES, (int)Handle);
可以把没一步的句柄打印出来,看看最后是不是非0?