Results 1 to 9 of 9

Thread: Qt and windows 7 new Api

  1. #1
    Join Date
    May 2009
    Posts
    11
    Thanks
    3

    Default Qt and windows 7 new Api

    I would like to integrate the new Windows 7 api into my App.
    (The new task bar)

    Will I have any problem working with a visual studio 10 Dll and QT Creator?
    (Is there any other way to do it?)

    yhanks

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt and windows 7 new Api

    QT Creator uses GCC, so it's not going to be easy to work with a Visual Studio DLL. You'll be better of using Visual Studio and the appropriate Qt plug-in. That way you'll get access to the latest API, library files, and include files, which will not be present with Qt Creator.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and windows 7 new Api

    Let's make one thing clear. Your application is not linked against Qt Creator so the latter doesn't pose any dependencies on the application. You can also use MSVC with Creator insted of GCC, that's no problem. The fact that Qt SDK includes both Qt Creator and MinGW is meaningless, they are two separate components.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt and windows 7 new Api

    I'm using QtCreator with VisualStudio 2005 Toolchain on Windows 7 x64 without any problems (apps are compiled for 32 bit). I don't where is the option for changing toolchain in QtCreator - I just installed it without MinGW and it set itself to use my previously installed Visual Studio Compiler and that's it :]

    I don't know what do you understand under "integration" with Windows7. My apps are shown on the taskbar, but if you want access some of it's special feature's (like in IE - you can choose any tab separately on the taskbar) I think you need to use some native Windows API.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  5. #5
    Join Date
    May 2009
    Posts
    11
    Thanks
    3

    Default Re: Qt and windows 7 new Api

    Thanks everybody, apparently I haven't explained my self.

    fatjuicymole you understood my question, thanks for your answer.

    wysota thanks, I'm aware of the difference between the components but I didn't know that I can instruct QTCreator to use MSVC as compiler.

    When I've downloaded the framework I needed to choose the compiler I'm intending to use, I downloaded the QTCreator bundled with the mingw.
    So now if I want to work with msvc I need to redownload the framework (now for msvc) and redirect the QTCreator to a new compiler
    (and even maybe to a new framework directory ... I dont want to overwrite the QT libs for mingw libs)
    Or as fatjuicymole said I'll just use visual studio and link it to the qt libs...

    faldżip like you said, I was talking about using the task bar new features, especially the progress notification... I've seen tutorials about how to work them with visual studio 10... (apparently the sdk is already included)

    I think that in the end because this is not such an important issue of what I'm working on I'll just throw the progress into a file\socket and read it via a .Net agent... the point is having fun with QT and not producing something commercial.

    Will QT ever support this kind of features? so platform dependent?
    thanks everybody!
    Last edited by ManicQin; 5th January 2010 at 14:31.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and windows 7 new Api

    Quote Originally Posted by ManicQin View Post
    wysota thanks, I'm aware of the difference between the components but I didn't know that I can instruct QTCreator to use MSVC as compiler.
    You just tell it to use nmake instead of make (which is probably auto-detected anyway).

    Or as fatjuicymole said I'll just use visual studio and link it to the qt libs...
    You will still need to download Qt for MSVC.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Nov 2007
    Posts
    89
    Thanked 21 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt and windows 7 new Api

    Quote Originally Posted by ManicQin View Post
    faldżip like you said, I was talking about using the task bar new features, especially the progress notification... I've seen tutorials about how to work them with visual studio 10... (apparently the sdk is already included)
    You have to request the system for a proper task bar using the function RegisterWindowMessage, then you wait for a response in the member function QWidget::winEvent. Then, you can create the task bar and use it.
    Maybe you could understand better this small example I wrote.
    Have also a look at the functions ITaskbarList3::SetProgressState and ITaskbarList3::SetProgressValue.
    Unfortunately I do not know much about using other features of new task bars.

    Qt Code:
    1. TEMPLATE = app
    2.  
    3. LIBS += User32.lib
    4. LIBS += Ole32.lib
    5.  
    6. HEADERS += ProgressDialog.h
    7. SOURCES += ProgressDialog.cpp
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include <QDialog>
    2. #include <QTimer>
    3.  
    4. #include <windows.h>
    5. #include <shobjidl.h>
    6.  
    7. class ProgressDialog : public QDialog
    8. {
    9. Q_OBJECT
    10. public:
    11. ProgressDialog(QWidget *parent = 0);
    12.  
    13. protected:
    14. bool winEvent(MSG * message, long * result);
    15.  
    16. private:
    17. void setupProgressBar();
    18.  
    19. private slots:
    20. void updateProgress();
    21.  
    22. private:
    23. QTimer timer;
    24. int progress;
    25. int totalProgress;
    26. bool canUseTaskBar;
    27. UINT taskBarCreatedMessage;
    28. ITaskbarList3 * taskbar;
    29. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include "ProgressDialog.h"
    2.  
    3. #include <shobjidl.h>
    4. #include <Objbase.h>
    5.  
    6. #include <QApplication>
    7.  
    8. int main(int argc, char *argv[])
    9. {
    10. QApplication a(argc, argv);
    11. ProgressDialog d;
    12. d.show();
    13. return a.exec();
    14. }
    15.  
    16. ProgressDialog::ProgressDialog(QWidget *parent) :
    17. QDialog(parent)
    18. {
    19. this->progress = 0;
    20. this->totalProgress = 1000;
    21. this->canUseTaskBar = false;
    22.  
    23. this->timer.setInterval(10);
    24. this->connect( & this->timer, SIGNAL(timeout()), this, SLOT(updateProgress()));
    25.  
    26. // Request task bar.
    27. this->taskBarCreatedMessage = RegisterWindowMessage(L"TaskbarButtonCreated");
    28. }
    29.  
    30. bool ProgressDialog::winEvent(MSG * message, long * result)
    31. {
    32. if (message->message == this->taskBarCreatedMessage)
    33. {
    34. HRESULT hr = CoCreateInstance(CLSID_TaskbarList,
    35. 0,
    36. CLSCTX_INPROC_SERVER,
    37. IID_PPV_ARGS( & this->taskbar));
    38. if (hr == S_OK) {
    39. this->canUseTaskBar = true;
    40.  
    41. // Start progress.
    42. this->setupProgressBar();
    43. this->timer.start();
    44. } else {
    45. this->canUseTaskBar = false;
    46. // Error.
    47. }
    48. *result = hr;
    49. return true;
    50. }
    51.  
    52. return false;
    53. }
    54.  
    55. void ProgressDialog::setupProgressBar()
    56. {
    57. if (this->canUseTaskBar) {
    58. // Select the progress bar type.
    59. // One of these:
    60.  
    61. // No progress bar.
    62. // this->taskbar->SetProgressState(this->winId(), TBPF_NOPROGRESS);
    63.  
    64. // Unknown progress.
    65. // this->taskbar->SetProgressState(this->winId(), TBPF_INDETERMINATE);
    66.  
    67. // Normal progress (green bar).
    68. this->taskbar->SetProgressState(this->winId(), TBPF_NORMAL);
    69.  
    70. // Paused (yellow bar).
    71. // this->taskbar->SetProgressState(this->winId(), TBPF_PAUSED);
    72.  
    73. // Error (red bar).
    74. // this->taskbar->SetProgressState(this->winId(), TBPF_ERROR);
    75. }
    76. }
    77.  
    78. void ProgressDialog::updateProgress()
    79. {
    80. if (this->canUseTaskBar) {
    81. // Set progress.
    82. this->taskbar->SetProgressValue(this->winId(), this->progress, this->totalProgress);
    83.  
    84. progress++;
    85. }
    86. }
    To copy to clipboard, switch view to plain text mode 

  8. The following 3 users say thank you to bender86 for this useful post:

    EgorSharin (8th February 2011), ManicQin (12th January 2010), raven-worx (1st February 2011)

  9. #8
    Join Date
    May 2009
    Posts
    11
    Thanks
    3

    Default Re: Qt and windows 7 new Api

    Great Post!
    Thank you very much.

  10. #9
    Join Date
    Jan 2011
    Posts
    18
    Thanks
    6
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt and windows 7 new Api

    i needed the same features and found some interesting links which may be helpful

    http://www.strixcode.com/q7goodies/
    ($49-35$)

    http://www.msec.it/blog/?p=118
    free, GPL, compiles even with mingw32

Similar Threads

  1. Replies: 2
    Last Post: 25th November 2009, 23:44
  2. Deployment Procedure On Windows On Linux and Windows
    By Harshith J.V. in forum Installation and Deployment
    Replies: 4
    Last Post: 9th July 2009, 11:27
  3. Windows focus / Windows Shutdown Problems
    By December in forum Qt Programming
    Replies: 6
    Last Post: 22nd October 2007, 14:10
  4. Replies: 3
    Last Post: 14th April 2007, 12:04
  5. Replies: 10
    Last Post: 25th February 2007, 00:23

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.