Bonjour,
Voulant aller plus loin avec l'API je me heurte au problème suivant :
D2006, vers. 10, ne semble pas connaître THandle.
Y a t'il un Use à utiliser ?
Merci PL
Version imprimable
Bonjour,
Voulant aller plus loin avec l'API je me heurte au problème suivant :
D2006, vers. 10, ne semble pas connaître THandle.
Y a t'il un Use à utiliser ?
Merci PL
:f1:
Ah la numération des versions :roll:
10 = Delphi 10 = Delphi 2006 = BDS 4.0
ou
10 = Delphi 2010 = Delphi 14 = BDS 7.0
ou
10 = BDS 10.0 = Delphi 17 = XE3 ???
Selon l'aide 2010 : System.THandle, donc System.pas qui est inclu implicitement !
Selon l'aide XE3 : System.THandle, idem
C'est très gênant ton erreur, tu devrais refaire le projet, surement un problème de migration !
Bonjour,
merci @ Shaile pour ses conseils.
Primo je suis sur BDS 4.
J'ai bien retrouvé System.pas.
J'ai ensuite galéré, puis pour pouvoir compiler il fallait travailler explicitement en tant qu'administrateur. A l'exécution aussi.
cf CreateFile § Physical Disks and Volumes.
PLCitation:
Physical Disks and Volumes
You can use the CreateFile function to open a physical disk drive or a volume. The function returns a handle that can be used with the DeviceIoControl function. This enables you to access the disk's partition table. It is potentially dangerous to do so, since an incorrect write to a disk could make its contents inaccessible. The following requirements must be met for such a call to succeed:
· The caller must have administrative privileges. For more information, see Running with Special Privileges.
· The dwCreationDisposition parameter must have the OPEN_EXISTING flag.
· When opening a volume or floppy disk, the dwShareMode parameter must have the FILE_SHARE_WRITE flag.
P.S. par contre si on veut seulement lire le contenu d'un volume, en déclarant 'hFile : word', CREATEFILE s'exécute sans restriction.
Mais on ne pourra pas utiliser DeviceIOControl.
Mea-culpa :cette solution (hFile : word) ne fonctionne que pour un lecteur de disquette/USB. C'est l'exception.