Posts: 1,271
Threads: 399
Joined: Mar 2003
i trigger a windowlist menu with a mouse stroke
str titles exe
GetWindowList &titles "" 1|2|4
ARRAY(str) arr = titles
for(int'i 0 arr.len)
,int hwnd=arr[i]
,exe.getwinexe(arr[i] 1)
int p=PopupMenu(titles 0 0)
is there a way to use icons in PopupMenu ?
i tried using DynamicMenu, but have problems when the window text is a path or contains colon/s like here in the forum.
thanks.
Posts: 12,140
Threads: 142
Joined: Dec 2002
No, but you can escape : and ", and use DynamicMenu.
str titles exe
ARRAY(int) handles
GetWindowList &titles "" 1|2|4 0 0 handles
ARRAY(str) arr = titles
for(int'i 0 arr.len)
,int hwnd=handles[i]
,exe.getwinexe(hwnd 1)
,
,arr[i].escape(1) ;;escape "
,arr[i].findreplace(":" "[91]58]") ;;escape :
,arr[i].formata(" : * %s" exe)
,
titles=arr
int p=DynamicMenu(titles "" 1)
if(p) act handles[p-1]
;This is not perfect. Should get icon with GetWindowIcon instead, but icon handles are not supported in menus (until QM 2.1.8).
Posts: 1,271
Threads: 399
Joined: Mar 2003
how about saving GetWindowIcon to a .ico file ?
that would be nice, because windows explorer launched in bblean shell
has bblean as exename, so my menu shows the wrong icon.
Posts: 12,140
Threads: 142
Joined: Dec 2002
Good idea, but I don't know a function to save icon files.
Posts: 1,271
Threads: 399
Joined: Mar 2003
is it not possible to use the drag icon preview function from the icon editor ?
Posts: 1,271
Threads: 399
Joined: Mar 2003
i have a workaround.
ClearOutput
str titles exe
ARRAY(int) handles
GetWindowList &titles "" 1|2|4 0 0 handles
ARRAY(str) arr = titles
for(int'i 0 arr.len)
,int hwnd=handles[i]
,exe.getwinexe(hwnd 1)
,if _s.getfilename(exe 0)=="blackbox"
,,exe = "explorer.exe *0"
,if arr[i]=="QM Help"
,,exe = "c:\windows\hh.exe *1"
,arr[i].findreplace(":" " ") ;;escape :
,arr[i].escape(1) ;;escape "
,arr[i].formata(" : * %s" exe)
,
titles=arr
int p=DynamicMenu(titles "" 1)
if(p) act handles[p-1]
it also shows the help icon for qm help.
btw. i think its not necessary to close qm help on qm close.
what is the reason for doing so ?