C#操作IE收藏夹

        ///
        /// 整理收藏夹
        ///

        ///
        ///
        ///
        [DllImport("shdocvw.dll")]
        public static extern int DoOrganizeFavDlg(IntPtr hWnd,string pchar);

        ///
        /// 打开收藏夹所在目录
        ///

        private void OpenFavoriteList()
        {
            string favorFolder = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
            System.Diagnostics.Process.Start("explorer.exe", favorFolder);
        }

        [DllImport("User32.DLL")]
        public static extern int SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
        public int IDM_ADDFAVORITES = 2261;
        public uint WM_COMMAND = 0x0111;

        private void AddFavorite(Control c)
        {
            //核心组件  csExWB
            csExWB.cEXWB cw = c as csExWB.cEXWB;
            IntPtr vHandle = cw.IEServerHwnd;
            SendMessage(vHandle, WM_COMMAND, IDM_ADDFAVORITES, (int)this.Handle);

        }

Handle 这个参数是当前context  控件的 事件句柄 在当前页面context下 this点就可以出来

csExWB下砸地址:http://code.google.com/p/csexwb2/downloads/detail?name=csExWBv2.0.0.2_Includes_ComUtilities.zip&can=2&q=


你可能感兴趣的:(C#的Forever,c#,ie,command,string,user,c)