procedure TForm1.Button1Click(Sender: TObject);
begin
WinExec( 'D:\Tencent\QQ\qq.exe ',1);
Application.Terminate;
end; 如何从调用的EXE中提取图标,然后在按钮上进行显示接着上面的代码,具体该如何去写请结合上面代码给予真确答案,谢谢!
begin
WinExec( 'D:\Tencent\QQ\qq.exe ',1);
Application.Terminate;
end; 如何从调用的EXE中提取图标,然后在按钮上进行显示接着上面的代码,具体该如何去写请结合上面代码给予真确答案,谢谢!
begin
FileName:='D:\Tencent\QQ\qq.exe';
Form1.Icon.Handle:=ExtractIcon( Application.Handle, PChar(FileName), 0 );
end; 以上是提取exe或dll文件的方法,另外普通的button似乎不能放ICON到上面吧
这两个函数可以取得文件中的图标。
看我的。
uses shellapi;
procedure TForm1.Button1Click(Sender: TObject);
var
Hc: HICON;
filename: string;
begin
filename := ParamStr(0);//文件路径,这个是本程序路径。delphi图标。
Hc := ExtractIcon(HInstance, PChar(filename), 0);
if Hc <> 0 then
begin
SetWindowLong(Button1.Handle, GWL_STYLE, GetWindowLong(Button1.Handle, GWL_STYLE) or BS_ICON);
SendMessage(Button1.Handle, BM_SETIMAGE, IMAGE_ICON, Hc);
end;
end;
编译不通过,提示extractIconvo后面应该是.,请指教