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 :

Ajouter un menu dans le popup bureau windows


Sujet :

Delphi

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de kanzarih
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Novembre 2002
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux

    Informations forums :
    Inscription : Novembre 2002
    Messages : 327
    Par défaut Ajouter un menu dans le popup bureau windows
    Bonjour,
    Quelqu'un peut il m'aider pour ajouter un élément dans le popup menu du bureau Windows?
    - existe t il un tuto ou un composant?

    Merci

  2. #2
    Membre éclairé Avatar de kanzarih
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Novembre 2002
    Messages
    327
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux

    Informations forums :
    Inscription : Novembre 2002
    Messages : 327
    Par défaut
    Résolu

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    SetCreateKey(HKEY_CLASSES_ROOT,'Directory\shell', 'MonApplication');
      SetCreateKey(HKEY_CLASSES_ROOT,'Directory\shell\MonApplication', 'Command');
      SetWriteString(HKEY_CLASSES_ROOT,'Directory\shell\MonApplication\Command', '', 'calc %1');
      MessageDlg('Votre configuration a été modifiée avec succès !', mtinformation, [mbOk], 0);

  3. #3
    Membre éprouvé
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    96
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 96
    Par défaut
    Bonjour et merci pour l'info,

    mais pour supprimer ce menu créé, comment fait-on ?

    merci.

  4. #4
    Membre éprouvé
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    2 604
    Détails du profil
    Informations personnelles :
    Âge : 72
    Localisation : Belgique

    Informations forums :
    Inscription : Janvier 2006
    Messages : 2 604
    Par défaut
    Bonjour à toutes et à tous,

    @ Serge-07, voici l'unité complète de ce code :

    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
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
     
    unit Unit1;
     
    interface
     
    uses
      Windows, Forms, Registry, Buttons, StdCtrls, ShellAPI, jpeg, ExtCtrls, Dialogs, Classes,
      Graphics, Controls, SysUtils;
     
    type
      TForm1 = class(TForm)
        SpeedButton1: TSpeedButton;
        Label1: TLabel;
        Label2: TLabel;
        Image1: TImage;
        SpeedButton2: TSpeedButton;
        Label4: TLabel;
        Label3: TLabel;
        Label5: TLabel;
        Label6: TLabel;
        SpeedButton3: TSpeedButton;
        SpeedButton4: TSpeedButton;
        procedure SetCreateKey(SelectRootKey: HKEY; SelectKey: string; NewKey: string);
        procedure SetWriteString(SelectRootKey: HKEY; SelectKey: string; NewValueName: string; Value: string);
        function GetDeleteKey(SelectRootKey: HKEY; SelectKey: string; Key: string): Boolean;
        procedure SpeedButton1Click(Sender: TObject);
        procedure Label2Click(Sender: TObject);
        procedure SpeedButton2Click(Sender: TObject);
        procedure SpeedButton3Click(Sender: TObject);
        procedure SpeedButton4Click(Sender: TObject);
      private
        { Déclarations privées }
      public
        { Déclarations publiques }
      end;
     
    var
      Form1: TForm1;
     
    implementation
     
    {$R *.dfm}
     
    procedure TForm1.SetCreateKey(SelectRootKey: HKEY; SelectKey: string; NewKey: string);
    begin
     
      with TRegistry.Create do
        begin
          try
            RootKey := SelectRootKey;
            OpenKey(SelectKey, True);
            if not KeyExists(NewKey) then
              CreateKey(NewKey);
          finally
           Free;
          end;
        end;
     
    end;
     
    procedure TForm1.SetWriteString(SelectRootKey: HKEY; SelectKey: string; NewValueName: string; Value: string);
    begin
     
      with TRegistry.Create do
        begin
          try
            RootKey := SelectRootKey;
            OpenKey(SelectKey, True);
            WriteString(NewValueName, Value);
          finally
           Free;
          end;
        end;
     
    end;
     
    function TForm1.GetDeleteKey(SelectRootKey: HKEY; SelectKey: string; Key: string): Boolean;
    begin
     
      with TRegistry.Create do
        begin
          try
            RootKey := SelectRootKey;
            OpenKey(SelectKey, True);
            Result := DeleteKey(Key);
          finally
           Free;
          end;
        end;
     
    end;
     
    procedure TForm1.SpeedButton1Click(Sender: TObject);
    begin
      // Clé : HKCR\Directory\shell
      // Etape 1 : Ajouter une clé, par exemple "MonApplication"
      // Etape 2 : Ajouter une clé "Command"
      // Etape 3 : Dans la clé Command à droite, cliquez sur (par valeur) et ajoutez la données de la valeur.
      // Valeur : (par défaut)
      // Compatibilités : 95, 98, Me, NT, 2K
      // Type : REG_SZ
      // Données de la valeur : calc %1
     
      SetCreateKey(HKEY_CLASSES_ROOT,'Directory\shell', 'MonApplication');
      SetCreateKey(HKEY_CLASSES_ROOT,'Directory\shell\MonApplication', 'Command');
      SetWriteString(HKEY_CLASSES_ROOT,'Directory\shell\MonApplication\Command', '', 'calc %1');
      MessageDlg('Votre configuration a été modifiée avec succès !', mtinformation, [mbOk], 0);
    end;
     
     
     
    procedure TForm1.SpeedButton2Click(Sender: TObject);
    begin
      // Efface la valeur
      GetDeleteKey(HKEY_CLASSES_ROOT, 'Directory\shell\MonApplication', 'Command');
      GetDeleteKey(HKEY_CLASSES_ROOT, 'Directory\shell', 'MonApplication');
      MessageDlg('Votre configuration d''origine a été rétablie avec succès !', mtinformation, [mbOk], 0)
    end;
     
    procedure TForm1.Label2Click(Sender: TObject);
    begin
     shellexecute(0,'open', 'http://www.dev-zone.com/faq/bdr/fqbdr_index.php', nil, nil, SW_SHOWMAXIMIZED	);
    end;
     
    procedure TForm1.SpeedButton3Click(Sender: TObject);
    begin
      // Clé : HKCR\exefile\shell
      // Etape 1 : Ajouter une clé, par exemple "MonApplicationExe"
      // Etape 2 : Ajouter une clé "Command"
      // Etape 3 : Dans la clé Command à droite, cliquez sur (par valeur) et ajoutez la données de la valeur.
      // Valeur : (par défaut)
      // Compatibilités : 95, 98, Me, NT, 2K
      // Type : REG_SZ
      // Données de la valeur : calc %1
     
      SetCreateKey(HKEY_CLASSES_ROOT,'exefile\shell', 'MonApplicationExe');
      SetCreateKey(HKEY_CLASSES_ROOT,'exefile\shell\MonApplicationExe', 'Command');
      SetWriteString(HKEY_CLASSES_ROOT,'exefile\shell\MonApplicationExe\Command', '', 'calc %1');
      MessageDlg('Votre configuration a été modifiée avec succès !', mtinformation, [mbOk], 0);
    end;
     
    procedure TForm1.SpeedButton4Click(Sender: TObject);
    begin
      // Efface la valeur
      GetDeleteKey(HKEY_CLASSES_ROOT, 'exefile\shell\MonApplicationExe', 'Command');
      GetDeleteKey(HKEY_CLASSES_ROOT, 'exefile\shell', 'MonApplicationExe');
      MessageDlg('Votre configuration d''origine a été rétablie avec succès !', mtinformation, [mbOk], 0)
    end;
     
    end.
    @+,

    Cincap

  5. #5
    Membre éprouvé
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    96
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 96
    Par défaut
    Merci...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Ajouter un menu dans une application MFC AppWizard
    Par EmbeddedMan dans le forum MFC
    Réponses: 3
    Dernier message: 08/02/2007, 16h19
  2. [MFC] Ajouter un menu dans un Dialogue
    Par poseidon2 dans le forum MFC
    Réponses: 3
    Dernier message: 26/01/2006, 17h57
  3. Ajouter un menu dans un formulaire
    Par Yves2507 dans le forum Access
    Réponses: 6
    Dernier message: 10/01/2006, 22h39
  4. Ajouter un menu dans un formulaire
    Par Yves2507 dans le forum IHM
    Réponses: 4
    Dernier message: 30/11/2005, 22h29
  5. Ajout de menu dans outlook
    Par krfa1 dans le forum Outlook
    Réponses: 4
    Dernier message: 26/10/2005, 15h15

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