views:

222

answers:

4

I love that Qt is cross-platform but I want to make an application that will call into some Windows specific .dll's. Kinda like Google Chrome does with the glass on Windows Vista/7 (I know Chrome isn't written using the Qt framework just thought it was a good example).

How can I do this in Qt? Is it feasible?

+8  A: 

Yes, this is no problem. You just go ahead and do it! Qt itself is just a DLL you call into, it just happens to be the same across different platforms. Just link against the DLLs you like and call them.

There is nothing wrong with using Qt to make a Windows-only application if you like.

Adam Goode
+3  A: 

As long as you have the relevant Windows SDK headers to hand, and can link with the appropriate libs, then it is easy to mix and match Qt and Win32 code. I use Qt Creator for C++ development which ships with MinGW and includes all the most common Win32 SDK headers and libs. You can even wrap the Windows specific parts of your code with suitable #ifdefs in case you ever come to build for a different platform, e.g.:

#ifdef Q_OS_WIN

#include <windows.h>

void someWindowsSpecificFunc()
{
  ...
}

#endif // Q_OS_WIN
Rob
+1  A: 

Fearlessly go ahead an write your Win-specific app. You can utilize all the Windows DLLs you want. In this sense, Qt has no limitations. You will still be gaining the advantages of those nifty Qt layout components and customizable skinning. In terms of skinning there is no better framework that Qt. Your users will love all the resizable dialogs you provide them with.

Vance Tower
+1  A: 

You can of course call WinAPI functions directly from your Qt code, then it's better to include qt_windows.h not windows.h.

If you just want to add the cool new Windows 7 features to your application then you are better of using a dedicated Qt add-on. There is one called Q7Goodies.

torn