View Full Version : Using WIN32 APi function "GetVolumeNameForVolumeMountPointA"
klenze
3rd January 2012, 11:27
Hi,
I want to use the win 32 API function GetVolumeNameForVolumeMountPointA in my qt application, but I get this compilation error:
error: 'GetVolumeNameForVolumeMountPointA' was not declared in this scope
WinBase.h and Windows.h are included both. What might be the problem?
Thanks
wysota
3rd January 2012, 13:08
How is this question related to Qt?
klenze
3rd January 2012, 13:13
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 ?
Lesiok
3rd January 2012, 13:32
Qt application is normal C++ application so You can do this.
klenze
3rd January 2012, 13:43
Can I also use it with the gcc compiler, which is available in qtCreator?
wysota
3rd January 2012, 16:04
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.
ChrisW67
3rd January 2012, 23:16
GetVolumeNameForVolumeMountPointA is defined in winbase.h only on Windows 2003, XP or later. According to the comment in MinGW's windows.h:
#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/library/aa383745%28v=vs.85%29.aspx
Try:
#define WINVER 0x0501
#include <windows.h>
or put:
DEFINES += WINVER=0x0501
in your PRO file for a project-wide setting
klenze
4th January 2012, 09:22
Great, it works.
Thanks a lot.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.