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. [Solved] Using Windows Datatype HDEVINFO
QtWS25 Last Chance

[Solved] Using Windows Datatype HDEVINFO

Scheduled Pinned Locked Moved Unsolved General and Desktop
windowsinclude
13 Posts 3 Posters 8.2k Views
  • 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.
  • patrikdP Offline
    patrikdP Offline
    patrikd
    wrote on last edited by patrikd
    #1

    Hi all,
    I'm trying to get some device Infos on Windows. For this I need the setupapi type HDEVINFO. But I can't get the complier to know this type. I included the <setupapi.h> which QtCreator knows and references correct. I also added :

    LIBS += -L/path to the lib -lsetupapi 
    

    but still this pedantic compiler complains :(
    any hints?
    thx,
    patrik

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What error messages do you get?
      What is the compiler you are using?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • sneubertS Offline
        sneubertS Offline
        sneubert
        wrote on last edited by
        #3

        As MSDN states HDEVINFO is a handle to a device Information set. You can use HANDLE to store this value.

        1 Reply Last reply
        0
        • patrikdP Offline
          patrikdP Offline
          patrikd
          wrote on last edited by
          #4

          hi guys,
          thx for the fast reply :)
          @jsulm: MS Visuall C++ Compiler 14. The error is unknow type.
          @nseubert: changing to HANDLE works for HDEVINFO but that only helps partial because I also want to use SP_DEVINFO_DATA which brings me back to start.
          More hints?
          thx,
          patrik

          1 Reply Last reply
          0
          • sneubertS Offline
            sneubertS Offline
            sneubert
            wrote on last edited by sneubert
            #5

            You have to call SetupDiEnumDeviceInfo with your Handle to extract a SP_DEVINFO_DATA structure, from the device Information set.

            have a look at
            https://msdn.microsoft.com/en-us/library/windows/hardware/ff541247(v=vs.85).aspx

            1 Reply Last reply
            0
            • patrikdP Offline
              patrikdP Offline
              patrikd
              wrote on last edited by
              #6

              hi sneubert,
              but thats what I can't do because for all of this, including the SetupDiEnumDeviceInfo function, I need the setupapi.lib and I can't get the types and functions from this. the Compiler complains it can't find it.
              thx,
              patrik

              1 Reply Last reply
              0
              • sneubertS Offline
                sneubertS Offline
                sneubert
                wrote on last edited by
                #7

                did you install any Windows sdk?

                1 Reply Last reply
                0
                • patrikdP Offline
                  patrikdP Offline
                  patrikd
                  wrote on last edited by
                  #8

                  yes, the win10 sdk. the sdk works so far fine for compiling my Project to the Emulator and device. also the qtcreator finds the correct setupapi.h file on following via f2.

                  1 Reply Last reply
                  0
                  • sneubertS Offline
                    sneubertS Offline
                    sneubert
                    wrote on last edited by
                    #9

                    Just a guess, but i hade a similar issue. Even Windows is not case sensitive, i could“t link lib with extentions .Lib. On Win7 SDK I have SetupAPI.Lib.
                    Can you try to copy the lib to your project root folder and rename to lower case, even the extentions and link against this lib?

                    1 Reply Last reply
                    0
                    • sneubertS Offline
                      sneubertS Offline
                      sneubert
                      wrote on last edited by sneubert
                      #10

                      and could you post your compiler output?

                      1 Reply Last reply
                      0
                      • patrikdP Offline
                        patrikdP Offline
                        patrikd
                        wrote on last edited by
                        #11

                        I'm a little further. I just copied the setupapi.h to my project and included it directly. Still it get the errors that the types and functions are unknown. Within the code of the setupapi there is:

                        #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) ....
                        

                        within this block all the definitions are set.
                        Seems like the setupapi.h is not available for winrt but I can't find a hint in the Windows docu for that. Could it be that the setupapi is not available to winrt?
                        best,
                        patrik

                        1 Reply Last reply
                        0
                        • sneubertS Offline
                          sneubertS Offline
                          sneubert
                          wrote on last edited by
                          #12

                          Ok, WinRT was the information missing.
                          WinRT has a limited set of winapi functions, there is a list where you can check functions by name

                          https://msdn.microsoft.com/en-us/library/windows/apps/dn424765.aspx

                          you are rigth, the setupapi functions are not available for WinRT.

                          1 Reply Last reply
                          1
                          • patrikdP Offline
                            patrikdP Offline
                            patrikd
                            wrote on last edited by
                            #13

                            so i will look there. thx for the help.
                            patrik

                            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