does anyone have any idea on how to get your window to blink or flash on the startmenu just like when people message you on MSN or AIM??
does anyone have any idea on how to get your window to blink or flash on the startmenu just like when people message you on MSN or AIM??
Yes, but only on Windows:
Qt Code:
#include <Windows.h> ... FLASHWINFO finfo; finfo.cbSize = sizeof( FLASHWINFO ); finfo.hwnd = this->winId(); finfo.uCount = 20; // Flash 20 times finfo.dwTimeout = 400; // Duration in milliseconds between flashes finfo.dwFlags = FLASHW_TRAY; //Flash only taskbar button ::FlashWindowEx( &finfo );To copy to clipboard, switch view to plain text mode
Here, "this" is a QMainWindow derivate, so winId will work. It won't work on a regular widget so be careful to call FlashWindowEx from the main window only.
I believe this can also be done on Mac. The result will be the app icon bouncing in the dock. I don't know how yet...
On how many platforms do you plan to run your app?
Regards
VireX (14th April 2007)
Thanks, I'll see if this works, I been looking for that struct in MSDN docs. Hard to find :S...
Although MAc and Linux may be an idea for way later its the last thing on my mind.
On Mac:
Qt Code:
#include <Notification.h> ... NMRecPtr notifRequestData = new NMRecPtr; notifRequestData->nmMark = 1; //Make the app icon bounce notifRequestData->nmIcon = NULL; notifRequestData->nmSound = NULL; notifRequestData->nmStr = NULL; notifRequestData->nmResp = NULL; NMInstall( notifRequestData );To copy to clipboard, switch view to plain text mode
Make sure to use NMRemove when you're done using the NMRecPtr and delete it.
Note that you have to do this separately for Mac and Win because Qt does not have support for user notification.
Regards.
No It doesn't work, because including windows.h not only causes many compiler errors in my project, but for some reason, windows.h does not recognize FLASHWINFO... It's quite weird. It's in MSDN so I don't see why it isn't working.
Could you show me your #include section?
I tested it here and it works.
This is quite awkward. Is FLASHWINFO new or something?
Because my compiler does NOT recognize FLASHWINFO (even on a plain Win32 API project), meaning that it probably is not defined in my windows.h
Could it be because I use Dev-Cpp with mingw?
FlashWindowEx and FLASHWINFO are in Winuser.h, which is included by Windows.h.
Compiler errors caused by header inclusion order can be solved quite easy...
Well thats pretty obvious. #include <windows.h>, thats my only include, and it WOULD work if it was truly defined in winuser.h, and since it is a simple plain Win32 project, there is no mistake or mixup with Qt. It's definitely a problem with my windows.h or Dev-C++ in general. Either that or FLASHWINFO doesn't exist.
Qt 4.3 is not out yet. The only download is qt-win-opensrc... it's not the mingw version so I cannot get it to work.
Last edited by VireX; 14th April 2007 at 08:45.
Have you included the windows api src in your mingw install?
I just downloaded it from http://prdownloads.sf.net/mingw/w32a...ar.gz?download
I can find in there both windows.h and winuser.h and FlashWindowEx is defined in winuser.h.
Maybe your mingw install is not OK.
Edit:
Dev-c++ should have an include path option. Make sure the path for the windows api is added there.
Regards.
Last edited by marcel; 14th April 2007 at 09:03.
My winuser.h has FLASHWINFO defined, and it is included.
If it wasn't included I would have more errors than just FLASHWINFO.
Compiler errors:
g++.exe -c flashtest.cpp -o flashtest.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Dev-Cpp/include"
flashtest.cpp: In function `LRESULT WindowProcedure(HWND__*, UINT, WPARAM, LPARAM)':
flashtest.cpp:90: error: `FLASHWINFO' undeclared (first use this function)
flashtest.cpp:90: error: (Each undeclared identifier is reported only once for each function it appears in.)
flashtest.cpp:90: error: expected `;' before "finfo"
flashtest.cpp:91: error: `finfo' undeclared (first use this function)
flashtest.cpp:92: error: invalid use of `this' in non-member function
flashtest.cpp:95: error: `FLASHW_ALL' undeclared (first use this function)
flashtest.cpp:95: error: `FLASHW_TIMERNOFG' undeclared (first use this function)
flashtest.cpp:96: error: `FlashWindowEx' undeclared (first use this function)
make.exe: *** [flashtest.o] Error 1
Qt Code:
case IDBUTTON:{ Sleep(1000); MessageBox(hwnd, (LPCTSTR)"test!", (LPCTSTR)"test!", MB_OK|MB_ICONEXCLAMATION); FLASHWINFO finfo; finfo.cbSize = sizeof( FLASHWINFO ); finfo.hwnd = hwnd; finfo.uCount = 20; // Flash 20 times finfo.dwTimeout = 400; // Duration in milliseconds between flashes finfo.dwFlags = FLASHW_ALL|FLASHW_TIMERNOFG; //Flash only taskbar button FlashWindowEx( &finfo ); break; }To copy to clipboard, switch view to plain text mode
Oh btw you guys should rly consider removing the line number from geshi filter, annoying...
But this error, look how ridiculous this is:
#include <winuser.h>
MOUSEMOVEPOINT mmp;
Last edited by VireX; 14th April 2007 at 17:26.
I got it to work when using:
#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
Nice... I wasn't sure where the error came from...
Tried to develop some sort of efficient way to do this:
Because FLASHWINFO only works if WINNT is greater than 0x0500! Meaning its an XP/2k-Only feature... Therefore, I had to get the version info. Which works fine, but FLASHWINFO still says "undeclared first use this function". Quite odd... any other ideas?
Qt Code:
#include <windows.h> int GetWinXP(){ OSVERSIONINFO osVer; int xp = 0; osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if(GetVersionEx(&osVer) != 0){ if(osVer.dwPlatformId == VER_PLATFORM_WIN32_NT){ xp = 1; } } return xp; } void CLobby::SendMsg(){ // A SLOT() QString qsMsg; // do some Qt Stuff MsgSend->clear(); if(GetWinXP() == 1){ #undef _WIN32_WINNT #undef WINVER #define _WIN32_WINNT 0x0501 #define WINVER 0x0501 #include <winuser.h> FLASHWINFO finfo; finfo.cbSize = sizeof( FLASHWINFO ); finfo.hwnd = this->winId(); finfo.uCount = 20; // Flash 20 times finfo.dwTimeout = 400; // Duration in milliseconds between flashes finfo.dwFlags = 1|2|12; //Flash only taskbar button FlashWindowEx( &finfo ); } } }To copy to clipboard, switch view to plain text mode
Maybe because Windows.h includes winuser.h before you def and undef the windows versions.
What version of windows do you have?
Regards.
WinXP of course the best windows.
Bookmarks