Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Bug reports ➜ FlashIcon not flashing

FlashIcon not flashing

Posting of new messages is disabled at present.

Refresh page


Posted by Cage_fire_2000   USA  (119 posts)  Bio
Date Tue 01 Dec 2009 02:39 AM (UTC)
Message
Ok, maybe it's just because I have a really outdated system, but FlashIcon() only seems to flash the taskbar once, really it just inverts it each time it's called, it doesn't continuously flash like with the new activity one, is it meant to be run on a timer to get it to actually flash? But then how would it avoid conflicts with other code using it? I was under the impression it set a flag or something to cause it to flash until you restore the window, but that's not how it seems to behave.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Tue 01 Dec 2009 04:13 AM (UTC)

Amended on Tue 01 Dec 2009 04:14 AM (UTC) by Twisol

Message
Some testing shows that, if MUSHclient has the current window focus, its taskbar icon will glow then revert. If not (i.e. if you set it as a DoAfter() then alt-tab to another window), it remains glowing (but doesn't 'flash' as the name implies).

I think maybe older versions of Windows flashed the icon on and off multiple times, but I'm not really sure. Also, running two FlashIcon()s in close succession (I tested with a nested DoAfter() set to run 2 seconds after the first FlashIcon()) simply de-activates and re-activates the icon, so (a) you could conceivably "flash" it on a timer, and (b) the only conflict would stem from multiple FlashIcon() timer loops offset slightly from eachother, which would probably make it pulse irregularly.

EDIT: Perhaps it would help if I mentioned I'm running Vista, heheh.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 01 Dec 2009 09:44 AM (UTC)
Message
Cage_fire_2000 said:

Ok, maybe it's just because I have a really outdated system, but FlashIcon() only seems to flash the taskbar once ...


Can you give more details? What operating system? Which version of MUSHclient?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Cage_fire_2000   USA  (119 posts)  Bio
Date Reply #3 on Tue 01 Dec 2009 02:16 PM (UTC)

Amended on Tue 01 Dec 2009 02:25 PM (UTC) by Cage_fire_2000

Message
Version 4.43 of mushclient, windows Me(I know, I may be one of the only ones left, I just haven't had the time to transfer all my stuff to an XP computer, I have a /lot/ of stuff. Anyway, I think that pretty much rules out it working correctly on older OSes, unless somebody is running a copy of Win 95/98 out there, you can't get much older. Edit: P.S. the flash on new activity option works perfectly, so it's only the function that doesn't behave as expected.

Anyway, like I said, each call only seems to invert the taskbar from whatever it was, I had code that called it twice in a row because it was set off by two lines that matched a trigger, and it looked like it didn't even flash because it was inverted back and forth so quick. This is what I was kinda saying about conflicts with the whole multiple code using flashicon, if you have code that activates two timers both running flashicon then it would either flash irregularly, or if they happened to start at the same time, or one started at an even tick of the other one, they'd cancel each other out and it wouldn't look like it was flashing at all. Also, I'm not sure how you'd know when the world window gets focus again to disable the timers again.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 02 Dec 2009 02:31 AM (UTC)
Message
FlashIcon calls CWnd::FlashWindow. According to the Microsoft documentation:


Flashes the given window once. For successive flashing, create a system timer and repeatedly call FlashWindow. Flashing the CWnd means changing the appearance of its title bar as if the CWnd were changing from inactive to active status, or vice versa. (An inactive title bar changes to an active title bar; an active title bar changes to an inactive title bar.)


It appears I am flashing the icon on a timer (for new activity), so you would need to do that too.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Cage_fire_2000   USA  (119 posts)  Bio
Date Reply #5 on Wed 02 Dec 2009 11:48 AM (UTC)
Message
Well the problem becomes, what if something else wants to use flashicon as well(), it'd flash /very/ irregularly. Say I create a plugin that flashes the toolbar when you get pages(which is what I was trying to do when I found this), and you get pages from two different worlds using this plugin, it'd make it blink very strangely, and even in some instances if the timing was right they'd completely cancel out each other. So the problem is that we'd need a global timer to set it off, and just have the FlashIcon call enable it until the window gets focus again. It's kinda like the infobar, there's only /one/ taskbar icon between all the worlds, but unlike the infobar, there's no room for sharing, because if it's called an even number of times in the same second, it'll be as if it's not even blinking. Also, I'm not entirely sure how to make it stop blinking when the mushclient window gets focus in script. Can't you just use the same code for the flash on new activity, only change the activation of that code from any new activity, to the function being called.

Also, the helpfile doesn't say anything about having to use a timer, it says "This function flashes the MUSHclient icon on the Windows taskbar in the same way that MUSHclient does if you have checked the option "New activity flashes taskbar".". That says to me it should operate the same, but it doesn't.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #6 on Wed 02 Dec 2009 05:50 PM (UTC)
Message
I prefer Cage fire's solution, to be honest. (I'd write more but I have to run XD)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #7 on Wed 02 Dec 2009 08:57 PM (UTC)
Message
Cage_fire_2000 said:

Also, the helpfile doesn't say anything about having to use a timer ...


The help file is wrong, compared to the actual behaviour. However I think under some versions of Windows (probably the one I tested with when I wrote the help) calling FlashIcon once caused it to flash on and off.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Cage_fire_2000   USA  (119 posts)  Bio
Date Reply #8 on Wed 02 Dec 2009 09:34 PM (UTC)

Amended on Wed 02 Dec 2009 09:39 PM (UTC) by Cage_fire_2000

Message
Looking up the api reference, the desired behavior we seem to want is FlashWindowEx() with the flags of 0xF to make it flash the caption and task bar continuously until the window comes to the foreground. Although, that function is only windows 98 and above it looks like.

Anyway, I have to ask, is there any way to setup a /global/ timer for all worlds to control the flash, and if so, how do you know when the window regains focus in order to disable the flashing?
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


21,955 views.

Posting of new messages is disabled at present.

Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.