Click to See Complete Forum and Search --> : include for SetVolumeMountPoint ??????


delphieng
September 19th, 2003, 11:52 AM
Hi guys, i haven't had much luck finding info anywhere else. So here it goes. I'm trying to use the Win32 API functions GetVolumeNameForVolumeMountPoint and SetVolumeMountPoint. Very clearly documented in MSDN, the current one (found at msdn.microsoft.com as well as my old 2001 version).

All versions of MSDN claim that the functions are supported on Win 2000 and later ( Windows NT/2000/XP: Included in Windows 2000 and later.). Which is good, because the platform i'm developing for is Win XP. And my development platform is Win 2000 (5.00.2195 Service pack 4).

However when i try to build a small sample project in Visual Studio, the program claims that both functions SetVolumeMountPoint as well as GetVolumeNameForVolumeMountPoint are undeclared identifier.

MSDN claims that the header file is Windows.h, and that the library is kernel32.lb, both are properly included in the project.


Any ideas?

Andreas Masur
September 19th, 2003, 01:45 PM
These functions are most-likely covered with an '#ifdef...#endif' guard...

Add the following line...

#define _WIN32_WINNT 0x0400

before you include 'windows.h'...

Mick
September 19th, 2003, 06:58 PM
Under w2k it's guarded by:

#if (_WIN32_WINNT >= 0x0500)

so 0x0400 probably isn't going to work...

it's in winbase.h

Here is a clue, put the function your .cpp, highlight the function and select go to definition....scroll up and look for ifdefs...or #if's in this case...

Andreas Masur
September 20th, 2003, 05:24 AM
Originally posted by Mick_2002
Under w2k it's guarded by:

#if (_WIN32_WINNT >= 0x0500)

so 0x0400 probably isn't going to work...

Yes...it has to be '0x0500'...I did not look closely enough at the line...

Windows NT/2000/XP: Included in Windows 2000 and later

Sorry about that... :rolleyes:

Mick
September 20th, 2003, 05:43 AM
Originally posted by Andreas Masur
Yes...it has to be '0x0500'...I did not look closely enough at the line...

Sorry about that... :rolleyes:

everybody has thier days andy, even me...but look at it this way, you made me go look :p

delphieng
September 22nd, 2003, 12:45 PM
Hey guys thanks!

I did all that as i followed this msdn tutorial, but it still didn't work. However i think i found the problem. Open Watcom had overwritten registry settings for Visual C++, and caused tons of problems. One reinstall later it works.. I have a related question, but i'll save that for another thread..


thanks again

Mick
September 22nd, 2003, 01:55 PM
Originally posted by delphieng
Hey guys thanks!

I did all that as i followed this msdn tutorial, but it still didn't work. However i think i found the problem. Open Watcom had overwritten registry settings for Visual C++, and caused tons of problems. One reinstall later it works.. I have a related question, but i'll save that for another thread..


thanks again

well you know we spent so much time patting each other on the back and you 'up' and ruin it...whats wrong with you :p