H
huanzhugege
Unregistered / Unconfirmed
GUEST, unregistred user!
这是delphi中的定义
function SincoGetDriveType(ADriveName: PChar)
: PChar
stdcall;
var
x: integer;
begin
x := GetDriveType(ADriveName);
case x of
1: result := 'UnExist Drive';
DRIVE_REMOVABLE: result := 'Movable Drive';
DRIVE_FIXED: result := 'Fixed Drive';
DRIVE_REMOTE: result := 'Network Drive';
DRIVE_CDROM: result := 'CDRom Drive';
DRIVE_RAMDISK: result := 'RAM Drive';
else
result := 'Unknown Type';
end;
end;
这是在vc中调用:
HINSTANCE gMyDll = NULL;
typedef char*(*SINCOGEtDRVIETYPE)(char*);
SINCOGEtDRVIETYPE SincoGetDriveType;
char disk[]="c://";
char* str;
gMyDll = LoadLibrary("drivetype.dll");
SincoGetDriveType = (SINCOGEtDRVIETYPE)GetProcAddress(gMyDll,"SincoGetDriveType");
str=SincoGetDriveType(disk);
FreeLibrary(gMyDll);
为什么会出错呢?
function SincoGetDriveType(ADriveName: PChar)
: PChar
stdcall;
var
x: integer;
begin
x := GetDriveType(ADriveName);
case x of
1: result := 'UnExist Drive';
DRIVE_REMOVABLE: result := 'Movable Drive';
DRIVE_FIXED: result := 'Fixed Drive';
DRIVE_REMOTE: result := 'Network Drive';
DRIVE_CDROM: result := 'CDRom Drive';
DRIVE_RAMDISK: result := 'RAM Drive';
else
result := 'Unknown Type';
end;
end;
这是在vc中调用:
HINSTANCE gMyDll = NULL;
typedef char*(*SINCOGEtDRVIETYPE)(char*);
SINCOGEtDRVIETYPE SincoGetDriveType;
char disk[]="c://";
char* str;
gMyDll = LoadLibrary("drivetype.dll");
SincoGetDriveType = (SINCOGEtDRVIETYPE)GetProcAddress(gMyDll,"SincoGetDriveType");
str=SincoGetDriveType(disk);
FreeLibrary(gMyDll);
为什么会出错呢?