Author Topic: Flashing Window  (Read 4599 times)

DarkNyvek

  • Guest
Flashing Window
« on: June 17, 2009, 05:19:06 PM »
I'm not sure what the progress is as far when it comes to flashing in the task bar when window isn't active, but thanks to codemunkeh, I've been looking into it.  The following link is from codemunkeh:

http://pietschsoft.com/post/2009/01/CSharp-Flash-Window-in-Taskbar-via-Win32-FlashWindowEx.aspx

Now, I've added this class, and attempted to implement it in the OnChannelMessage().  As it turns out, I'm getting a "base {System.SystemException} = {"Cross-thread operation not valid: Control 'FormMain' accessed from a thread other than the thread it was created on."}" error.  I'll admit, my Google skills are very sub par, but I can't seem to figure out how to solve this issue.  Never really worked with threading before, so it's all foreign ground to me.  If anyone has a suggestion or kick in the right direction, I'd appreciate that.  Thanks.

codemunkeh

  • Guest
Re: Flashing Window
« Reply #1 on: June 18, 2009, 04:58:02 AM »
I smell impending callbacks...
Threading is an area I've worked with.

To talk cross-thread (and to do any kind of cross-thread work with Forms) you have to issue callbacks rather than call it directly.

I can't remember how to do it exactly but I'm assuming the network code is running on a separate thread and so it can't issue anything to FormMain.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Flashing Window
« Reply #2 on: June 19, 2009, 04:34:49 PM »
The Threading is needed for anything that manipulates another object, you will see a lot of that kind of code throughout the client. You will see the "delegates" and then checking for if InvokeReQuired, and stuff like that.
I can whip up some code this weekend if I have some time and post it here, or just add it to the next Alpha, if needed.
The IceChat God

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Flashing Window
« Reply #3 on: July 13, 2009, 12:04:28 PM »
The Main problem with using FlashWindowEx is that it may not work in Mono, because it is a win32 call.

Will have to test it on a Mono system and see what happens.
The IceChat God