Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
Hi,
I want to use the win 32 API function GetVolumeNameForVolumeMountPointA in my qt application, but I get this compilation error:
Code:
error: 'GetVolumeNameForVolumeMountPointA' was not declared in this scope
WinBase.h and Windows.h are included both. What might be the problem?
Thanks
Re: Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
How is this question related to Qt?
Re: Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
Sorry, because of the vaque description of my problem.
I just want to know if it is principally possible to use WIN32 Api functions in Qt applications? Are there any restrictions regarding the used compiler ?
Re: Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
Qt application is normal C++ application so You can do this.
Re: Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
Can I also use it with the gcc compiler, which is available in qtCreator?
Re: Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
Why wouldn't it be possible? And yes, you can write your code in any code editor you like and you can be wearing a Linux t-shirt while writing Windows code, your Windows shouldn't explode in your face because of that.
Re: Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
GetVolumeNameForVolumeMountPointA is defined in winbase.h only on Windows 2003, XP or later. According to the comment in MinGW's windows.h:
Code:
#ifndef WINVER
#define WINVER 0x0400
/*
* If you need Win32 API features newer the Win95 and WinNT then you must
* define WINVER before including windows.h or any other method of including
* the windef.h header.
*/
#endif
Values are documented here: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
Try:
Code:
#define WINVER 0x0501
#include <windows.h>
or put:
Code:
DEFINES += WINVER=0x0501
in your PRO file for a project-wide setting
Re: Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
Great, it works.
Thanks a lot.