Results 1 to 20 of 22

Thread: Window Blink/Flash

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    209
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: Window Blink/Flash

    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.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Window Blink/Flash

    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.

  3. #3
    Join Date
    Jan 2007
    Posts
    209
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: Window Blink/Flash

    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:
    1. case IDBUTTON:{
    2. Sleep(1000);
    3. MessageBox(hwnd, (LPCTSTR)"test!", (LPCTSTR)"test!", MB_OK|MB_ICONEXCLAMATION);
    4. FLASHWINFO finfo;
    5. finfo.cbSize = sizeof( FLASHWINFO );
    6. finfo.hwnd = hwnd;
    7. finfo.uCount = 20; // Flash 20 times
    8. finfo.dwTimeout = 400; // Duration in milliseconds between flashes
    9. finfo.dwFlags = FLASHW_ALL|FLASHW_TIMERNOFG; //Flash only taskbar button
    10. FlashWindowEx( &finfo );
    11. break;
    12. }
    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.

  4. #4
    Join Date
    Jan 2007
    Posts
    209
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: Window Blink/Flash

    I got it to work when using:
    #define _WIN32_WINNT 0x0501
    #define WINVER 0x0501

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Window Blink/Flash

    Nice... I wasn't sure where the error came from...

  6. #6
    Join Date
    Jan 2007
    Posts
    209
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: Window Blink/Flash

    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:
    1. #include <windows.h>
    2. int GetWinXP(){
    3. OSVERSIONINFO osVer;
    4. int xp = 0;
    5. osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    6. if(GetVersionEx(&osVer) != 0){
    7. if(osVer.dwPlatformId == VER_PLATFORM_WIN32_NT){
    8. xp = 1;
    9. }
    10. }
    11. return xp;
    12. }
    13. void CLobby::SendMsg(){ // A SLOT()
    14. QString qsMsg;
    15. // do some Qt Stuff
    16. MsgSend->clear();
    17. if(GetWinXP() == 1){
    18. #undef _WIN32_WINNT
    19. #undef WINVER
    20. #define _WIN32_WINNT 0x0501
    21. #define WINVER 0x0501
    22. #include <winuser.h>
    23. FLASHWINFO finfo;
    24. finfo.cbSize = sizeof( FLASHWINFO );
    25. finfo.hwnd = this->winId();
    26. finfo.uCount = 20; // Flash 20 times
    27. finfo.dwTimeout = 400; // Duration in milliseconds between flashes
    28. finfo.dwFlags = 1|2|12; //Flash only taskbar button
    29. FlashWindowEx( &finfo );
    30. }
    31. }
    32. }
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Window Blink/Flash

    Maybe because Windows.h includes winuser.h before you def and undef the windows versions.

    What version of windows do you have?

    Regards.

  8. #8
    Join Date
    Jan 2007
    Posts
    209
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: Window Blink/Flash

    WinXP of course the best windows.

  9. #9
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Window Blink/Flash

    Perhaps this is a bug in mingw?
    What if you move the defines to the top? Before including windows.h...

    Should work.

  10. #10
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 127 Times in 121 Posts

    Default Re: Window Blink/Flash

    Quote Originally Posted by VireX
    Qt 4.3 is not out yet
    Qt 4.3 is out but only as a beta...

    Alternatively you can always use a combination of QWidget::show() QWidget::raise() and QWidget::setFocus() which on most platform will cause a blinking when the window can not be actually shown, raised and focused...
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 11:07
  2. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41
  3. Replies: 3
    Last Post: 23rd July 2006, 18:02
  4. Move window in Clone Mode
    By ultrabrite in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2006, 18:22
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.