Results 1 to 4 of 4

Thread: #include <mmsystem.h> and DWORD ?

  1. #1
    Join Date
    Nov 2009
    Posts
    59
    Thanks
    20
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default #include <mmsystem.h> and DWORD ?

    this is my code
    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include <mmsystem.h>
    3. int main(int argc, char *argv[])
    4. {
    5. QCoreApplication a(argc, argv);
    6. [COLOR="Red"]DWORD what;[/COLOR]
    7. return a.exec();
    8. }
    To copy to clipboard, switch view to plain text mode 
    but it gives me an error"DWORD is not a type name" why is wrong?
    thanks

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: #include <mmsystem.h> and DWORD ?

    DWORD is defined in windows.h so #include <windows.h> should do the trick

  3. The following user says thank you to Zlatomir for this useful post:

    zoz (30th May 2010)

  4. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: #include <mmsystem.h> and DWORD ?

    but bare in mind that using DWORD will make your code non portable!
    Better use either 'unsigned long' or better yet, Qt types, such as quint32 etc.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. The following 2 users say thank you to high_flyer for this useful post:

    Zlatomir (28th May 2010), zoz (30th May 2010)

  6. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: #include <mmsystem.h> and DWORD ?

    @high_flyer: Correct, but maybe he has some already written code with DWORD.

    But if only DWORD is "missing" you can get away without include windows.h, just typedef DWORD like this:
    Qt Code:
    1. typedef unsigned long DWORD;
    To copy to clipboard, switch view to plain text mode 

  7. The following user says thank you to Zlatomir for this useful post:

    zoz (30th May 2010)

Similar Threads

  1. How to include a dll ???
    By anupamgee in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2010, 09:28
  2. Cannot #include some classes
    By Jayes in forum Newbie
    Replies: 14
    Last Post: 13th March 2010, 21:41
  3. mfc in QT include
    By trusch in forum Qt Programming
    Replies: 3
    Last Post: 16th July 2009, 11:01
  4. Proper way to #include Qt?
    By pherthyl in forum Qt Programming
    Replies: 1
    Last Post: 11th August 2006, 03:15
  5. include
    By mickey in forum Newbie
    Replies: 6
    Last Post: 5th April 2006, 00:14

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.