04-22-2020, 01:25 PM
I am happy that it proves useful to you. I am sorry I missed to replace Task_Message by an "out" statement. Anyway, I attach herewith Task_Message. Regards.
Function Task_Message
Function Task_Message
function# str'text [int'length] [int'color] [int'font_handle]
;---> Comment 30-08-2016 08:22:02 : New version CFont
;Task_Message "Hello there - Simple" 0 171 0
;Task_Message "Hello there - Bold" 0 171 1
;Task_Message "Hello there - Simple" 0 171 0
;Task_Message "Hello there - Font+1 Bold" 0 171 2
;www.quickmacros.com/forum/viewtopic.php?f=1&t=2495
;Run Layered Products - My Color Dialog to select in clipboard any color
;Attention : Colors in QM are defined as BGR
;0x000000 - black
;0xFFFFFF - white
;0x0000FF - red
;0x00FF00 - green
;0xFF0000 - blue
;0x00FFFF - yellow (red+green)
;0xC0C0C0 - gray
;0x808080 - dark gray
;0x008000 - dark green
;length - message duration on taskbar
;>0 duration in s, then close
;=0 infinite, close when mouse click (monitor click through "Task_Message_Monitor") or by triggering "Task_Message_Shutdown"
;<0 infinite, close only by triggering "Task_Message_Shutdown"
;Test Program
;beeS 700 100
;Task_Message "matzuni" 0 150 1
;3
;Task_Message "tamtiriri" 0 0 0
;3
;Task_Message "tzuni matzuni" 0 255 1
;3
;Task_Message "Time-out" -1 0xFF0000 0
;3
;Task_Message "tzuni" 0
;3
;Task_Message "matzuni" 0 150 1
;3
;Task_Message "matzuni" 0 0 1
str si.getmacro(getopt(itemid) 1)
str caller.getmacro(getopt(itemid 1) 1);err caller=si
if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : %s" NowT si _error.place si caller
TMtext=text
int hw
int ic=0
CHARRANGE cr
CHARFORMAT2 cf.cbSize=sizeof(CHARFORMAT2)
;********************
int hwTB=win("TB STATUSBAR" "QM_toolbar")
ifi hwTB
,;mac "TaMesShut" "" text length color font_handle
,;ret
,clo hwTB
,wait 5 -WC hwTB ;; 120105 Παιδεύτηκα από 10:00 ως 17:00 για να βρω ότι χρειαζότανε αυτό,
,;;;;;;;;;;;;;;;;;;;εάν γίνεται δεύτερη κλήση της ρουτίνας στο ίδιο πρόγραμμα, και η πρώτη είχε sleep <=0 !
,err
,,_s=_error.description
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,,mac "Warning_QM" si
,,end
str sm="Task_Message_Monitor"
if(IsThreadRunning(sm)); shutdown -6 0 sm
;********************
TaskM=iif(font_handle=0 0 font_handle+1)
int coloR=iif(color=0 0xFF0000 color)
,
;if color > 0 ; TaskM=iif(TaskM=0 1 TaskM)
TaskM=iif(TaskM=0 1 TaskM)
;out "%i %i" TaskM coloR
str smes
sw_task=0
;---> Comment 29-11-2015 02:40:38 :
;Some functions and other QM features are unavailable in exe.
;mac can start only functions in exe
hwTB=mac("TB StatusBar")
hwTB=wait(15 WC win("TB STATUSBAR" "QM_toolbar"))
err
,_s.from(_error.description " - Called by " caller)
,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,mac "Warning_QM" si
,end
,
hw=id(1 win("TB STATUSBAR" "QM_Toolbar")); err ret
if TaskMFo
;,outt F"{TaskMFo} - {font_handle}"
,if font_handle=0
,,fTask.SetFont(hw)
,else if font_handle=1
,,fTaskB.SetFont(hw)
,else
,,fTaskC.SetFont(hw)
,,
if TaskM
;idx[0]=0x0000FF
;idx[1]=0x000000;;- black
;idx[2]=0xFFFFFF;; - white
;idx[3]=0x0000FF;; - red
;idx[4]=0x00FF00;; - green
;idx[6]=0xFF0000;; - blue
;idx[7]=0x00FFFF;; - yellow (red+green)
;idx[8]=0xC0C0C0;; - gray
;idx[9]=0x808080;; - dark gray
;idx[10]=0x008000;; - dark green
;,It does not work properly with 2.3.0 - Unicode :
;,SetWindowText hw text
;,Following two work :
;,text.setwintext(hw)
,SetWindowTextW hw @text
,cf.dwMask=CFM_COLOR
,cf.crTextColor=coloR
,SendMessage(hw EM_SETCHARFORMAT SCF_ALL &cf)
else
,text.setwintext(hw)
,err
,,_s.from(_error.description " - Called by " caller)
,,_s.format("%s - %s" si _s)
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,,mac "Warning_QM" si
,,end
if length < 0
,sw_task=1
,ret
,
if length = 0
;,wait(0 M)
,mac "Task_Message_Monitor"
,ret
,
wait length
ifi hwTB
,clo hwTB
,;_s="Closed End"
,;min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,