Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. WinAPI with Qt
Qt 6.11 is out! See what's new in the release blog

WinAPI with Qt

Scheduled Pinned Locked Moved General and Desktop
16 Posts 6 Posters 14.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RomanShteff
    wrote on last edited by
    #1

    How can I use WinAPI library (.dll) in my Qt application? Is it possible?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Yes, just use it.

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RomanShteff
        wrote on last edited by
        #3

        Should I declare DLL in my source file? That's it?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Alegen
          wrote on last edited by
          #4

          what ide are you using?

          if visual studio, then #include <windows.h>

          please give more details :)

          << something smart >>
          (signatures always contain something like that)

          1 Reply Last reply
          0
          • R Offline
            R Offline
            RomanShteff
            wrote on last edited by
            #5

            I use Qt Creator and make Qt application. How can I connect DLL to my Qt project?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              [quote author="RomanShteff" date="1296690300"]I use Qt Creator and make Qt application. How can I connect DLL to my Qt project?[/quote]

              See "Declaring Other Libraries":http://doc.qt.nokia.com/4.7/qmake-project-files.html#declaring-other-libraries in the "qmake manual":http://doc.qt.nokia.com/4.7/qmake-manual.html

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • R Offline
                R Offline
                RomanShteff
                wrote on last edited by
                #7

                Thanks for link to "Declaring Other Libraries". For example if I have my project in directory
                "C:\Project", and my library is "mylib.dll" I should write in .pro-file:

                @
                LIBS += C:\Project\mylib.dll
                @

                Is it correct?

                [EDIT: code formatting, Volker]

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on last edited by
                  #8

                  no, wrong

                  you write:

                  for MSVC tool chain
                  @
                  LIBS += C:\Project\mylib.lib
                  @

                  for gcc tool chain:
                  @
                  LIBS += $$quote(-LC:\Project) -lmylib
                  @

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    minimoog77
                    wrote on last edited by
                    #9

                    Or better

                    @win32:LIBS += C:\Project\mylib.lib@

                    @unix:LIBS += $$quote(-LC:\Project) -lmylib@

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      giesbert
                      wrote on last edited by
                      #10

                      but if you use gcc on windows, it will have problems with mylib.lib

                      Nokia Certified Qt Specialist.
                      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        minimoog77
                        wrote on last edited by
                        #11

                        LOL, I usually forget that there is GCC for Windows... :)

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          RomanShteff
                          wrote on last edited by
                          #12

                          I use Qt Creator.

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            goetz
                            wrote on last edited by
                            #13

                            [quote author="RomanShteff" date="1296749017"]I use Qt Creator.[/quote]

                            That's the IDE, not the compiler tool chain. You can use both (VisualStudio or GCC/MinGW) with Qt Creator and your .pro file must be set up correctly for the one you use.

                            The default open source installation of Qt Creator/SDK for Windows comes with MinGW as far as I know.

                            http://www.catb.org/~esr/faqs/smart-questions.html

                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              RomanShteff
                              wrote on last edited by
                              #14

                              Yeah, I have default open source installation. But I have .dll, not .lib

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                giesbert
                                wrote on last edited by
                                #15

                                and you then have .a files. and for gcc, you use:

                                @
                                LIBS += -L<path to dlls> -l<dll name without extension>
                                @

                                Nokia Certified Qt Specialist.
                                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  RomanShteff
                                  wrote on last edited by
                                  #16

                                  Thanks to all!

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved