68 |
|
public static Bitmap CreateIconFromProcess(ProcContainer proc) |
69 |
|
{ |
70 |
|
if (proc == null) return null; |
71 |
< |
return Icon.ExtractAssociatedIcon(proc.FileName).ToBitmap(); |
71 |
> |
Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true); |
72 |
> |
if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false); |
73 |
> |
Bitmap ret = large.ToBitmap(); |
74 |
> |
if (ret == null) |
75 |
> |
{ |
76 |
> |
int i = 0; |
77 |
> |
} |
78 |
> |
return ret; |
79 |
|
} |
80 |
|
public static Bitmap CreateIconFromProcess(ProcContainer proc, int Scale) |
81 |
|
{ |
82 |
|
if (proc == null) return null; |
83 |
< |
Bitmap ret = Icon.ExtractAssociatedIcon(proc.FileName).ToBitmap(); |
83 |
> |
Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true); |
84 |
> |
if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false); |
85 |
> |
Bitmap ret = large.ToBitmap(); |
86 |
> |
if (ret == null) |
87 |
> |
{ |
88 |
> |
int i = 0; |
89 |
> |
} |
90 |
|
ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale); |
91 |
|
return ret; |
92 |
|
} |
93 |
|
public static Bitmap CreateIconFromProcess(ProcContainer proc, int Width, int Height) |
94 |
|
{ |
95 |
|
if (proc == null) return null; |
96 |
< |
Bitmap ret = Icon.ExtractAssociatedIcon(proc.FileName).ToBitmap(); |
96 |
> |
Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true); |
97 |
> |
if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false); |
98 |
> |
Bitmap ret = large.ToBitmap(); |
99 |
> |
if (ret == null) |
100 |
> |
{ |
101 |
> |
int i = 0; |
102 |
> |
} |
103 |
|
ret = new Bitmap(ret, Width, Height); |
104 |
|
return ret; |
105 |
|
} |
106 |
|
private void CreateProcessIcon() |
107 |
|
{ |
108 |
|
if (this.ProcessInfo == null) return; |
109 |
< |
this.ProcessIcon = Icon.ExtractAssociatedIcon(this.FileName).ToBitmap(); |
109 |
> |
Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true); |
110 |
> |
if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false); |
111 |
> |
Bitmap ret = large.ToBitmap(); |
112 |
> |
if (ret == null) |
113 |
> |
{ |
114 |
> |
int i = 0; |
115 |
> |
} |
116 |
> |
this.ProcessIcon = ret; |
117 |
|
} |
118 |
|
private void CreateProcessIcon(int Scale) |
119 |
|
{ |
120 |
< |
Bitmap ret = Icon.ExtractAssociatedIcon(this.FileName).ToBitmap(); |
121 |
< |
ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale); |
120 |
> |
Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true); |
121 |
> |
if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false); |
122 |
> |
Bitmap ret = large.ToBitmap(); |
123 |
> |
if (ret == null) |
124 |
> |
{ |
125 |
> |
int i = 0; |
126 |
> |
} |
127 |
> |
ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale); |
128 |
|
this.ProcessIcon = ret; |
129 |
|
} |
130 |
|
private void CreateProcessIcon(int Width, int Height) |
131 |
|
{ |
132 |
|
if (this.ProcessInfo == null) return; |
133 |
< |
Bitmap ret = Icon.ExtractAssociatedIcon(this.FileName).ToBitmap(); |
134 |
< |
ret = new Bitmap(ret, Width, Height); |
133 |
> |
Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true); |
134 |
> |
if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false); |
135 |
> |
Bitmap ret = large.ToBitmap(); |
136 |
> |
if (ret == null) |
137 |
> |
{ |
138 |
> |
int i = 0; |
139 |
> |
} |
140 |
> |
ret = new Bitmap(ret, Width, Height); |
141 |
|
this.ProcessIcon = ret; |
142 |
|
} |
143 |
|
} |