Ver Mensaje Individual
  #4  
Antiguo 11-10-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 24
seoane Va por buen camino
Puede que cometieras el mismo error que yo, la ruta del archivo no puede ser fija, debe ser un buffer lo bastante grande para recibir la ruta del ejecutable. Ya que si nos fijamos bien en la ayuda pone:

Cita:
If the icon handle is obtained from an executable file, the function stores the full path and file name of that executable in the string pointed to by lpIconPath.
Entonces la cosa queda así:
Código Delphi [-]
var
  Buffer: array[0..MAX_PATH] of Char;
  Icono: TIcon;
  Index: Word;
begin
  Icono:= TIcon.Create;
  try
    StrCopy(Buffer,PChar('d:\1.jpg'));
    Index:= 0;
    Icono.Handle:= ExtractAssociatedIcon(GetModuleHandle(nil),@Buffer,Index);
    // Aqui dibujo el icono, pero lo podriamos asignar a un Timage.Picture
    Canvas.Draw(0,0,Icono);
  finally
    Icono.Free;
  end;
end;

Última edición por seoane fecha: 11-10-2006 a las 20:27:26.
Responder Con Cita