Can Autohotkey recognize a/the difference between
"visible" windows (= windows on the current desktop)
and
"invisible" windows (= windows they have been sent to or opened on another virtual desktop)
?
Windows 10 - How to distinguish between "visible" and "invisible" windows. Topic is solved
Re: Windows 10 - How to distinguish between "visible" and "invisible" windows. Topic is solved
hi,
I have come to this, but apparently IsWindowOnCurrentVirtualDesktop() does not work, do not know why, maybe you or someone else can find the error.
Edited*
ok, this work
Edited*
ok, this work
Code: Select all
hWnd := WinExist("ahk_class Notepad")
MsgBox % "IsWindowOnCurrentVirtualDesktop: " IsWindowOnCurrentVirtualDesktop(hWnd)
ExitApp
;Indicates whether the provided window is on the currently active virtual desktop.
IsWindowOnCurrentVirtualDesktop(hWnd) {
;IVirtualDesktopManager interface
;Exposes methods that enable an application to interact with groups of windows that form virtual workspaces.
;https://msdn.microsoft.com/en-us/library/windows/desktop/mt186440(v=vs.85).aspx
CLSID := "{aa509086-5ca9-4c25-8f95-589d3c07b48a}" ;search VirtualDesktopManager clsid
IID := "{a5cd92ff-29be-454c-8d04-d82879fb3f1b}" ;search IID_IVirtualDesktopManager
IVirtualDesktopManager := ComObjCreate(CLSID, IID)
;IVirtualDesktopManager::IsWindowOnCurrentVirtualDesktop method
;Indicates whether the provided window is on the currently active virtual desktop.
;https://msdn.microsoft.com/en-us/library/windows/desktop/mt186442(v=vs.85).aspx
Error := DllCall(NumGet(NumGet(IVirtualDesktopManager+0), 3*A_PtrSize), "Ptr", IVirtualDesktopManager, "Ptr", hWnd, "IntP", onCurrentDesktop)
;free IVirtualDesktopManager
ObjRelease(IVirtualDesktopManager)
;return
if !(Error=0) ;S_OK
return false, ErrorLevel := true
return onCurrentDesktop, ErrorLevel := false
}
Re: Windows 10 - How to distinguish between "visible" and "invisible" windows.
Thanks a million!!! Works great.
How about the other two Methods of the IVirtualDesktopManager (GetWindowDesktopId, MoveWindowToDesktop)?
How about the other two Methods of the IVirtualDesktopManager (GetWindowDesktopId, MoveWindowToDesktop)?
Re: Windows 10 - How to distinguish between "visible" and "invisible" windows [IVirtualDesktopManager Interface]
I was trying
... but I couldn't make it work.
Edit [03/16/2018]*
A version for AHKv2: https://github.com/flipeador/AutoHotkey ... anager.ahk


Edit [03/16/2018]*
A version for AHKv2: https://github.com/flipeador/AutoHotkey ... anager.ahk
Who is online
Users browsing this forum: Google [Bot], holotaro, JBensimon, matheusmoosher, mikeyww and 59 guests