FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» Bataille navale SM
Fenêtre en TOPMOST et Editeur Panoramic Emptypar jjn4 Hier à 17:39

» Une calculatrice en une ligne de programme
Fenêtre en TOPMOST et Editeur Panoramic Emptypar jean_debord Hier à 8:01

» Gestion d'un système client-serveur.
Fenêtre en TOPMOST et Editeur Panoramic Emptypar Pedro Jeu 25 Avr 2024 - 19:31

» Les maths du crocodile
Fenêtre en TOPMOST et Editeur Panoramic Emptypar jean_debord Jeu 25 Avr 2024 - 10:37

» Naissance de Crocodile Basic
Fenêtre en TOPMOST et Editeur Panoramic Emptypar jean_debord Jeu 25 Avr 2024 - 8:45

» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
Fenêtre en TOPMOST et Editeur Panoramic Emptypar Froggy One Mer 24 Avr 2024 - 18:38

» Dessine-moi une galaxie
Fenêtre en TOPMOST et Editeur Panoramic Emptypar jjn4 Lun 22 Avr 2024 - 13:47

» Erreur END_SUB
Fenêtre en TOPMOST et Editeur Panoramic Emptypar jjn4 Lun 22 Avr 2024 - 13:43

» Bug sur DIM_LOCAL ?
Fenêtre en TOPMOST et Editeur Panoramic Emptypar papydall Dim 21 Avr 2024 - 23:30

» Form
Fenêtre en TOPMOST et Editeur Panoramic Emptypar leclode Dim 21 Avr 2024 - 18:09

» trop de fichiers en cours
Fenêtre en TOPMOST et Editeur Panoramic Emptypar Marc Dim 21 Avr 2024 - 2:41

» 2D_fill_color(résolu)
Fenêtre en TOPMOST et Editeur Panoramic Emptypar leclode Sam 20 Avr 2024 - 8:32

» Consommation gaz électricité
Fenêtre en TOPMOST et Editeur Panoramic Emptypar leclode Mer 17 Avr 2024 - 11:07

» on_key_down (résolu)
Fenêtre en TOPMOST et Editeur Panoramic Emptypar leclode Mar 16 Avr 2024 - 11:01

» Sous-programme(résolu)
Fenêtre en TOPMOST et Editeur Panoramic Emptypar jjn4 Jeu 4 Avr 2024 - 14:42

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Avril 2024
LunMarMerJeuVenSamDim
1234567
891011121314
15161718192021
22232425262728
2930     
CalendrierCalendrier
Le Deal du moment : -29%
PC portable – MEDION 15,6″ FHD Intel i7 ...
Voir le deal
499.99 €

 

 Fenêtre en TOPMOST et Editeur Panoramic

Aller en bas 
2 participants
AuteurMessage
Navigateur

Navigateur


Nombre de messages : 42
Age : 75
Localisation : Les Clayes-sous-bois 78340
Date d'inscription : 02/09/2016

Fenêtre en TOPMOST et Editeur Panoramic Empty
MessageSujet: Fenêtre en TOPMOST et Editeur Panoramic   Fenêtre en TOPMOST et Editeur Panoramic EmptySam 2 Juin 2018 - 18:03

Bonjour,

J'ai rencontré un problème d'affichage dans mon programme de rétablissement des fenêtres des aides de l'éditeur de Panoramic.

Tout d'abord, pour mettre une fenêtre au premier plan (TOPMOST), on ne peut faire appel directement à la fonction SetWindowPos de user32.dll car elle nécessite le passage de 7 paramètres (pas de Dll_Call7). J'ai dû passer par FreeBasic pour créer une DLL à 2 paramètres.
Voir ci-dessous le code en Freebasic à compiler avec l'option -dll pour obtenir la DLL, FB_Set_Wnd_ZO.dll.

Code:
' =================================================================================================
' DLL pour changer le ZEZO-ORDER d'une fenêtre dont le handle est connu
' FREEBASIC V1.05.0
' A compiler avec l'option -dll

Extern "Windows-MS"

#Include Once "windows.bi"

Declare Function FB_Set_Wnd_ZO(as Handle, as Handle) As Integer

' SET WINDOW ZERO ORDER FUNCTION
Function FB_Set_Wnd_ZO(Wnd_Hdle as Handle, Wnd_ZO_Flag as Handle) as Integer Export
  Return SetWindowPos(Wnd_Hdle, Wnd_ZO_Flag, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE)
End Function

End Extern

' =================================================================================================
' Paramètres de la fonction SetWindowPos de user32.dll

' SetWindowPos( hwnd, hWndInsertAfter, x, y, cx, cy, wFlags)

' hwnd : Le handle de la fenêtre à déplacer.

' hWndInsertAfter : Le handle de la fenêtre à positionner pas rapport à la fenêtre située derrière
'                   ou un des paramètres d'état suivants :
'                   HWND_BOTTOM    =  1 : Mettre la fenêtre en bas de l'ordre Z.
'                   HWND_NOTOPMOST = -2 : Put the window below all topmost windows and above all non-topmost windows.
'                   HWND_TOP       =  0 : Mettre la fenêtre au dessus des autres.
'                   HWND_TOPMOST   = -1 : Mettre la fenêtre au dessus de toutes les autres en permanence.

' x   : Coordonné x du coin haut gauche.
' y   : Coordonnée y du coin haut gauche.
' cx  : Coordonnée x du coin bas droit.
' cy  : Coordonnée y du coin bas droit.

' wFlags : Zéro ou une des valeurs suivantes :
'                   SWP_DRAWFRAME    = 20  : Identique à SWP_FRAMECHANGED.
'                   SWP_FRAMECHANGED = 20  : Redessine complètement la fenêtre dans sa nouvelle position.
'                   SWP_HIDEWINDOW   = 80  : Cache la fenêtre.
'                   SWP_NOACTIVATE   = 10  : Ne réactive pas la fenêtre après déplacement si celle-ci était déjà active.
'                   SWP_NOCOPYBITS   = 100 : Ne redessine rien de la fenêtre après son déplacement.
'                   SWP_NOMOVE       = 2   : Sans déplacement de la fenêtre.
'                   SWP_NOSIZE       = 1   : Sans redimensionnement de la fenêtre.
'                   SWP_NOREDRAW     = 8   : Ne redessine pas l'image de la fenêtre de sa position initiale (laissera une image fantôme à l'écran).
'                   SWP_NOZORDER     = 4   : Ne pas changer la position de la fenêtre dans l'ordre Z.
'                   SWP_SHOWWINDOW   = 40  : Afficher la fenêtre si celle-ci est caché.
' =================================================================================================

Maintenant, en Panoramic, je crée 2 programmes pour afficher un court message dans leur fenêtre Form 0. Une fenêtre a gardé son titre (caption) par défaut et l'autre a vu son titre changé.

Affichage d'une fenêtre en TOPMOST avec son titre par défaut :

Code:
' PROGRAMME AVEC LA FORM 0 EN TOP MOST AVEC SON TITRE PAR DEFAUT
' PANORAMIC V0.9.28i18 du 27/04/2018
' FREEBASIC V1.05.0
 
' =================================================================================================
' FONCTIONS/COMMANDES PANORAMIC/FREEBASIC
' User32.dll         => Function SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int  X, int  Y, int  cx, int  cy, uFlags)
' FB_Set_Wnd_ZO.dll  => Function FB_Set_Wnd_ZO(Wnd_Hdle as Handle, Wnd_ZO_Flag as Handle) as Integer
' Définition des valeurs possibles de Wnd_ZO_Flag
Dim ZO_BOTTOM%    : ZO_BOTTOM%    =  1 : ' Put the window at the bottom of the Z-order.
Dim ZO_NOTOPMOST% : ZO_NOTOPMOST% = -2 : ' Put the window below all topmost windows and above all non-topmost windows.
Dim ZO_TOP%       : ZO_TOP%       =  0 : ' Put the window at the top of the Z-order.
Dim ZO_TOPMOST%   : ZO_TOPMOST%   = -1 : ' Make the window topmost (above all other windows) permanently.

' Dimensions / position de FORM 0
Left   0, 700
Top    0, 0
Width  0, 340
Height 0, 115

' Handle de la FORM 0
Dim Form0_Hdle%
Form0_Hdle% = Handle(0)

' FORM0 en TOPMOST
Dim res%
Dll_ON "FB_Set_Wnd_ZO.dll"
res% = Dll_Call2("FB_Set_Wnd_ZO", Form0_Hdle%, ZO_TOPMOST%)
DLL_OFF

' Affichage d'un texte
Font_Bold 0
Print
Print "     *****************************************************"
Print "     ***** FENETRE AFFICHEE EN TOPMOST *****"
Print "     *****    SANS CHANGEMENT DE TITRE   *****"
Print "     *****************************************************"

Affichage d'une fenêtre en TOPMOST avec changement de titre :

Code:
' PROGRAMME AVEC LA FORM 0 EN TOP MOST AVEC CHANGEMENT DE TITRE
' PANORAMIC V0.9.28i18 du 27/04/2018
' FREEBASIC V1.05.0
 
' =================================================================================================
' FONCTIONS/COMMANDES PANORAMIC/FREEBASIC
' User32.dll         => Function SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int  X, int  Y, int  cx, int  cy, uFlags)
' FB_Set_Wnd_ZO.dll  => Function FB_Set_Wnd_ZO(Wnd_Hdle as Handle, Wnd_ZO_Flag as Handle) as Integer
' Définition des valeurs possibles de Wnd_ZO_Flag
Dim ZO_BOTTOM%    : ZO_BOTTOM%    =  1 : ' Put the window at the bottom of the Z-order.
Dim ZO_NOTOPMOST% : ZO_NOTOPMOST% = -2 : ' Put the window below all topmost windows and above all non-topmost windows.
Dim ZO_TOP%       : ZO_TOP%       =  0 : ' Put the window at the top of the Z-order.
Dim ZO_TOPMOST%   : ZO_TOPMOST%   = -1 : ' Make the window topmost (above all other windows) permanently.

' Dimensions / position de FORM 0
Left   0, 700
Top    0, 120
Width  0, 340
Height 0, 115

' Handle de la FORM 0
Dim Form0_Hdle%
Form0_Hdle% = Handle(0)

' Changement de nom de FORM 0
Caption 0, "TOPMOST"

' FORM0 en TOPMOST
Dim res%
Dll_ON "FB_Set_Wnd_ZO.dll"
res% = Dll_Call2("FB_Set_Wnd_ZO", Form0_Hdle%, ZO_TOPMOST%)
DLL_OFF

' Affichage d'un texte
Font_Bold 0
Print
Print "     *****************************************************"
Print "     ***** FENETRE AFFICHEE EN TOPMOST *****"
Print "     *****    AVEC CHANGEMENT DE TITRE   *****"
Print "     *****************************************************"

Je crée les deux fichiers exe correspondant que j'exécute.

Si à partir de la même version de l'éditeur, j'exécute via F9 un autre programme (même sans aucune instruction), la fenêtre qui a gardé son titre par défaut disparaît.

Cela semble lié à un processus (Père ?) lié à la fenêtre dont le titre, qui n'a pas changé, est le même que celui de l'éditeur qui l'a créé.
L'éditeur/son make-exe doit faire le "ménage" au lancement d'un autre programme (du moins parmi les programmes à fenêtre TOPMOST qui portent le même titre que lui ?)

Handle           Lev      Pid     -Window status-  Image                                                 Caption
0x3A09D8 1     3400  Res Ina Ena Vis   FEN_TOPMOST_AVEC_CHGT_NOM  Fen_topmost_avec_chgt_nom
0x4506BC 1     5880  Res Ina Ena Vis   FEN_TOPMOST_SANS_CHGT_NOM  Fen_topmost_sans_chgt_nom
0x34053C 1     5880  Res Ina Ena Vis   FEN_TOPMOST_SANS_CHGT_NOM  PANORAMIC V 0.9.28i18


Navigateur
Revenir en haut Aller en bas
papydall

papydall


Nombre de messages : 6996
Age : 73
Localisation : Moknine (Tunisie) Entre la chaise et le clavier
Date d'inscription : 03/03/2012

Fenêtre en TOPMOST et Editeur Panoramic Empty
MessageSujet: Re: Fenêtre en TOPMOST et Editeur Panoramic   Fenêtre en TOPMOST et Editeur Panoramic EmptySam 2 Juin 2018 - 19:02

Au lieu de SetWindowPos tu peux utiliser BringWindowToTop de la user32.dll qui permet d’amener une fenêtre spécifiée en haut du Z-index, en la plaçant au dessus de toutes les fenêtres qui se trouvaient auparavant dessus.

Inspire toi de ce code pour l'adapter à tes besoins.

Code:

rem ============================================================================
label clic
dim i,hwnd%,ret%
shape 1 : shape_rectangle_rounded 1 : full_space 1 : color 1,255,255,0
for i = 10 to 50 step 10
    panel i : top i,5*i : left i,4*i : width i,200 : height i,150
    color i,i*4,255-i,i : on_click i,clic
next i

for i = 100 to 150 step 10
    panel i : top i, 2.5*i-150 : left i,500-2*i
    width i,250 : height i,100
    color i,50+i,100,200-i : on_click i,clic
next i
caption 0,"Cliquez dans les PANELs"
end
rem ============================================================================
Clic:
   dll_on "user32"
   hwnd% = handle(number_click)
   ret% = dll_call1("BringWindowToTop",hwnd%)
   dll_off
return
rem ============================================================================
Revenir en haut Aller en bas
http://papydall-panoramic.forumarabia.com/
Navigateur

Navigateur


Nombre de messages : 42
Age : 75
Localisation : Les Clayes-sous-bois 78340
Date d'inscription : 02/09/2016

Fenêtre en TOPMOST et Editeur Panoramic Empty
MessageSujet: Re: Fenêtre en TOPMOST et Editeur Panoramic   Fenêtre en TOPMOST et Editeur Panoramic EmptyDim 3 Juin 2018 - 13:43

Bonjour,

Merci papydall pour la réponse.

En fait la fonction BringWindowToTop de user32.dll ne permet pas de mettre une fenêtre au premier plan.

Il a des subtilités dans l'états de fenêtres que je ne comprends pas encore bien. Voir ci-dessous quelques explications trouvées sur le WEB.

D'après
- https://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx
- https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms632673(v=vs.85).aspx

 BringWindowToTop function :

 Brings the specified window to the top of the Z order.
 If the window is a top-level window, it is activated.
 If the window is a child window, the top-level parent window associated with the child window is activated.


 SetWindowPos function :
 Changes the size, position, and Z order of a child, pop-up, or top-level window.
 These windows are ordered according to their appearance on the screen.
 The topmost window receives the highest rank and is the first window in the Z order.


- http://forums.codeguru.com/showthread.php?491610-Windows-SDK-What-is-a-top-level-window
 Windows SDK: What is a top-level window?
 Q: What is a top-level window?

 A: A top-level window is a window that is not child, i.e. it has not WS_CHILD style set.

 Notes
 . unlike the child windows, a top-level window can be displayed anywhere in the screen;
 . many definitions state that a top-level window is "a window that has no parent";
that is correct but can lead in a confusion: many people think that every window which is created passing a valid hWndParent in CreateWindow(Ex) "has a parent" then, according to the definition it is not top-level;
in fact hWndParent may be either a handle to parent or owner window;
if hWndParent is a valid window handle and WS_CHILD style is not set, then we have a top-level owned window;
 . a top-level window can or can not be owned but is never a child; further we can say that it can have an owner but never has a parent.
 . top-level windows can be either overlapped windows (having WS_OVERLAPPED style and generally used as application main window) or popup windows (having WS_POPUP style, usually temporary windows like message boxes and dialogs);
. the coordinates used in CreateWindow(Ex), MoveWindow, SetWindowPos, and so on are always scren coordinates (relative to top-left corner of the screen).


Pour revenir à mon problème dans le rétablissement des fenêtres d'aide de l'éditeur de Panoramic, je l'ai résolu en renommant la fenêtre de mon programme. En faisant cela, il me semble que mon programme n’apparaît plus comme étant un enfant (child) de l'éditeur Panoramic et n'est plus perturbé par le lancement d'un autre programme par F9.

Navigateur.
Revenir en haut Aller en bas
Contenu sponsorisé





Fenêtre en TOPMOST et Editeur Panoramic Empty
MessageSujet: Re: Fenêtre en TOPMOST et Editeur Panoramic   Fenêtre en TOPMOST et Editeur Panoramic Empty

Revenir en haut Aller en bas
 
Fenêtre en TOPMOST et Editeur Panoramic
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Fenêtre de l\'Editeur... riquiqui
» Editeur EliP 5 : Tiny éditeur Panoramic
» Glisser des fichiers sources sur la fenêtre de l'éditeur
» Minimiser une fenêtre Panoramic.
» Transmission d'un clic à une fenêtre non Panoramic.

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: PANORAMIC :: A l'aide!-
Sauter vers: