winform C#实现查看收藏夹功能
来源:互联网 发布:网络歌曲 什么什水自流 编辑:程序博客网 时间:2024/05/29 17:47
//zjut
//安静是明白
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;using System.Collections;namespace JBrowser{ public partial class Form4 : Form { public ArrayList alTitle = new ArrayList(); public ArrayList alUrl = new ArrayList(); // 声明URL文件的读操作函数 GetPrivateProfileString() [System.Runtime.InteropServices.DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, System.Text.StringBuilder retVal, int size, string filePath); private string sPath = null; public Form4() { InitializeComponent(); } private void Form4_Load(object sender, EventArgs e) { //获取“收藏夹”文件路径 string myFavoritesPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites); TreeNode root = new TreeNode(); root.Text = @"收藏夹"; root.Tag = myFavoritesPath; treeView1.Nodes.Add(root); BindChild(root); } private void BindChild(TreeNode fNode) { string path = fNode.Tag.ToString(); //父目录 DirectoryInfo fDir = new DirectoryInfo(path); FileSystemInfo[] finfos = fDir.GetFileSystemInfos(); foreach (FileSystemInfo f in finfos) { string type = f.GetType().ToString(); TreeNode node = new TreeNode(); node.Text = f.Name; node.Tag = f.FullName; fNode.Nodes.Add(node); if ("System.IO.DirectoryInfo" == type) //是文件夹时才递归调用自己 { BindChild(node); } } } private void treeView1_DoubleClick(object sender, EventArgs e) { string str1 = ReadValue("InternetShortcut", "URL"); MessageBox.Show(str1); } public string ReadValue(string section, string key) { string sPath = Convert.ToString(treeView1.SelectedNode.Tag); // 每次从ini中读取多少字节 System.Text.StringBuilder temp = new System.Text.StringBuilder(255); // section=配置节,key=键名,temp=上面,path=路径 GetPrivateProfileString(section, key, "", temp, 255, sPath); return temp.ToString(); } }}
一个下午不断上网查资料,终于实现了将Favorites文件夹下的url文件读取进来,并且得到文件的url地址,接下来的navigate就简单了
- winform C#实现查看收藏夹功能
- winform 调用ie的收藏夹功能
- 用C#实现换肤功能 - winform
- C# winform 实现MD5加密功能
- C# Winform DataGridView分页功能的实现
- C# winform 实现MD5加密功能
- C# winform实现异步导出功能
- c# winform实现简单的登录功能
- c# winform TreeView控件中实现拖拽的功能
- c# winform TreeView控件中实现拖拽的功能
- c# winform TreeView控件中实现拖拽的功能
- c# winform TreeView控件中实现拖拽的功能
- C#实现的简易含undo/redo功能的winForm
- C# WINFORM 某些控件实现联想输入功能
- C# WINFORM 某些控件实现联想输入功能
- WinForm+C#代码实现控制应用程序自启动功能
- C# winform窗体实现文件拖拽打开的功能
- WinForm+C#代码实现控制应用程序自启动功能
- SharedPreferences的用法
- Sql 每月,每日,每年统计
- Word中如何隐藏菜单栏
- 粗看+Android+4.0+界面变化
- where子句的运用
- winform C#实现查看收藏夹功能
- 学会总结,不断反省
- C#基础概念二十五问
- 远程桌面连接时将本机上的东西带到远程计算机上
- java怎么实现导出excel表(poi包的应用)
- 设计模式—单例
- 软件开发 - 代码量统计
- ApplicationContext
- 默认的Notification和自定义的Notification