Agrandir une fenêtre réduite

Résolu
bilaloch Messages postés 556 Date d'inscription lundi 6 octobre 2003 Statut Membre Dernière intervention 31 octobre 2019 - 10 sept. 2007 à 14:45
bilaloch Messages postés 556 Date d'inscription lundi 6 octobre 2003 Statut Membre Dernière intervention 31 octobre 2019 - 10 sept. 2007 à 17:17
Bonjour à tous,

Je poste sur le forum à cause d'un petit problème que j'ai. En effet, je ne trouve pas d'APIs ou de fonctions me permettant d'agrandir une fenêtre présente sur la barre des tâches. J'utilise AppActivate mais je ne sais pourquoi, cela ne fonctionne pas pour les applications réduites. J'attends votre aide et vos idées avec impatience.

Merci bien,

BILALoch

6 réponses

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
10 sept. 2007 à 15:28
Salut,

Essaye avec ShowWindow (ou un nom dans ce style là), ou sinon avec SetWindowLong
______________________________________
DarK Sidious
3
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
10 sept. 2007 à 16:33
salut,

codyx : PID to HWND

tiens, voici un exemple

' DANS UNE FORM AVEC 3
CommandButton
'
Option Explicit
'
Private Const SW_SHOWMAXIMIZED  As Long = 3
Private Const SW_SHOWNORMAL     As Long = 1
'
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As
Long
'
Dim lPID As Long
'
'
Private Sub Command1_Click()
    lPID = Shell("notepad.exe", vbMinimizedFocus)
End Sub

Private Sub Command2_Click()
    If lPID Then Call SetFocusToPID(lPID, SW_SHOWNORMAL)
End Sub
Private Sub Command3_Click()
    If lPID Then Call SetFocusToPID(lPID, SW_SHOWMAXIMIZED)
End Sub
'
Private Function SetFocusToPID(ByVal lPID As Long, lFlag As Long) As Boolean
    Dim lHwnd As Long
    lHwnd = InstanceToWnd(lPID)
    If lHwnd Then
        Call ShowWindow(lHwnd, lFlag)
        Call SetForegroundWindow(lHwnd)
        SetFocusToPID = True
    Else
        SetFocusToPID = False
    End If
End Function

Private Sub Form_Load()
    Command1.Caption = "SHELL"
    Command2.Caption = "NORMAL"
    Command3.Caption = "MAXIMIZED"
End Sub

' DANS UN
MODULE
'http://www.codyx.org/snippet_recuperer-hwnd-handle-partir-pid-process-id_451.aspx
'
Option Explicit

Private Const GW_HWNDNEXT As Long = 2&
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As
Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As
Long
Private Declare Function GetWindowThreadProcessId Lib
"user32" (ByVal hwnd As Long, lpdwProcessId As Long) As
Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As
Long
'
Public Function InstanceToWnd(ByVal target_pid As Long) As Long 'API-Guid
    Dim test_hwnd As Long, test_pid As Long, test_thread_id As
Long
    test_hwnd = FindWindow(ByVal 0&, ByVal 0&)
    Do While test_hwnd <> 0&
        If GetParent(test_hwnd) = 0& Then
            test_thread_id = GetWindowThreadProcessId(test_hwnd,
test_pid)
            If test_pid = target_pid Then
                InstanceToWnd = test_hwnd
                Exit Do
            End If
        End If
        test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
    Loop
End Function

++
PCPT  [AFCK]
<hr size="2" width="100%" />Prenez un instant pour répondre à [infomsg_SONDAGE-POP3-POUR-CS_769706.aspx ce sondage] svp
3
bilaloch Messages postés 556 Date d'inscription lundi 6 octobre 2003 Statut Membre Dernière intervention 31 octobre 2019 1
10 sept. 2007 à 15:54
En fait Dark, je n'ai que le PID du programme et non le hWnd de la fenêtre. C'est pourquoi tes deux APIs ne peuvent fonctionner. Cependant, si tu as une idée pour obtenir le hWnd à partir du PID, je suis preneur ^^ . Cela me servirait beaucoup.

BILALoch
0
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
10 sept. 2007 à 16:00
Salut,

Aucune idée, mais ca doit être possible (de toute façon, avec uniquement le PID, tu peux vraiment pas faire grand chose, donc il doit bien y avoir une API pour énumérer les hwnd reliés à un processus !).
______________________________________
DarK Sidious
0

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

Posez votre question
bilaloch Messages postés 556 Date d'inscription lundi 6 octobre 2003 Statut Membre Dernière intervention 31 octobre 2019 1
10 sept. 2007 à 16:21
Je vois... Je continue donc mes recherches de ce côté.

BILALoch
0
bilaloch Messages postés 556 Date d'inscription lundi 6 octobre 2003 Statut Membre Dernière intervention 31 octobre 2019 1
10 sept. 2007 à 17:17
Re,

Merci pour ton code, PCPT, et pour ton aide, Dark. Ce forum reste toujours aussi excellent :D

BILALoch
0
Rejoignez-nous