Page 1 of 1

FlashwindowEx API Call...

Posted: Thu Dec 23, 2010 5:36 pm
by HwyStar
I am needing to have a window "flash" in the task bar. Similar to chat programs that notify you that you have an active chat, but the window is minimized to the taskbar and the window requires a response but does not restore itself. It just blinks.

I read that the Flashwindow API makes the program in the taskbar flash, but I still don't always understand how to make the PB-API calls that are not part of the standard API calls.

Does anyone have some simple code that they can supply me with to get it started?

Here is the code from MSDN:
BOOL WINAPI FlashWindowEx(
__in PFLASHWINFO pfwi
);

Thanks Gang!

Re: FlashwindowEx API Call...

Posted: Thu Dec 23, 2010 7:39 pm
by cas

Re: FlashwindowEx API Call...

Posted: Thu Dec 23, 2010 9:52 pm
by Trond
I'm on Linux right now, but wouldn't this work?

Code: Select all


Procedure FlashWindow(Window)
  Protected f.FLASHWINFO
  f\cbSize = SizeOf(FLASHWINFO)
  f\hwnd  = WindowID(WIndow)
  f\dwFlags = #FLASHW_TRAY
  f\uCount = 3
  FlashWindowEx_(@f)
EndProcedure

Re: FlashwindowEx API Call...

Posted: Fri Dec 24, 2010 3:15 am
by HwyStar
Thanks cas, Trond and Hroudtwolf!

Here is all the code wrapped together for people that aren't good programmers like you guys.

This code is a little bit from all three of you and it compiles and does what I wanted. Thanks Dudes!

Code: Select all

Procedure FlashWindow(Window)
  Structure FLASHWINFO
    cbSize.l
    hwnd.l
    dwFlags.l
    uCount.l
    dwTimeout.l
  EndStructure
  Protected f.FLASHWINFO
  
  f\cbSize = SizeOf(FLASHWINFO)
  f\hwnd  = WindowID(WIndow)
  f\dwFlags = $6
  f\uCount = 1
  FlashWindowEx_(@f)
EndProcedure

If OpenWindow(0, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
  AddWindowTimer(0, 123, 1000)

  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_Event_Timer And EventTimer() = 123
      FlashWindow(0)
    EndIf      
    If Event = #PB_Event_CloseWindow
      Quit = 1
    EndIf
  Until Quit = 1
EndIf