Posts: 35
Threads: 7
Joined: Sep 2009
how to use FindTrayIcon in exe?
Cannot make exe. Error 1, failed.
......
if delete function FindTrayIcon,will have a exe file.anyone knows the reason about FindTrayIcon? please share with me,thanks a lot!
Posts: 12,141
Threads: 143
Joined: Dec 2002
Maybe you have old function version. New version is:
Function
FindTrayIcon
;/
function# hwnd $tooltip
;Returns tray toolbar control button id, or -1 if not found.
;hwnd - tray toolbar control handle.
;tooltip - tooltip. Can contain wildcard characters (* and ?).
int i n=SendMessage(hwnd TB_BUTTONCOUNT 0 0)
if(!n) ret -1
__ProcessMemory m.Alloc(hwnd 1000)
TBBUTTON b
for i 0 n
,if(!SendMessage(hwnd TB_GETBUTTON i m.address)) continue
,m.Read(&b sizeof(b))
,int t=SendMessage(hwnd TB_GETBUTTONTEXTW b.idCommand m.address+100)
,if(t<=0) continue
,str s
,m.ReadStr(s t*2 100 1)
,if(matchw(s tooltip 1)) ret b.idCommand
ret -1
Posts: 35
Threads: 7
Joined: Sep 2009
update to new version,but same error : "Cannot make exe. Error 1, failed."
......
--------------------------------------------------------------------------------------------------
/;;TI_HideTrayIcon
function# $tooltip hide
Hides or shows tray icon whose tooltip matches tooltip (can contain *?).
Returns 1 if successful.
tooltip - tooltip. Can contain wildcard characters (* and ?).
hide - 1 to hide, 0 to show.
EXAMPLE
HideTrayIcon "Quick*" 1
5
HideTrayIcon "Quick*" 0
int hwnd=child("" "ToolbarWindow32" "+Shell_TrayWnd" 0x1)
if(!hwnd) ret
int i=TI_FindTrayIcon(hwnd tooltip); if(i<0) ret
if(!SendMessage(hwnd TB_HIDEBUTTON i hide)) ret
Tray t.AddIcon; t.Delete ;;autosize
ret 1
--------------------------------------------------------------------------------------------------
;/;;TI_FindTrayIcon
function# hwnd $tooltip
;Returns tray toolbar control button id, or -1 if not found.
;hwnd - tray toolbar control handle.
;tooltip - tooltip. Can contain wildcard characters (* and ?).
int i n=SendMessage(hwnd TB_BUTTONCOUNT 0 0)
if(!n) ret -1
__ProcessMemory m.Alloc(hwnd 1000)
TBBUTTON b
for i 0 n
,if(!SendMessage(hwnd TB_GETBUTTON i m.address)) continue
,m.Read(&b sizeof(b))
,int t=SendMessage(hwnd TB_GETBUTTONTEXTW b.idCommand m.address+100)
,if(t<=0) continue
,str s
,m.ReadStr(s t*2 100 1)
,if(matchw(s tooltip 1)) ret b.idCommand
ret -1
--------------------------------------------------------------------------------------------------
;;Macro111
int+ hideunplug=1
TI_HideTrayIcon "*Connected*" hideunplug
BEGIN PROJECT
main_function Macro111
exe_file $my qm$\Macro111.exe
icon <default>
manifest $qm$\default.exe.manifest
res
on_before
on_after
on_run
flags 6
end_hotkey 0
guid {2F2F25E7-A705-4500-BC1D-4A8DF6E6EA19}
END PROJECT
--------------------------------------------------------------------------------------------------
I have reinsatlled the os and resinstalled qm
and just import this qml,is there any suggeations about this? thanks!
Posts: 12,141
Threads: 143
Joined: Dec 2002
On my PC works well. It may be a bug in QM. Do you have similar problems when creating exe from other macros, where TI_FindTrayIcon not used?
Posts: 35
Threads: 7
Joined: Sep 2009
no,if delete FindTrayIcon,everything will be ok......
Posts: 35
Threads: 7
Joined: Sep 2009
next step is write a memory function by myself or something else?
anyone knows?thanks...
Posts: 35
Threads: 7
Joined: Sep 2009
oh,maybe I can help to find something,do you need some test about this "bug",i was a tester before,just tell me what you want,and you will get it quickly,professional one, :lol:
Posts: 12,141
Threads: 143
Joined: Dec 2002
Found it.
Workaround:
Find function __ProcessMemory.Alloc. It is in System folder.
Disable both lines where used word GetProcessHandleFromHwnd.
If read-only, right-click System folder, select Folder Properties, uncheck read-only.
Then export/overwrite System folder.
Thank you.
Posts: 35
Threads: 7
Joined: Sep 2009
wow,really works, :lol:
Many Thanks,this joke prog would be very fun to my friends, :lol: :lol: :lol:
:wink: