Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, February 2007
Windows/Qt conflicts


Message 1 in thread

Hi All,
 
I am exploring QT on windows. 
Came across the the qwindowsdefs_win.h.
This typedes stuff like HINSTANCE, HFONT etc.
Just wondering why does it not conflict with same typedefs in windef.h
of windows SDK  ?
 
Any ideas ?
 
Thnx
Prateek

Message 2 in thread

Hi,

> I am exploring QT on windows.
> Came across the the qwindowsdefs_win.h.
> This typedes stuff like HINSTANCE, HFONT etc.
> Just wondering why does it not conflict with same typedefs in 
> windef.h of windows SDK  ?

They're re-defined only if they're not already defined (to work around 
broken SDKs I guess).

--
 [ signature omitted ] 

Message 3 in thread

I dont think so.
Look at the following snippets :-

qwindowdefs.h:

#if defined(Q_WS_WIN)
#include <QtGui/qwindowdefs_win.h>
#endif // Q_WS_WIN

qglobal.h:

#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) ||
defined(__WIN32__) || defined(__NT__))
#  define Q_OS_WIN32

and


#if defined(Q_WS_WIN16) || defined(Q_WS_WIN32)
#  define Q_WS_WIN
#endif
 
Here WIN32 is defined at command line for windows projects so
qwindowdefs_win.h would be included always.

I think normally for a QT project one would not include <windows.h>.
But if one uses the QT/MFC migration framework, <windows.h> is also
included in the demo application.

Including <windows.h> includes <windef.h> which should result in
conflicting typedefs.

But I dont see any error :-(

Pl help me understand this.

Thnx
Prateek

-----Original Message-----
From: Dimitri [mailto:dimitri@xxxxxxxxxxxxx] 
Sent: Monday, February 19, 2007 2:54 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: Windows/Qt conflicts

Hi,

> I am exploring QT on windows.
> Came across the the qwindowsdefs_win.h.
> This typedes stuff like HINSTANCE, HFONT etc.
> Just wondering why does it not conflict with same typedefs in windef.h

> of windows SDK  ?

They're re-defined only if they're not already defined (to work around
broken SDKs I guess).

--
 [ signature omitted ] 

Message 4 in thread

Hi,

> Including <windows.h> includes <windef.h> which should result in
> conflicting typedefs.

Indeed <qwindowsdefs_win.h> is included, however HINSTANCE, HFONT etc. 
are re-defined only if they're not already defined.

--
 [ signature omitted ]