Accueil > > > COMPOSANT : TDBPLINKMAKER CREEZ DES .LNK
COMPOSANT : TDBPLINKMAKER CREEZ DES .LNK
Information sur la source
Description
Je l'avais dit ;) Bon voila mon 18eme compo, un créateur de *.lnk 99% complet, le dernier % est réussir à ajouter des shortcut/hotkey aux liens créés autres que des simples lettres car CTRL+ALT+R devrait etre possible mais jue ne'y suis pas parvenu encore. La démo reprends le style de création de raccouric de windows. un .exe de la démo est dispo sur mon site perso pour les flemmards de la compilation avec unité supplémentaire ^^ L'unité StrMan.pas peut etre trouvée ici : http://diabloporc.Free.fr/delphi/
Source
- {
- ################################################################################
- # DBPLINKMAKER #
- ################################################################################
- # #
- # VERSION : 1.0 #
- # FICHIERS : dbpLinkMaker.pas,.dcu,.dcr,.bmp,ReadMe.htm #
- # AUTEUR : Julio P. (Diabloporc) #
- # CREATION : 02 sep 2006 #
- # MODIFIEE : 02 sep 2006 #
- # SITE WEB : http://diabloporc.free.fr #
- # MAIL : juliobox@free.fr #
- # LEGAL : Free sous Licence GNU/GPL #
- # INFOS : Retrouvez moi sur www.delphifr.com : "JulioDelphi" #
- # Lisez le ReadMe.htm ! #
- # #
- ################################################################################
- }
- unit dbpLinkMaker;
-
- interface
-
- uses
- Menus, Windows, SysUtils, Classes, Registry, ComObj, ActiveX, ShlObj;
-
- type
- TShellDir = (sdMenuDemarrer, sdMenuDemarrage, sdMenuProgrammes, sdMesDocuments, sdBureau, sdOnlySubDir);
-
- TCreation = class(TPersistent)
- private
- FCreateDir: Boolean;
- FShellDir: TShellDir;
- FSubdir: String;
- procedure SetSubDir(Value: String);
- public
- published
- property CreateDir: Boolean read FCreateDir write FCreateDir;
- property ShellDir: TShellDir read FShellDir write FShellDir;
- property SubDir: String read FSubDir write SetSubdir;
- end;
-
- TTypeFenetre = (tfNormale, tfAgrandie, tfReduite);
-
- TdbpLinkMaker = class(TComponent)
- private
- FAbout: String;
- FCreation: TCreation;
- FLinkFileName: String;
- FLinkFileTarget: String;
- FIcoFileName: String;
- FIcoFileNb: Integer;
- FParams: String;
- FLaunchDir: String;
- FCommentaires: String;
- // FSHortCut: String;
- FTypeFenetre: TTypeFenetre;
- procedure FSetAbout(const s: string);
- // procedure FSetShortCut(s: string);
- // function FGetShortCut: string;
- protected
- { Déclarations protégées }
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
-
- procedure Execute;
- published
- property About: String read FAbout write FSetAbout;
- property ACreerDans: TCreation read FCreation write FCreation;
- property Commentaires: String read FCommentaires write FCommentaires;
- property DossierDeLancement: String read FLaunchDir write FLaunchDir;
- property FichierACreer: String read FLinkFileName write FLinkFileName;
- property FichierALinker: String read FLinkFileTarget write FLinkFileTarget;
- property FichierIcone: String read FIcoFileName write FIcoFileName;
- property FichierIconeNb: Integer read FIcoFileNb write FIcoFileNb;
- property Parametres: String read FParams write FParams;
- // property ShortCut: String read FGetShortCut write FSetShortCut;
- property TypeFenetre: TTypeFenetre read FTypeFenetre write FTypeFenetre;
- end;
-
- procedure Register;
-
- implementation
-
- {$R dbpLinkMaker.dcr}
-
- procedure TCreation.SetSubDir(Value: String);
- begin
- if (FSubDir <> Value) and (Value <> '') then
- begin
- IncludeTrailingPathDelimiter(Value);
- FSubDir := Value;
- end;
- end;
-
- constructor TdbpLinkMaker.Create(aOwner: TComponent);
- begin
- inherited Create(aOwner);
- FCreation := TCreation.Create;
- FCreation.CreateDir := True;
- FLinkFileName := 'Nouveau Lien';
- fAbout := 'v1.0 par Julio P. (Diabloporc)';
- end;
-
- destructor TdbpLinkMaker.Destroy;
- begin
- FCreation.Free;
- inherited Destroy;
- end;
-
- procedure TdbpLinkMaker.FSetAbout(const s: string);
- begin
- //
- end;
- {
- function TdbpLinkMaker.FGetShortCut : string;
- begin
- result := FShortCut;
- end;
-
- procedure TdbpLinkMaker.FSetShortCut(s : string);
- begin
- FShortCut := s;
- end;
- }
- procedure TdbpLinkMaker.Execute;
- var
- ShellObj: IUnknown;
- ShellLnk: IShellLink;
- PersistFile: IPersistFile;
- FileName: WideString;
-
- Reg: TRegistry;
- RegStr: String;
- i: Integer;
- begin
- Reg := TRegistry.Create;
- with Reg do
- try
- RootKey := HKEY_CURRENT_USER;
- OpenKey('\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', True);
- case FCreation.FShellDir of
- sdMenuDemarrer: RegStr := 'Start Menu';
- sdMenuDemarrage: RegStr := 'Startup';
- sdMenuProgrammes: RegStr := 'Programs';
- sdMesDocuments: RegStr := 'Personal';
- sdBureau: RegStr := 'Desktop';
- else RegStr := '';
- end;
- if RegStr<>'' then
- RegStr := IncludeTrailingPathDelimiter(ReadString(RegStr)) + IncludeTrailingPathDelimiter(FCreation.FSubDir)
- else
- RegStr := IncludeTrailingPathDelimiter(FCreation.FSubDir);
- except
- end;
- Reg.Free;
-
- if FCreation.FCreateDir then ForceDirectories(RegStr);
-
- ShellObj := CreateComObject(CLSID_ShellLink);
- ShellLnk := ShellObj as IShellLink;
- PersistFile := ShellObj as IPersistFile;
-
- with ShellLnk do
- begin
- case FTypeFenetre of
- tfAgrandie: i := sw_ShowMaximized;
- tfReduite: i := sw_ShowMinNoActive;
- else i := sw_ShowNormal;
- end;
- SetArguments(PChar(FParams));
- SetDescription(PChar(FCommentaires));
- SetPath(PChar(FLinkFileTarget));
- SetWorkingDirectory(PChar(FLaunchDir));
- SetShowCmd(i);
- //SetHotkey(TextToShortCut(FShortCut));
- if fIcoFileName <> '' then
- SetIconLocation(PChar(fIcoFileName),fIcoFileNb);
- end;
-
- FileName := RegStr + FLinkFileName + '.lnk';
- PersistFile.Save(PWChar(FileName), False);
- end;
-
- procedure Register;
- begin
- RegisterComponents('Diabloporc', [TdbpLinkMaker]);
- end;
-
- end.
{
################################################################################
# DBPLINKMAKER #
################################################################################
# #
# VERSION : 1.0 #
# FICHIERS : dbpLinkMaker.pas,.dcu,.dcr,.bmp,ReadMe.htm #
# AUTEUR : Julio P. (Diabloporc) #
# CREATION : 02 sep 2006 #
# MODIFIEE : 02 sep 2006 #
# SITE WEB : http://diabloporc.free.fr #
# MAIL : juliobox@free.fr #
# LEGAL : Free sous Licence GNU/GPL #
# INFOS : Retrouvez moi sur www.delphifr.com : "JulioDelphi" #
# Lisez le ReadMe.htm ! #
# #
################################################################################
}
unit dbpLinkMaker;
interface
uses
Menus, Windows, SysUtils, Classes, Registry, ComObj, ActiveX, ShlObj;
type
TShellDir = (sdMenuDemarrer, sdMenuDemarrage, sdMenuProgrammes, sdMesDocuments, sdBureau, sdOnlySubDir);
TCreation = class(TPersistent)
private
FCreateDir: Boolean;
FShellDir: TShellDir;
FSubdir: String;
procedure SetSubDir(Value: String);
public
published
property CreateDir: Boolean read FCreateDir write FCreateDir;
property ShellDir: TShellDir read FShellDir write FShellDir;
property SubDir: String read FSubDir write SetSubdir;
end;
TTypeFenetre = (tfNormale, tfAgrandie, tfReduite);
TdbpLinkMaker = class(TComponent)
private
FAbout: String;
FCreation: TCreation;
FLinkFileName: String;
FLinkFileTarget: String;
FIcoFileName: String;
FIcoFileNb: Integer;
FParams: String;
FLaunchDir: String;
FCommentaires: String;
// FSHortCut: String;
FTypeFenetre: TTypeFenetre;
procedure FSetAbout(const s: string);
// procedure FSetShortCut(s: string);
// function FGetShortCut: string;
protected
{ Déclarations protégées }
public
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
procedure Execute;
published
property About: String read FAbout write FSetAbout;
property ACreerDans: TCreation read FCreation write FCreation;
property Commentaires: String read FCommentaires write FCommentaires;
property DossierDeLancement: String read FLaunchDir write FLaunchDir;
property FichierACreer: String read FLinkFileName write FLinkFileName;
property FichierALinker: String read FLinkFileTarget write FLinkFileTarget;
property FichierIcone: String read FIcoFileName write FIcoFileName;
property FichierIconeNb: Integer read FIcoFileNb write FIcoFileNb;
property Parametres: String read FParams write FParams;
// property ShortCut: String read FGetShortCut write FSetShortCut;
property TypeFenetre: TTypeFenetre read FTypeFenetre write FTypeFenetre;
end;
procedure Register;
implementation
{$R dbpLinkMaker.dcr}
procedure TCreation.SetSubDir(Value: String);
begin
if (FSubDir <> Value) and (Value <> '') then
begin
IncludeTrailingPathDelimiter(Value);
FSubDir := Value;
end;
end;
constructor TdbpLinkMaker.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
FCreation := TCreation.Create;
FCreation.CreateDir := True;
FLinkFileName := 'Nouveau Lien';
fAbout := 'v1.0 par Julio P. (Diabloporc)';
end;
destructor TdbpLinkMaker.Destroy;
begin
FCreation.Free;
inherited Destroy;
end;
procedure TdbpLinkMaker.FSetAbout(const s: string);
begin
//
end;
{
function TdbpLinkMaker.FGetShortCut : string;
begin
result := FShortCut;
end;
procedure TdbpLinkMaker.FSetShortCut(s : string);
begin
FShortCut := s;
end;
}
procedure TdbpLinkMaker.Execute;
var
ShellObj: IUnknown;
ShellLnk: IShellLink;
PersistFile: IPersistFile;
FileName: WideString;
Reg: TRegistry;
RegStr: String;
i: Integer;
begin
Reg := TRegistry.Create;
with Reg do
try
RootKey := HKEY_CURRENT_USER;
OpenKey('\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', True);
case FCreation.FShellDir of
sdMenuDemarrer: RegStr := 'Start Menu';
sdMenuDemarrage: RegStr := 'Startup';
sdMenuProgrammes: RegStr := 'Programs';
sdMesDocuments: RegStr := 'Personal';
sdBureau: RegStr := 'Desktop';
else RegStr := '';
end;
if RegStr<>'' then
RegStr := IncludeTrailingPathDelimiter(ReadString(RegStr)) + IncludeTrailingPathDelimiter(FCreation.FSubDir)
else
RegStr := IncludeTrailingPathDelimiter(FCreation.FSubDir);
except
end;
Reg.Free;
if FCreation.FCreateDir then ForceDirectories(RegStr);
ShellObj := CreateComObject(CLSID_ShellLink);
ShellLnk := ShellObj as IShellLink;
PersistFile := ShellObj as IPersistFile;
with ShellLnk do
begin
case FTypeFenetre of
tfAgrandie: i := sw_ShowMaximized;
tfReduite: i := sw_ShowMinNoActive;
else i := sw_ShowNormal;
end;
SetArguments(PChar(FParams));
SetDescription(PChar(FCommentaires));
SetPath(PChar(FLinkFileTarget));
SetWorkingDirectory(PChar(FLaunchDir));
SetShowCmd(i);
//SetHotkey(TextToShortCut(FShortCut));
if fIcoFileName <> '' then
SetIconLocation(PChar(fIcoFileName),fIcoFileNb);
end;
FileName := RegStr + FLinkFileName + '.lnk';
PersistFile.Save(PWChar(FileName), False);
end;
procedure Register;
begin
RegisterComponents('Diabloporc', [TdbpLinkMaker]);
end;
end.
Conclusion
Comme d'hab, si vous parvenez a l'améliorer, optimiser, vous trouvez des bugs, dites le moi ici ou juliobox@free.fr merci a vous
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
help !! comment excuté un raccourci *.lnk svp [ par tsainvet ]
bonjours !!je suis nouveau dans le monde de la programation et apres avoir je l'avous récuperer quelque source sur le site pour apprendre !!je me dé
.lnk et opendialog [ par emmanuelgo ]
salut a tous,j'ai un morceau de code qui permet de récupérer dans une listview les chemins et noms des fichiers que l'utilisateur chois
Récupérer la cible d'un raccourci [ par fgsav ]
Bonjour à tous et merci de vous intéresser à mon problème Je suis en quelque sorte en train de reproduire le comportement de l'out
Raccourci .lnk du bureau Windows [ par phephelavi ]
Bonjour à tous !Voilà, j'ai besoin pour le développemnt de mon logiciel de trouver du code qui me permet de savoir quel raccourci bureau à le focus !
racourci d'un lien [ par eclems ]
Bonsoir voila j'ai fait une fonction pour que aulieu de metre le nom de mon site dans une Tedit comme ca :='http://www.eclems68.hbg.fr/dossier'; je
création raccourci [ par senv ]
Bonjour, J'ai créé une listview et lorsque je l'édite, je fais appel à l'évènement onEdited. Tout cela fonctionne bien comme je veux. Le problème, c
Récupérer la cible d'un raccourci [ par esigvb ]
Bonjour, Comme le sujet l'indique, je recherche à récupérer la cible d'un raccourci. J'ai trouvé des informations sur la création d'un raccourci, mai
Connaitre la cible d'un raccourci [ par esigvb ]
Bonjour, Je recherche à connaitre la cible d'un raccourci. Voici comment je fais mon raccourci : procedure CreerRacourci(Repertoire_du_raccourci, Cib
Probleme lien html avec ShellExecute [ par locss ]
Bonjour,j'ai un petit probléme avec un code delphi en faite je voudrais ouvrir une url avec la commande shellExecute(), et passer dans cette url une v
on ma piraté [ par N_M_B ]
bonjour a tous je suis supper vènère je me suis fai piké 2boites mail aujourduit j'en perd mes mots c'est un marocain quii a tout pété sur MSN l
|
Derniers Blogs
[WF4] PASSAGE D'ARGUMENTS LITERAL, VISUALBASICVALUE OU LAMBDAVALUE?[WF4] PASSAGE D'ARGUMENTS LITERAL, VISUALBASICVALUE OU LAMBDAVALUE? par JeremyJeanson
Avec la sortie de la RC de Visual Studio 2010, Microsoft a mis un peu les points sur leS i en ce qui concernait le passage d'arguments. Mais nous somme un certain nombre à avoir pris ce changement comme un coup dur. Pour résumer la situation : à la sortie...
Cliquez pour lire la suite de l'article par JeremyJeanson [RIA SERVICES] INCLUDE ET DOMAINDATASOURCE[RIA SERVICES] INCLUDE ET DOMAINDATASOURCE par Audrey
Dans un de mes articles précédents , j'avais parlé des DomainDataSource avec RIA Services dans le cas d'une interface Maître - Détail. Dans le même principe, je vais parler d'une autre manière de mettre en forme ce cas d'interface avec RIA Services. Et po...
Cliquez pour lire la suite de l'article par Audrey ZUNE : VERSION ZUNE SOFTWARE V 4.2 ET LA SOCIALISATIONZUNE : VERSION ZUNE SOFTWARE V 4.2 ET LA SOCIALISATION par ROMELARD Fabrice
Une des nouveautés de la version V 3.0 était l'apparition de l'onglet Social qui ne fonctionnait que si le MarketPlace était activé sur son poste. Cela limitait donc son intérêt, car hors du cadre commercial USA-CANADA, peu de monde trouva...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice PRATIQUE DE SILVERLIGHT PAR ERIC AMBROSIPRATIQUE DE SILVERLIGHT PAR ERIC AMBROSI par MPOWARE
Je viens de finir la lecture du dernier livre d'
Eric Ambrosi
éditions PEARSON
Son livre donne une approche pratique de Silverlight qui sera aussi bien comprise par le développeur que par le designeur.
Tous les aspects du développement RIA sont abor...
Cliquez pour lire la suite de l'article par MPOWARE APPRENDRE à DéVELOPPER POUR LES MOBILES AVEC LA NOUVELLE GéNéRATION .NETAPPRENDRE à DéVELOPPER POUR LES MOBILES AVEC LA NOUVELLE GéNéRATION .NET par odewit
2 déclinaisons de Silverlight et 2 déclinaisons de Mono permettent dorénavant (ou permettront prochainement) de développer des applications .NET mobiles pour les principales plates-formes du marché :
Silverlight pour Symbian, basé sur Silverlight 2...
Cliquez pour lire la suite de l'article par odewit
Forum
RE : DELPHIRE : DELPHI par overtaker
Cliquez pour lire la suite par overtaker
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
|