QT not recognizing win32 methods
-
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 -
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?
-
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,.
-
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));
}
@ -
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.