Using the Win32 API in a Qt OSE Project

This is a dirty question, I hope you can figure out what I want :)

What is the best way to use Win32 functionality in a Qt Open Source Edition project?

Currently I have included the required Windows SDK libraries and manually included the directories in the qmake project file. It works great on a small scale, but its awkward and cumbersome.

So, should the Win32 stuff be separated from the library, or is there a sane way to combine the two? Or am I just missing out on some aspects of Qt that simplify this?

EDIT

Removed the syntax stuff, it's not very relevant, just annoying.

+1


source to share


3 answers


You can create an interface layer to wrap Win32 functionality and expose it in a DLL or static library. DLL would minimize the need to link directly to Win32 libraries with your qmake project. This would be more in line with Qt's portability to create generic interfaces like this and then hide platform specific data in a private implementation. Trolltech used to use pimpl idiom to accomplish such tasks. So take a look at the Qt source code for examples (for example, look for the "d" pointers).



+1


source


LPCWSTR shouldn't be a problem; it's just a silly name for wchar_t const*

. LPARAM is not a problem either, you can store them for a long time. Of course, these are only C ++ types, not Qt. But Qt can still handle them.



VS, as I understand it has to do with the Visual Studio IDE and not the (V) C ++ language.

0


source


You can use win32 scopes in your .pro file;

win32:HEADERS+=mywinheader.h

      

or with .pri (pro include) files to highlight them even more;

win32:include( mywinpri.pri )

      

You usually use this apprpoach with the PIMPL idiom as monjardin describes

0


source







All Articles