以下是我在微软官方看到的事例程序 为什么我编译时总是出错呢
我用的是VC++ 6.0
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
D:\My Documents\Cpp1.cpp(33) : error C2065: 'GetVolumeNameForVolumeMountPoint' : undeclared identifier
D:\My Documents\Cpp1.cpp(46) : error C2065: 'SetVolumeMountPoint' : undeclared identifier
执行 cl.exe 时出错.
Cpp1.obj - 1 error(s), 0 warning(s)
-------------------------------------------------------------------------
#define _WIN32_WINNT 0x0501
#include
#include
#define BUFSIZE MAX_PATH
void Syntax (char *argv)
{
printf( "%s, mount a volume at a mount point.\n", argv );
printf( "For example, \"mount c:\\ f:\\\"\n" );
}
int
main( int argc, char *argv[] )
{
BOOL bFlag;
char Buf[BUFSIZE]; // temporary buffer for volume name
if( argc != 3 )
{
Syntax( argv[0] );
return( -1 );
}
// We should do some error checking on the inputs. Make sure
// there are colons and backslashes in the right places, etc.
bFlag = GetVolumeNameForVolumeMountPoint(
argv[2], // input volume mount point or directory
Buf, // output volume name buffer
BUFSIZE // size of volume name buffer
);
if (bFlag != TRUE)
{
printf( "Retrieving volume name for %s failed.\n", argv[2] );
return (-2);
}
printf( "Volume name of %s is %s\n", argv[2], Buf );
bFlag = SetVolumeMountPoint(
argv[1], // mount point
Buf // volume to be mounted
);
if (!bFlag)
printf ("Attempt to mount %s at %s failed.\n", argv[2], argv[1]);
return (bFlag);
}
--------------------next---------------------
阅读(1121) | 评论(0) | 转发(0) |