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. QT not recognizing win32 methods
Qt 6.11 is out! See what's new in the release blog

QT not recognizing win32 methods

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 4.1k 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.
  • K Offline
    K Offline
    Kewal
    wrote on last edited by
    #1

    I am using functions like readregistryvalue from windows.h
    I wanted to know if this is the way it has to be done in Qt too, and I tried including windows.h but I am not able to do that anyideas as to how to include it .
    by the way i am using visual studio addin and my workspace is linked with 4.8.0 qt library

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      You can use QSettings instead of windows registry functions...
      And by the way, if you use VS, you can use full power of windows SDK, just ensure what all paths & libs are set in the VS Project Properties...

      I don't really understand why you can't include windows.h? What does compiler says about that?

      God is Real unless explicitly declared as Integer.

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

        This usually works without any problems and is used internally in Qt too. What is your error?

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

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kewal
          wrote on last edited by
          #4

          actually, I am having an error which says _T identifier not found, I am trying to convert from char * to LPCWSTR and tried including windows.h
          apart from that i incuded QString::toUtf8 to achieve from QString to QByteArray and that is also not actually working.

          I am pretty sure its getting included because it should have thrown me an error which would be like header file not found, that is not the case here,.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            stima_ua
            wrote on last edited by
            #5

            If you use RegGetValue from winapi, you need add library Advapi32.lib see "msdn":http://msdn.microsoft.com/en-us/library/windows/desktop/ms724868(v=vs.85).aspx

            p.s. some my code:
            @
            QString value(const QString &subKey)
            {
            TCHAR buff[1024] = {0};
            DWORD dwSize = sizeof(buff);

            lError = RegQueryValueEx(hHandle, subKey.utf16(), NULL, NULL, (BYTE*)buff, &dwSize);
            
            return QString::fromUtf16(reinterpret_cast<ushort*>(buff));
            

            }
            @

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AcerExtensa
              wrote on last edited by
              #6

              Have you set Character Set Project Properties?
              VS Project Property Page -> General -> Character Set.
              &
              Vs Property Page -> C/c++ -> Language -> Treat WChar_t As Built in Type should be No.

              God is Real unless explicitly declared as Integer.

              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