[System.Runtime.InteropServices.DllImport("shell32.dll")] private static extern int ExtractIconEx(string lpszFile, int niconIndex, IntPtr []phiconLarge,IntPtr []phiconSmall, int nIcons); private IntPtr[] largeIcons, smallIcons ; //存放大/小图标的指针数组 private string appPath = @"D:\Program Files\Tencent\QQ\Bin\QQ.exe"; //第一步:获取程序中的图标数 int IconCount = ExtractIconEx(appPath, -1, null,null, 0); //第二步:创建存放大/小图标的空间 largeIcons = new IntPtr[IconCount]; smallIcons = new IntPtr[IconCount]; //第三步:抽取所有的大小图标保存到largeIcons和smallIcons中 ExtractIconEx(appPath, 0, largeIcons,smallIcons, IconCount); //第四步:显示抽取的图标(推荐使用imageList和listview搭配显示) for (int i = 0; i < IconCount; i++) { this.imageList1.Images.Add(Icon.FromHandle(largeIcons[i])); //图标添加进imageList中 ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = i; //listview子项图标索引项 this.listview1.Items.Add(lvi); } //第五步:保存图标 for (int i = 0; i < this.listview1.Items.Count; i++) { System.IO.FileStream fs = new System.IO.FileStream(Application.StartupPath +"\\newIcon.png", System.IO.FileMode.Create); this.imageList1.Images[this.listview1.Items[i].ImageIndex].Save(fs, System.Drawing.Imaging.ImageFormat.Png); fs.Close(); }