Ver Mensaje Individual
  #2  
Antiguo 03-09-2007
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.107
Reputación: 34
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola,

Tienes que procurar la ruta del menú de inicio del usuario "en sesión", o la ruta del menú de inicio para "todos los usuarios". Dentro de alguno de esos directorios has de situar las carpetas y accesos directos que consideres necesarios. Adjunto código fuente para obtener la ruta de los dos directorios mencionados.

Código Delphi [-]
unit USpecialFolder;

interface

uses
  Windows;

const
  CSIDL_STARTMENU = $000b;
  CSIDL_COMMON_STARTMENU = $0016;

function GetSpecialFolder(csidl: integer): string;
function SHGetSpecialFolderPath(Handle: HWND; Path:
 PChar; Folder: Integer; Create: Bool): BOOL; stdcall;

implementation

uses
  SysUtils;

function SHGetSpecialFolderPath; external
 'Shell32.dll' Name 'SHGetSpecialFolderPathA';

function GetSpecialFolder(csidl: integer): string;
var
  buffer: array[0..MAX_PATH] of char;
begin
  result := EmptyStr;
  if SHGetSpecialFolderPath(GetActiveWindow(),buffer,csidl,false) = true then
    result := IncludeTrailingPathDelimiter(buffer);
end;

end.

Con esta otra función puedes crear un acceso directo a una carpeta o archivo:

Código Delphi [-]
uses
  ShlObj, ActiveX, ComObj;

(* Basada en codigo de Zarko Gajic:
   http://delphi.about.com/od/windowssh...create_lnk.htm
*)
function AccesoDirecto(nombre, descripcion, directorio, 
 rutaArchivo, argumentos: string): boolean;
resourcestring
  rsExtLnk = '.lnk';
var
   IObject: IUnknown;
   ISLink: IShellLink;
   IPFile: IPersistFile;
   nombreAcceso: WideString;
begin
   IObject := CreateComObject(CLSID_ShellLink);
   ISLink := (IObject as IShellLink);
   IPFile := (IObject as IPersistFile);
   with ISLink do begin
     //SetHotkey();
     SetShowCmd(SW_SHOWNORMAL);
     SetPath(PChar(rutaArchivo));
     SetArguments(PChar(argumentos));
     SetDescription(PChar(descripcion));
     SetWorkingDirectory(PChar(ExtractFilePath(rutaArchivo)));
   end;
   directorio := IncludeTrailingPathDelimiter(directorio);
   nombreAcceso := directorio+nombre+rsExtLnk;
   result := (IPFile.Save(PWChar(nombreAcceso), false) = S_OK);
end;
__________________
David Esperalta
www.decsoftutils.com

Última edición por dec fecha: 03-09-2007 a las 16:34:03.
Responder Con Cita