FlashwindowEx API Call...

Just starting out? Need help? Post your questions and find answers here.
User avatar
HwyStar
Enthusiast
Enthusiast
Posts: 101
Joined: Mon Apr 05, 2010 7:13 pm
Location: Reno, Nevada

FlashwindowEx API Call...

Post 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!
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: FlashwindowEx API Call...

Post by cas »

Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: FlashwindowEx API Call...

Post 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
User avatar
HwyStar
Enthusiast
Enthusiast
Posts: 101
Joined: Mon Apr 05, 2010 7:13 pm
Location: Reno, Nevada

Re: FlashwindowEx API Call...

Post 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
Post Reply