Я создал этот сценарий для проверки концепции на языке ahk, который осуществляет переход к заданной папке с активной вкладки проводника, и хотя программно перейти к папке с заданной вкладки в C++ довольно легко, мне это не удалось еще не получить активную вкладку. Есть ли какая-либо документация по этому поводу в API Windows?
Кстати, вот мой код:
F1:: {
foundTabIndex := GetExplorerTab()
if (IsInteger(foundTabIndex)) {
shell := ComObject("Shell.Application")
win := shell.Windows().Item(foundTabIndex)
win.Navigate("C:\")
}
}
GetExplorerTab() {
activeTab := 0
try activeTab := ControlGetHwnd("ShellTabWindowClass1", "A")
static IID_IShellBrowser := "{000214E2-0000-0000-C000-000000000046}"
; Initialize an index counter
tabIndex := 0
; Variable to store the found tab index
foundTabIndex := false
; Flag to check if any File Explorer windows are open
foundWindow := false
; Iterate through all File Explorer windows
for w in ComObject("Shell.Application").Windows {
foundWindow := true ; Set flag to true since we found at least one window
shellBrowser := ComObjQuery(w, IID_IShellBrowser, IID_IShellBrowser)
ComCall(3, shellBrowser, "uint*", &thisTab := 0)
; Check if the current tab matches activeTab
if (activeTab && thisTab = activeTab) {
; Store the index of the matching tab
foundTabIndex := tabIndex
; Break out of the loop since we found the matching tab
break
}
; Increment the index for the next tab
tabIndex++
}
; Return the foundTabIndex if a matching tab was found, otherwise return false
return foundTabIndex
}```
Подробнее здесь: https://stackoverflow.com/questions/786 ... n-c-winapi
Можно ли получить активное окно/вкладку проводника файлов в C++ winapi? [закрыто] ⇐ C++
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение