Differenze tra le versioni di "Individuare ID e nome delle finestre attive, nonché il PID dei loro programmi con le risorse del Componente gb.desktop.x11"
Da Gambas-it.org - Wikipedia.
Riga 18: | Riga 18: | ||
' ''- il nome;</font> | ' ''- il nome;</font> | ||
− | + | Write "&h" & Hex(i, 8) & | |
" " & | " " & | ||
Format(X11.GetWindowProperty(i, "_NET_WM_DESKTOP")[0], "-#") & | Format(X11.GetWindowProperty(i, "_NET_WM_DESKTOP")[0], "-#") & | ||
" " & | " " & | ||
− | Format(X11.GetWindowProperty(i, "_NET_WM_PID")[0], "######") & | + | Format(X11.GetWindowProperty(i, "_NET_WM_PID")[0], "######") & " " |
− | + | If Object.IsValid(X11.GetWindowProperty(i, "_NET_WM_NAME")) Then Write X11.GetWindowProperty(i, "_NET_WM_NAME")[0] | |
− | X11.GetWindowProperty(i, "_NET_WM_NAME")[0] | + | Print |
Next | Next |
Versione delle 10:17, 21 apr 2021
Usando alcune risorse della Classe statica "X11" del Componente "gb.desktop.x11" è possibile ottenere di ciascuna finestra aperta:
- l'identificativo (ID);
- il desktop (numero d'indice) nel quale è aperta;
- il PID del programma alla quale essa appartiene;
- il nome della finestra.
Di seguito un possibile codice:
Public Sub Form_Open() Dim i As Integer For Each i In X11.GetWindowProperty(X11.RootWindow, "_NET_CLIENT_LIST") ' Di ciascuna finestra aperta mostra in console: ' - l'ID (in esadecimale); ' - il desktop (numero d'in;dice) nel quale è aperta ' - il PID del programma alla quale appartiene; ' - il nome; Write "&h" & Hex(i, 8) & " " & Format(X11.GetWindowProperty(i, "_NET_WM_DESKTOP")[0], "-#") & " " & Format(X11.GetWindowProperty(i, "_NET_WM_PID")[0], "######") & " " If Object.IsValid(X11.GetWindowProperty(i, "_NET_WM_NAME")) Then Write X11.GetWindowProperty(i, "_NET_WM_NAME")[0] Print Next End