Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
Bonjour,
J'aimerais savoir s'il est possible de savoir le mode d'execution d'une application.
A savoir, si l'application tourne avec le lancement d'un executable ou en mode RUN dans Powerbuilder.
Je voudrais gérer des messages qu'en mode test et qu'il ne se declenche pas si l'application a été lancé avec un executable.
D'avance merci pour vos reponses
Cordialement
Le_gone_de_lyon
Dernière modification par le_gone_de_lyon (27-11-2008 10:29:59)
Hors ligne
IF Handle(GetApplication()) = 0 THEN // pb ELSE // exe END IF
Hors ligne
Bonjour,
Merci pick ouic pour ta téponse hyper rapide
Hors ligne
Salut,
Ça peut être une piste de vérifier le chemin d'exécution.
Si mes souvenirs sont bons en mode run, quand on lance la fonction derécupération du répertoire d'exécution, on retrouve le chemin d'installation de PowerBuilder.
Quand on lance l'application on récupère le chemin ou est installée l'application.
A moins d'installer ton appli dans le répertoire d'installation PB, cela devrait fonctionner
[Grilled by pick ouic]
Dernière modification par Nephtis (27-11-2008 10:39:34)
Hors ligne
Salut Nephtis,
J'avais pensé à la même solution que toi, mais Pick a donné une solution bien meilleur (que je ne connaissais pas).
Description
Obtains the Windows handle of a PowerBuilder object. You can get the handle of the application, a window, or a control, but not a drawing object.
Syntax
Handle ( objectname {, previous } )
Argument Description
objectname The name of the PowerBuilder object for which you want the handle. Objectname can be any PowerBuilder object, including an application or control, but cannot be a drawing object.
previous (optional) (Obsolete argument) A boolean indicating whether you want the handle of the previous instance of an application. You can use this argument with the Application object only.In current versions of Windows, Handle always returns 0 when this argument is set to true.
Return value
Long. Returns the handle of objectname. If objectname is an application and previous is true, Handle always returns 0.
If objectname cannot be referenced at runtime, Handle returns 0 (for example, if objectname is a window and is not open).
Usage
Use Handle when you need an object handle as an argument to Windows Software Development Kit (SDK) functions or the PowerBuilder Send function.
Use IsValid instead of the Handle function to determine whether a window is open.
When you ask for the handle of the application, Handle returns 0 when you are using the PowerBuilder Run command. As far as Windows is concerned, your application does not have a handle when it is run from PowerBuilder. When you build and run an executable version of your application, the Handle function returns a valid handle for the application.
If you ask for the handle of a previous instance of an application by setting the previous flag to true, Handle
always returns 0 in current versions of Windows. Use the Windows FindWindow function to determine whether an instance of the application's main window is already open.
Hors ligne
je me sers très souvent du truc du handle de l'application
c'est très utile pour ne pas déployer sans le vouloir du code sur lequel on est en train de travailler, en entourant le code en développement de cette instruction je suis sûr qu'il ne s'exécutera pas sur les postes des utilisateurs mais seulement sur le mien quand je l'ance l'appli depuis PB.
évidemment faut pas oublier d'aller enlever cette ligne quand on veut déployer pour de bon la modif
Hors ligne