Remember that the original can be extracted directly from the exe inside the picture, do not know why can not use, the following is through the loading of the Assembly reflects the resources inside the picture or icon;
Extract results are stored directly to the compilation directory, do not know left to right, and back to WinForm.
//extract icons and pictures from EXEAssembly ASSM = Assembly.LoadFrom ("Swtpro4.exe"); HashSet<string> L_strhashtype =Newhashset<string>(); foreach(stringResnameinchASSM. GetManifestResourceNames ()) {stream stream=ASSM. GetManifestResourceStream (Resname); ResourceReader RR=NewResourceReader (stream); IDictionaryEnumerator Enumerator=RR. GetEnumerator (); while(Enumerator. MoveNext ()) {DictionaryEntry de=(DictionaryEntry) Enumerator. Current; L_strhashtype.add (DE. Value.gettype (). ToString ()); Switch(DE. Value.gettype (). ToString ()) { Case "System.Drawing.Icon": System.Drawing.Icon IC=(Icon) de. Value; //path changes according to your needs using(System.IO.Stream SM =NewFileStream (DE. Key.tostring () +". ico", FileMode.Create)) {IC. Save (SM); } Break; Case "System.Drawing.Bitmap": System.Drawing.Bitmap icbmp=(Bitmap) de. Value; Icbmp. Save (DE. Key.tostring ()+". bmp"); Break; //TODO, I only wrote 2 of them here. default: Break; } //de. Key is the resource name//de. Value is the resource content}} Console.WriteLine (L_strhashtype.count);
Extract icons and pictures from EXE written in C #