Skip to content

Explorer Lib With Tabs In Windows 11 #14

@King-of-Kings-980

Description

@King-of-Kings-980

In the Explorer Lib, in order to retrieve the right tab/window in the Windows 11 Explorer, you need to check if the window title is the same as the title of the tab in addition to checking if it is the right hwnd:

Explorer_GetWindow(hwnd="")
{
    WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
    WinGetClass class, ahk_id %hwnd%
	
	If (process!="explorer.exe")
		Return
	If (class ~= "(Cabinet|Explore)WClass")
	{
        WinGetTitle, currentWindowTitle, A
		For window In ComObjCreate("Shell.Application").Windows
			If (window.hwnd == hwnd And window.LocationName == currentWindowTitle)
				Return window
	}
	Else If (class ~= "Progman|WorkerW") 
		Return "desktop" ; desktop found
}

The two thing I added to the code are WinGetTitle, currentWindowTitle, A and And window.LocationName == currentWindowTitle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions