position fenetre
position fenetre
bonjour,
je cherche le moyen de lire la position d'une fenetre d'une autre application, une petite piste svp ?
aparement il faut utiliser GetDC_() mais comment recuperer le handle avec le nom de la fenetre par exemple ?
Aliong
je cherche le moyen de lire la position d'une fenetre d'une autre application, une petite piste svp ?
aparement il faut utiliser GetDC_() mais comment recuperer le handle avec le nom de la fenetre par exemple ?
Aliong
Re: position fenetre
merci en faite j'ai trouvé avec ça :
je vais quand même bien lire ton lien car je cherche comment lister toutes les fenêtres ouverte et connaitre leur titre
encore merci
Aliong
Code : Tout sélectionner
Application.s= "mon titre de fenetre"
Handle= FindWindow_(#Null,Application)
encore merci
Aliong
Re: position fenetre
comme ça
Code : Tout sélectionner
hWnd.l = FindWindow_( 0, 0 )
chaine.s = Space(256)
While hWnd <> 0
If GetWindowLong_(hWnd, #GWL_STYLE) & #WS_VISIBLE = #WS_VISIBLE
If GetWindowLong_(hWnd, #GWL_EXSTYLE) & #WS_EX_TOOLWINDOW <> #WS_EX_TOOLWINDOW
GetWindowText_(hWnd,@chaine,256)
If chaine <> ""
Debug Str(hwnd)+" = "+chaine
EndIf
EndIf
EndIf
hWnd = GetWindow_(hWnd, #GW_HWNDNEXT)
Wend
Re: position fenetre
exactement ce que j'ai testé dans le code du lien que tu m'a envoyer !Patrick88 a écrit :comme çaCode : Tout sélectionner
hWnd.l = FindWindow_( 0, 0 ) chaine.s = Space(256) While hWnd <> 0 If GetWindowLong_(hWnd, #GWL_STYLE) & #WS_VISIBLE = #WS_VISIBLE If GetWindowLong_(hWnd, #GWL_EXSTYLE) & #WS_EX_TOOLWINDOW <> #WS_EX_TOOLWINDOW GetWindowText_(hWnd,@chaine,256) If chaine <> "" Debug Str(hwnd)+" = "+chaine EndIf EndIf EndIf hWnd = GetWindow_(hWnd, #GW_HWNDNEXT) Wend

merci encore
Re: position fenetre
code qui permet d'obtenir des renseignements sur les gadgets de la fenetre survolé par le curseur souris
Code : Tout sélectionner
; Auteur : Chris
; Version de PB : 4
;
; Explication du programme :
; Pour connaître toutes les informations concernant l'objet sous la souris
;- Enumérations
Enumeration
#Window_0
EndEnumeration
Enumeration
#Btn_Ok
#String_0
#IP_0
#Combo_0
#List_0
#Btn_Img_0
#Progress_0
#Track_0
#Btn_Quit
#Btn_Cancel
EndEnumeration
; Appels de Structures. <-- Je sais pas si on dit ça, mais je me comprends.
Global CurPos.POINT
Global R.RECT
Global Parent.RECT
Global FP.RECT
;- Procédures
Procedure Open()
If OpenWindow(#Window_0, 300, 200, 400, 360, "Détection des objets", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget, 0)
hWnd = WindowID(#Window_0)
SetWindowPos_(hWnd, #HWND_TOPMOST, WindowX(#Window_0), WindowY(#Window_0), WindowWidth(#Window_0), WindowHeight(#Window_0) + 32, #SWP_SHOWWINDOW)
EditorGadget(#String_0, 5, 5, 385, 320)
For i = 0 To 22
AddGadgetItem(#String_0, -1, " ")
Next
ButtonGadget(#Btn_Quit, 150, 330, 100, 25, "Quit")
ProcedureReturn hWnd
EndIf
EndProcedure
Procedure SetText(Handle, x, y, w, h, hParent, h_hParent, xP, yP, wP, hP, IDWindow, Name$, NameParent$)
If hParent = 0 : NameParent$ = "Aucun" : EndIf
SetGadgetItemText(#String_0, 0, "--------- Références de l'objet pointé", 0)
SetGadgetItemText(#String_0, 2, "Handle de l'objet= " + Str(Handle), 0)
SetGadgetItemText(#String_0, 3, "Position X = " + Str(x), 0)
SetGadgetItemText(#String_0, 4, "Position Y = " + Str(y), 0)
SetGadgetItemText(#String_0, 5, "Largeur = " + Str(w), 0)
SetGadgetItemText(#String_0, 6, "Hauteur = " + Str(h), 0)
SetGadgetItemText(#String_0, 7, "ID de l'objet = " + Str(IDWindow), 0)
SetGadgetItemText(#String_0, 8, "Nom de classe = " + Name$, 0)
SetGadgetItemText(#String_0, 10, "--------- Références du parent direct", 0)
SetGadgetItemText(#String_0, 12, "Handle du Parent = " + Str(hParent), 0)
SetGadgetItemText(#String_0, 13, "Position X du Parent = " + Str(xP), 0)
SetGadgetItemText(#String_0, 14, "Position Y du Parent = " + Str(yP), 0)
SetGadgetItemText(#String_0, 15, "Largeur du Parent = " + Str(wP), 0)
SetGadgetItemText(#String_0, 16, "Hauteur du Parent = " + Str(hP), 0)
SetGadgetItemText(#String_0, 17, "Nom de classe = " + NameParent$, 0)
SetGadgetItemText(#String_0, 19, "--------- Références de la première fenêtre", 0)
SetGadgetItemText(#String_0, 21, "Handle fenêtre Mère = " + Str(h_hParent), 0)
EndProcedure
;- Programme
hWnd = Open()
SetTimer_(WindowID(#Window_0), 1, 50, 0)
Repeat
GetCursorPos_(CurPos) ; Position du curseur
; / Relatif à la Zone survolée
Handle = WindowFromPoint_(CurPos\x | CurPos\y<<32) ; Handle de la zone survolée
GetWindowRect_(Handle, R) ; Dimensions de la zone survolée
hParent = GetParent_(Handle)
If hParent <> 0 ; Si "Handle" à un parent
tmp = hParent ; stockage temporaire du handle du parent
Repeat
hTemp = GetParent_(tmp) ; Recherche du parent
If hTemp = 0 ; Si la recherche donne 0, le handle précédent est celui
h_hParent = tmp ; de la fenêtre mère
GetWindowRect_(h_hParent, FP)
Break
Else
tmp = hTemp
EndIf
Until hTemp = 0
EndIf
x = R\Left : y = R\Top : x2 = R\right : y2 = R\bottom : w = x2 - x : h = y2 - y
xP = FP\Left : yP = FP\Top : x2P = FP\right : y2P = FP\bottom : wP = x2P - xP : hP = y2P - yP
x - xP : y - yP
IDWindow = GetWindowLong_(Handle, #GWL_ID)
Name$ = Space(256)
GetClassName_(Handle, @Name$, 256)
NameParent$ = Space(256)
GetClassName_(hParent, @NameParent$, 256)
SetText(Handle, x, y, w, h, hParent, h_hParent, xP, yP, wP, hP, IDWindow, Name$, NameParent$)
Select WaitWindowEvent()
; Case #WM_TIMER
; SetText(Handle, x, y, w, h, hParent, h_hParent, xP, yP, wP, hP, IDWindow, Name$, NameParent$)
;
Case #PB_Event_CloseWindow : Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case #Btn_Quit : Quit = 1
EndSelect
EndSelect
Until Quit = 1 : End
Re: position fenetre
Merci pour ce code bien sympa
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels