{"id":22363,"date":"2008-05-12T10:00:00","date_gmt":"2008-05-12T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/05\/12\/how-do-i-flash-my-window-caption-and-taskbar-button-manually\/"},"modified":"2008-05-12T10:00:00","modified_gmt":"2008-05-12T10:00:00","slug":"how-do-i-flash-my-window-caption-and-taskbar-button-manually","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20080512-00\/?p=22363","title":{"rendered":"How do I flash my window caption and taskbar button manually?"},"content":{"rendered":"<p>\nCommenter Jonathan Scheepers\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#513263\">\nwonders about those programs that flash their taskbar button\nindefinitely<\/a>,\noverriding the default flash count set by\n<code>SysteParametersInfo(SPI_SETFOREGROUNDFLASHCOUNT)<\/code>.\n<\/p>\n<p>\nThe <code>FlashWindowEx<\/code> function\nand its simpler precursor <code>FlashWindow<\/code>\nlet a program flash its window caption and taskbar button manually.\nThe window manager flashes the caption automatically\n(and Explorer follows the caption by flashing the taskbar button)\nif a program calls <code>SetForegroundWindow<\/code>\nwhen it doesn&#8217;t have permission to take foreground,\nand it is that automatic flashing that the\n<code>SPI_SETFOREGROUNDFLASHCOUNT<\/code> setting controls.\n<\/p>\n<p>\nFor illustration purposes, I&#8217;ll demonstrate flashing the caption\nmanually.\nThis is generally speaking not recommended, but since you asked,\nI&#8217;ll show you how.\nAnd then promise you won&#8217;t do it.\n<\/p>\n<p>\nStart with the scratch program and make this simple change:\n<\/p>\n<pre>\nvoid\nOnSize(HWND hwnd, UINT state, int cx, int cy)\n{\n  if (state == SIZE_MINIMIZED) {\n    FLASHWINFO fwi = { sizeof(fwi), hwnd,\n                       FLASHW_TIMERNOFG | FLASHW_ALL };\n    FlashWindowEx(&amp;fwi);\n  }\n}\n<\/pre>\n<p>\nCompile and run this program, then minimize it.\nWhen you do, its taskbar button flashes indefinitely\nuntil you click on it.\nThe program responds to being minimzed by calling the\n<code>FlashWindowEx<\/code> function asking for everything possible\n(currently the caption and taskbar button)\nto be flashed until the window comes to the foreground.\n<\/p>\n<p>\nOther members of the <code>FLASHWINFO<\/code> structure let\nyou customize the flashing behavior further,\nsuch as controlling the flash frequency and the number of flashes.\nand if you really want to take control,\nyou can use <code>FLASHW_ALL<\/code>\nand <code>FLASHW_STOP<\/code> to turn your caption and taskbar\nbutton on and off exactly the way you want it.\n(Who knows, maybe you want to send a message in Morse code.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commenter Jonathan Scheepers wonders about those programs that flash their taskbar button indefinitely, overriding the default flash count set by SysteParametersInfo(SPI_SETFOREGROUNDFLASHCOUNT). The FlashWindowEx function and its simpler precursor FlashWindow let a program flash its window caption and taskbar button manually. The window manager flashes the caption automatically (and Explorer follows the caption by flashing the [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-22363","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Commenter Jonathan Scheepers wonders about those programs that flash their taskbar button indefinitely, overriding the default flash count set by SysteParametersInfo(SPI_SETFOREGROUNDFLASHCOUNT). The FlashWindowEx function and its simpler precursor FlashWindow let a program flash its window caption and taskbar button manually. The window manager flashes the caption automatically (and Explorer follows the caption by flashing the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/22363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=22363"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/22363\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=22363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=22363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=22363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}