line6 pod x3(x,y 18,x 4,y 14);szGetDriveTypedb'GetD

Using the GetDriveType() function for Win32 programming
GetDriveType() - finding the drive types
Compiler: Visual C++ Express Edition 2005
Compiled on Platform: Windows XP Pro SP2
Target platform: none, just for learning
Header file: Standard and Windows
Additional library: Windows Platform SDK
Additional project setting: Set project to be compiled as C
Project -& your_project_name Properties -& Configuration Properties -& C/C++ -&
Advanced -& Compiled As: Compiled as C Code (/TC)
Other info: non-CLR or unmanaged
do: Finding the Windows drive types
show: Using the GetDriveType() function
#include &windows.h&
#include &stdio.h&
May use 2-D array for char. This program compiled for wide char/unicode
LPCWSTR drive2[13] = {L&A:\\&, L&B:\\&, L&C:\\&, L&D:\\&, L&E:\\&, L&F:\\&,
L&G:\\&, L&H:\\&,L&I:\\&, L&J:\\&, L&K:\\&, L&&};
You may want to use the wmain() version
main(void)
for(i=0; i&12; i++)
= GetDriveType(drive2[i]);
switch(test)
0: printf(&Drive %S is type %d - Cannot be determined.\n&, drive2[i], test);
1: printf(&Drive %S is type %d - Invalid root path/Not available.\n&, drive2[i],
2: printf(&Drive %S is type %d - Removable.\n&, drive2[i], test);
3: printf(&Drive %S is type %d - Fixed.\n&, drive2[i], test);
4: printf(&Drive %S is type %d - Network.\n&, drive2[i], test);
5: printf(&Drive %S is type %d - CD-ROM.\n&, drive2[i], test);
6: printf(&Drive %S is type %d - RAMDISK.\n&, drive2[i], test);
default : &Unknown value!\n&;
Output example:
A:\ is type 2 - Removable.
B:\ is type 1 - Invalid root path/Not available.
C:\ is type 3 - Fixed.
D:\ is type 1 - Invalid root path/Not available.
E:\ is type 3 - Fixed.
F:\ is type 3 - Fixed.
G:\ is type 3 - Fixed.
H:\ is type 1 - Invalid root path/Not available.
I:\ is type 1 - Invalid root path/Not available.
J:\ is type 1 - Invalid root path/Not available.
K:\ is type 5 - CD-ROM.
L:\ is type 1 - Invalid root path/Not available.
any key to continue . . .

我要回帖

更多关于 flowline 的文章

 

随机推荐