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

C++Builder Discussion :

Ouvrir un répertoire sur appui d'un bouton


Sujet :

C++Builder

  1. #1
    Candidat au Club
    Inscrit en
    Mars 2006
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mars 2006
    Messages : 10
    Points : 4
    Points
    4
    Par défaut Ouvrir un répertoire sur appui d'un bouton
    Comment sur un simple appui d'un bouton dans ma fiche, je peux ouvrir un folder dans windows ex C:\Tartampion ???

    Merci de votre aide !!! :-)


    [Titre modifié par Loulou24, merci d'utiliser des titres explicites à l'avenir]

  2. #2
    Membre expérimenté
    Avatar de bakaneko
    Profil pro
    Inscrit en
    Février 2004
    Messages
    1 268
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France

    Informations forums :
    Inscription : Février 2004
    Messages : 1 268
    Points : 1 427
    Points
    1 427
    Par défaut
    Regardes du côté de la fonction ShellExecute.
    Elle permet d'exécuter un programme externe.
    Tu peux donc utiliser cette fonction avec le programme Explorer.exe et comme paramètre le dossier que tu cibles.
    + + +

  3. #3
    Candidat au Club
    Inscrit en
    Mars 2006
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mars 2006
    Messages : 10
    Points : 4
    Points
    4
    Par défaut
    avec du code VB ++ ? je peut pas l'integrer dans builder ?

  4. #4
    Membre expérimenté
    Avatar de bakaneko
    Profil pro
    Inscrit en
    Février 2004
    Messages
    1 268
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France

    Informations forums :
    Inscription : Février 2004
    Messages : 1 268
    Points : 1 427
    Points
    1 427
    Par défaut
    Du code VB++
    Je n'arrive pas à voir ce que tu veux dire...
    ShellExecute est une fonction de l'API Windows donc pas de problème pour l'utiliser dans un langage particulier.

    De plus, je ne connais pas VB++
    + + +

  5. #5
    Candidat au Club
    Inscrit en
    Mars 2006
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mars 2006
    Messages : 10
    Points : 4
    Points
    4
    Par défaut
    j'ai du mal à appliquer cette fonction shellexecute :-(

  6. #6
    Membre expérimenté
    Avatar de bakaneko
    Profil pro
    Inscrit en
    Février 2004
    Messages
    1 268
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France

    Informations forums :
    Inscription : Février 2004
    Messages : 1 268
    Points : 1 427
    Points
    1 427
    Par défaut
    Alors :
    Citation Envoyé par Aide API Windows
    HINSTANCE ShellExecute(

    HWND hwnd, // handle to parent window
    LPCTSTR lpOperation, // pointer to string that specifies operation to perform
    LPCTSTR lpFile, // pointer to filename or folder name string
    LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
    LPCTSTR lpDirectory, // pointer to string that specifies default directory
    INT nShowCmd // whether file is shown when opened
    );
    et

    Citation Envoyé par Aide API Windows
    hwnd

    Specifies a parent window. This window receives any message boxes that an application produces. For example, an application may report an error by producing a message box.

    lpOperation

    Pointer to a null-terminated string that specifies the operation to perform. The following operation strings are valid:

    String Meaning
    "open" The function opens the file specified by lpFile. The file can be an executable file or a document file. The file can be a folder to open.
    "print" The function prints the file specified by lpFile. The file should be a document file. If the file is an executable file, the function opens the file, as if "open" had been specified.
    "explore" The function explores the folder specified by lpFile.


    The lpOperation parameter can be NULL. In that case, the function opens the file specified by lpFile.

    lpFile

    Pointer to a null-terminated string that specifies the file to open or print or the folder to open or explore. The function can open an executable file or a document file. The function can print a document file.

    lpParameters

    If lpFile specifies an executable file, lpParameters is a pointer to a null-terminated string that specifies parameters to be passed to the application.
    If lpFile specifies a document file, lpParameters should be NULL.

    lpDirectory

    Pointer to a null-terminated string that specifies the default directory.

    nShowCmd

    If lpFile specifies an executable file, nShowCmd specifies how the application is to be shown when it is opened. This parameter can be one of the following values:

    Value Meaning
    SW_HIDE Hides the window and activates another window.
    SW_MAXIMIZE Maximizes the specified window.
    SW_MINIMIZE Minimizes the specified window and activates the next top-level window in the Z order.
    SW_RESTORE Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
    SW_SHOW Activates the window and displays it in its current size and position.
    SW_SHOWDEFAULT Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window.
    SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
    SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
    SW_SHOWMINNOACTIVE Displays the window as a minimized window. The active window remains active.
    SW_SHOWNA Displays the window in its current state. The active window remains active.
    SW_SHOWNOACTIVATE Displays a window in its most recent size and position. The active window remains active.
    SW_SHOWNORMAL Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.


    If lpFile specifies a document file, nShowCmd should be zero.
    donc pour, par exemple ouvrir le dossier WINNT (dossier de windows pour les versions NT avant XP), tu fais:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    ShellExecute(NULL,"open","explorer","c:\\Winnt",NULL,SW_SHOWMAXIMIZED);
    Vive l'aide
    + + +

  7. #7
    Candidat au Club
    Inscrit en
    Mars 2006
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mars 2006
    Messages : 10
    Points : 4
    Points
    4
    Par défaut
    Là ça assure ! Merci et bien le Bonjour d'un Normand.

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

Discussions similaires

  1. Réponses: 2
    Dernier message: 29/04/2015, 12h59
  2. Ouvrir un fichier sur clic d'un bouton
    Par snoopy69 dans le forum IHM
    Réponses: 2
    Dernier message: 26/05/2008, 07h28
  3. Réponses: 3
    Dernier message: 02/09/2007, 12h41
  4. Réponses: 13
    Dernier message: 06/07/2006, 14h54
  5. Réponses: 18
    Dernier message: 07/06/2006, 15h16

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