Results 1 to 6 of 6

Thread: What have I to use/include to call winapi /win32 functions?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default What have I to use/include to call winapi /win32 functions?

    I want to implement a memory control for my program (I want to know how much memory that it spend)
    I have a little piece of code for it (found on the web), and it use :
    Qt Code:
    1. #include <windows.h>
    2. #include <psapi.h>
    To copy to clipboard, switch view to plain text mode 

    I have errors on :
    Qt Code:
    1. if ( !EnumProcesses( a ....
    2. if ( GetProcessMemoryInfo( hProc
    To copy to clipboard, switch view to plain text mode 
    Am I forgetting something ?
    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: What have I to use/include to call winapi /win32 functions?

    Quote Originally Posted by tonnot View Post
    I have errors on :
    Qt Code:
    1. if ( !EnumProcesses( a ....
    2. if ( GetProcessMemoryInfo( hProc
    To copy to clipboard, switch view to plain text mode 
    Of course you have errors because your syntax is not valid. You have four opening brackets and none closing one...



    ... or what error do you mean!

  3. #3
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What have I to use/include to call winapi /win32 functions?

    Of course, I have not written all the code...
    The errors are 'undefined references' in this 2 lines.
    Thanks

  4. #4
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What have I to use/include to call winapi /win32 functions?

    Did you link against psapi?

    You need something like this in your pro file.

    Qt Code:
    1. win32:LIBS += -lpsapi
    To copy to clipboard, switch view to plain text mode 
    HIH

    Joh

  5. #5
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What have I to use/include to call winapi /win32 functions?

    what compiler? If MinGW then try add in *.pro file this:
    Qt Code:
    1. LIBS += -lPsapi
    To copy to clipboard, switch view to plain text mode 
    and etc.

    PS: man msdn!

    ---

    OOPS

  6. #6
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What have I to use/include to call winapi /win32 functions?

    Thanks
    I'm going to try it .

Similar Threads

  1. Using Winapi in Qt?
    By Awareness in forum Qt Programming
    Replies: 3
    Last Post: 23rd March 2010, 03:04
  2. Cannot call OpenCV 2.0 functions inside Qt slots
    By Asfer in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2010, 11:48
  3. Winapi in Qt
    By Trok in forum Qt Programming
    Replies: 1
    Last Post: 19th July 2009, 16:38
  4. Replies: 3
    Last Post: 4th March 2008, 08:35
  5. virtual overloaded functions and base class function call...
    By nouknouk in forum General Programming
    Replies: 7
    Last Post: 11th March 2006, 21:26

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.