IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Delphi Discussion :

[Raccourci]-Pchar ,String


Sujet :

Delphi

  1. #1
    Membre expert
    Avatar de aityahia
    Homme Profil pro
    CIEPTAL CARS SPA
    Inscrit en
    Mars 2006
    Messages
    1 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Algérie

    Informations professionnelles :
    Activité : CIEPTAL CARS SPA
    Secteur : Transports

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 938
    Points : 3 329
    Points
    3 329
    Par défaut [Raccourci]-Pchar ,String
    salut

    j'essai de créer un racourci avec la commande IShellLink

    tous va bien mais j'ai quelque chose de tres bizzar , je veut créer un racourci avec un parametre alors le caractère " /" et remplacer par "\" lors de la créeation du raccourci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    if SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, IdList)= NOERROR  then
       begin
         MyDatabasePath :='C:\Documents and Settings\AIT YAHIA IDIR\Bureau\IDIR\';
         SHGetPathFromIDList(IdList, Path);
         ShellLink:=CreateComObject(CLSID_ShellLink) as IShellLink;
     
         ShellLink.SetDescription('Microsoft ACCESS créer avec mon prog');
         Chemin:=MyPath+'MSACCESS.EXE" "'+MyDatabasePath+'Essai.mdb"/WRKGRP "'+MyDatabasePath+'Sécurisé.mdw';
         ShellLink.SetPath(PAnsiChar(Chemin));
         ShellLink.SetWorkingDirectory(PAnsiChar(MyDatabasePath));
         ShellLink.SetDescription(PAnsiChar('Ouverture d''une table access sécuriser'));
         ShellLink.SetShowCmd(SW_SHOW);
     
         ShortCutPath:= String(Path)+ '\'+ 'Microsoft office Access'+ '.LNK';
         (ShellLink as IpersistFile).Save(StringToOleStr(ShortCutPath), true);
            ShowMEssage('access a été trouvez un racourci a été installer sur votre bureau');
       end;
      end
       else
        ShowMEssage('Access n''a pas été trouvez');

  2. #2
    Membre confirmé
    Avatar de Philippe Gormand
    Inscrit en
    Mars 2002
    Messages
    330
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 330
    Points : 647
    Points
    647
    Par défaut
    Voici le routines que j'utilise. Si cela peut t'aider :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
     
    {-----------------------------------------------------------------}
    {                        Créer un raccourci                       }
    {-----------------------------------------------------------------}
    Procedure CreFicLien(FicSource, FicRaccourci : String);
    Var
      PersistFile : IPersistFile;
      ShellLink   : IShellLink;
      RaccourciWC : Array[0..MAX_PATH] of WideChar;
    Begin
      If UpperCase(extractFileExt(FicRaccourci))<>'.LNK' Then
        FicRaccourci:=FicRaccourci+'.lnk';
      ShellLink:=CreateComObject(CLSID_ShellLink) as IShellLink;
      ShellLink.QueryInterface(IPersistFile, PersistFile);
      ShellLink.SetDescription('');
      ShellLink.SetPath(PChar(FicSource));
      ShellLink.SetShowCmd(SW_SHOW);
      MultiByteToWideChar(CP_ACP, 0, PChar(FicRaccourci), -1, @RaccourciWC, MAX_PATH);
      PersistFile.Save(RaccourciWC, true);
    End;
    {-----------------------------------------------------------------}
    {                     Supprimer un raccourci                      }
    {-----------------------------------------------------------------}
    Procedure EffaceLien(Chemin, NomRaccourci : String);
    Begin
       If Chemin[Length(Chemin)] <> '\' Then Chemin:=Chemin + '\';
       DeleteFile(Chemin + NomRaccourci + '.lnk');
    End;
    {-----------------------------------------------------------------}
    A +

  3. #3
    Membre expert
    Avatar de aityahia
    Homme Profil pro
    CIEPTAL CARS SPA
    Inscrit en
    Mars 2006
    Messages
    1 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Algérie

    Informations professionnelles :
    Activité : CIEPTAL CARS SPA
    Secteur : Transports

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 938
    Points : 3 329
    Points
    3 329
    Par défaut
    ma procédure fonctionne corectement j'arrivent a créer mon raccourci mais lorsque j'essai de rajouter a la chaine le "/WRKGRP" devien "\WRKGRP"
    ce qui engendre une erreur
    je pense la converssion de string a PansiChar est pour quelque chose

  4. #4
    Membre confirmé
    Avatar de Philippe Gormand
    Inscrit en
    Mars 2002
    Messages
    330
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 330
    Points : 647
    Points
    647
    Par défaut
    Effectivement, c'est bizard. Cela reassemble à une autocorrection.

    Essais " /WRKGRP" plutôt que "/WRKGRP".


Discussions similaires

  1. PChar, string, & Co
    Par juvamine dans le forum Langage
    Réponses: 9
    Dernier message: 02/07/2009, 16h00
  2. Thread ShellExecute PChar string transtypage
    Par ouiouioui dans le forum Débuter
    Réponses: 11
    Dernier message: 02/11/2008, 00h51
  3. Pchar , string .. déclaration..
    Par petitcoucou31 dans le forum Langage
    Réponses: 8
    Dernier message: 01/05/2006, 16h59
  4. Pchar et String
    Par mickael.be dans le forum Langage
    Réponses: 14
    Dernier message: 21/02/2006, 23h48
  5. DLL : récupérer des string/PChar...
    Par the_magik_mushroom dans le forum Langage
    Réponses: 8
    Dernier message: 10/11/2005, 10h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo