Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Global Search (+ get selected files in folder)
#1
my idea is to have a system wide logic to make searching easier.
after some tests i decided to start without qm toolbar and instead use windows taskbar from where to initiate.

so i created a new taskbar toolbar which displays content of a folder. its set to show not toolbar title and file name.

my first question is you could extend the 'create shortcut' dialog by adding custom shortcut targets.
it would be also cool to choose an own icon for the macro shortcut.

--
now that i use a shortcut icon for starting the macro i put an act on top in code to get the last active window.
that works nice when working with windows where text has been selected, but how do i get selected files when the last
active control was a systreeview32?
pi
#2
Quote:how do i get selected files when the last
active control was a systreeview32?

Ctrl+C
GetClipboardFiles
#3
that is working, but i want to prevent to use clipboard.
what i need is something like get active last control.
pi
#4
Get last active control's handle, or its selected items?
#5
Gintaras Wrote:Get last active control's handle, or its selected items?

both :roll: :lol:
pi
#6
For selected items, will post tomorrow.
For handle, can get only currently focused control in currently active window. Or get focused control every 1 s..., or try accessible object trigger.
#7
Gintaras Wrote:For handle, can get only currently focused control in currently active window

how?
pi
#8
Function GetFolderWindowItems
Code:
Copy      Help
;/
function! ARRAY(str)&a [hwnd] [flags] ;;flags: 1 selection

;Gets full paths of items in the folder that is opened in Windows Explorer (WE).
;Returns 1 on success, 0 if failed. If empty, or empty selection (flag 1), returns 1, but the array is empty.

;a - receives paths.
;hwnd - WE window handle. If 0 or omitted, finds WE window that is above all other WE windows in Z order.


a=0
SHDocVw.InternetExplorer ie=GetFolderWindowIE(hwnd); if(!ie) ret
IShellView isv
IShellBrowser isb
IServiceProvider isp=+ie
isp.QueryService(uuidof(IShellBrowser) uuidof(IShellBrowser) &isb)
isb.QueryActiveShellView(&isv)
IDataObject ido
isv.GetItemObject(iif(flags&1 SVGIO_SELECTION SVGIO_ALLVIEW) IID_IDataObject &ido); err ret 1
FORMATETC f.cfFormat=RegisterClipboardFormat(CFSTR_SHELLIDLIST)
f.dwAspect=DVASPECT_CONTENT; f.lindex=-1; f.tymed=TYMED_HGLOBAL
STGMEDIUM sm
if(ido.GetData(&f &sm)) ret
CIDA* c=GlobalLock(sm.hGlobal)

int i
a.create(c.cidl)
for i 0 c.cidl
,ITEMIDLIST* il=ILCombine(+(c+c.aoffset[0]) +(c+c.aoffset[i+1]))
,PidlToStr(il &a[i])
,CoTaskMemFree il

GlobalUnlock(sm.hGlobal); ReleaseStgMedium(&sm)

err+ ret
ret 1

Function GetFolderWindowIE
Code:
Copy      Help
;/
function'SHDocVw.InternetExplorer [hwnd]

;Gets SHDocVw.InternetExplorer of folder that is opened in Windows Explorer (WE).

;hwnd - WE window handle. If 0 or omitted, finds WE window that is above all other WE windows in Z order.


SHDocVw.ShellWindows sw._create
SHDocVw.InternetExplorer ie
type __GFWIE hwnd SHDocVw.InternetExplorer'ie
ARRAY(__GFWIE) a
int hwnd2
str ss
foreach ie sw
,ss=ie.LocationURL; err continue
,;out ss
,if(!ss.begi("file:///")) continue ;;web browser or non-file-system folder
,ss.get(ss 8)
,ss.findreplace("/" "\")
,ss.escape(8)
,;out ss
,hwnd2=ie.HWND; err continue
,if(!hwnd2) continue
,if(hwnd)
,,if(hwnd2=hwnd) ret ie
,else
,,__GFWIE& r=a[]
,,r.hwnd=hwnd2; r.ie=ie

if(hwnd) ret

hwnd=GetWindow(_hwndqm GW_HWNDFIRST)
rep
,if(!hwnd) break
,int i
,for(i 0 a.len) if(a[i].hwnd=hwnd) ie=a[i].ie; ret ie
,hwnd=GetWindow(hwnd GW_HWNDNEXT)
#9
Quote:how?

int hwnd=child
#10
Gintaras Wrote:
Quote:how?

int hwnd=child

doh! Confusedhock: :lol:

the first function work very nice for windows explorer.
i need this for Q-Dir and speed commander too.

is a general file-info function for systreeview32 possible?
pi
#11
Quote:is a general file-info function for systreeview32 possible?
No.
#12
Updated GetFolderWindowItems. Now works with folders containing non file system objects.
#13
I think that

Quote:if(a[i].hwnd=hwnd) ret ie

in GetFolderWindowIE

it should be replaced by
Quote: if(a[i].hwnd=hwnd) ie=a[i].ie ; ret ie
#14
Yes, thank you, fixed.


Forum Jump:


Users browsing this thread: 1 Guest(s)