Je craqueeee !!!!!

Kywalh Messages postés 37 Date d'inscription dimanche 22 octobre 2000 Statut Membre Dernière intervention 25 septembre 2009 - 3 juil. 2002 à 18:00
surfzoid Messages postés 463 Date d'inscription vendredi 15 août 2003 Statut Membre Dernière intervention 21 avril 2010 - 16 avril 2005 à 19:06
Salut,
Comment fait-on pour rendre tout le temps visibles au premier plan des fenetres Child d'une appli...

G un prog MDI avec une fenetre principale qui ne bouge jamais (on ne peut pas la fermer, la reduire,...). A coté, je veux ouvrir des fenetres de config exactement comme les petites fenetres de Photoshop, Visual Basic, Paint Shop Pro, etc. Le probleme est que lorsque je clique sur ma fenetre principale, toutes les petites fenetres disparaissent !
J'ai essayé avec ZOrder mais je comprends pas bien comment ca marche...
Quelqu'un peut m'aider ?
Merci

5 réponses

cs_Charlie Messages postés 110 Date d'inscription jeudi 9 mai 2002 Statut Membre Dernière intervention 11 mars 2010 1
3 juil. 2002 à 20:26
Zorder fonctionne avec ... (y'a jamais de nombre plus grand que 0 dans ca...)

HWND_TOP = 0
HWND_BOTTOM = 1
HWND_TOPMOST = -1
HWND_NOTOPMOST = -2

de -2 ... -infini autre fenetre... en affichant toujours celle qui a la plus grande valeur sur le top...

mais les ZOrder ne marche pas si la feuille est a Maximized ou minimized je crois...

puis il y a aussi le API setwindowpos
0
Kywalh Messages postés 37 Date d'inscription dimanche 22 octobre 2000 Statut Membre Dernière intervention 25 septembre 2009
4 juil. 2002 à 11:03
Salut,
merci pour ta reponse mais soit ca marche pas, soit j'arrive pas a le faire fonctionner...
Lorsque je fais frmExts.ZOrder HWND_TOPMOST (= -1&), la fenetre disparait quand même derriere la fenetre principale a laquelle j'ai attribué Me.ZOrder HWND_BOTTOM (= 1&).
Deplus ma fenetre principale n'est pas maximized.
Si tu sais d'ou ca vient.... ou si tu as une autre idée, n'hesite pas ...
Merci encore
0
cs_Charlie Messages postés 110 Date d'inscription jeudi 9 mai 2002 Statut Membre Dernière intervention 11 mars 2010 1
4 juil. 2002 à 14:51
Je vais etre plus clair dans mes explications...

Si tu travailles avec le Z order... je viens de l'essayer et je ne suis pas capable de modifier sa valeurs...

Mais tu ne dois pas oublier une chose, quand tu travailles avec des children... Quand tu clic sur le child, la feuille MDI réaparait automatiquement... VB change le ZOrder meme si tu l'as attribuer manuellement, sinon, si tu fait alt+tab, ta fenetre n'apparaitrait jamais... C'est compliquer quand tu t'embarque dans les fenetres actives!

C'est une fonctionnalité de VB... pour le contourner, tu dois allé t'amuser soit dans le gotfocus de ta MDI child (si la fonction est appelé mais que pour un critere X, tu ne veux pas qu'elle apparaissent, tu replace le Zorder a une valeur que tu veux)...

Sinon, tu modifie ta feuille child pour que quand tu clic dessus, form_click()... le Zorder de ton autre est redéfinie... mais pour ca, tu dois le faire pour ta form, ton label, ton text, tes boutons... en fait, tout ce qu'il y a sur ta feuille!

Les 4 codes de hwnd... c'est a utiliser avec le API de windows... Je te colle en bas l'aide

Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

· hWnd
Identifies the window.

· hWndInsertAfter
Identifies the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values:
HWND_BOTTOM
Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST
Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP
Places the window at the top of the Z order.
HWND_TOPMOST
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.

· X
Specifies the new position of the left side of the window.

· Y
Specifies the new position of the top of the window.

· cx
Specifies the new width of the window, in pixels.

· cy
Specifies the new height of the window, in pixels.

· uFlags
Specifies the window sizing and positioning flags. This parameter can be a combination of the following values:
SWP_DRAWFRAME
Draws a frame (defined in the window’s class description) around the window.
SWP_FRAMECHANGED
Sends a WM_NCCALCSIZE message to the window, even if the window’s size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window’s size is being changed.
SWP_HIDEWINDOW
Hides the window.
SWP_NOACTIVATE
Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS
Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE
Retains the current position (ignores the X and Y parameters).
SWP_NOOWNERZORDER
Does not change the owner window’s position in the Z order.
SWP_NOREDRAW
Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION
Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING
Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER
Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW
Displays the window.

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Exemple...

Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)

Private Sub Form_Activate()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'Set the window position to topmost
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
0
cs_Lolux Messages postés 159 Date d'inscription mardi 18 décembre 2001 Statut Membre Dernière intervention 15 septembre 2005
20 avril 2004 à 13:47
pourquoi pas faire tout simplement un applel du genre :

FormMenu.Show , MDIForm1

FormMenu est ta form d'outil style photoshop
tu ne l'ouvre pas en modale mais tu l'associe à ta form MDI principale.
il ne faut pas que ta fenetre d'outils soit une child

C'est une idée comme une autre

Lolux
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
surfzoid Messages postés 463 Date d'inscription vendredi 15 août 2003 Statut Membre Dernière intervention 21 avril 2010
16 avril 2005 à 19:06
C'est bien trouvé,c est bien lolux !!!! LOL

Excelent c est exactement ça 20/20 Mr Lolux.
0
Rejoignez-nous