Recent

Author Topic: CD Eject  (Read 12224 times)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: CD Eject
« Reply #30 on: February 23, 2019, 05:01:00 pm »
What Bart means, I think, is that something like this may crash:

Code: Pascal  [Select][+][-]
  1. type
  2.   TDriveType = (dtUnknown, dtNoRootDir, dtRemovable, dtFixed, dtRemote, dtCdrom, dtRamDisk);
  3.  
  4. function GetDriveType(ADrive: Char): TDriveType;
  5. var
  6.   WinDriveType: UInt;
  7. begin
  8.   WinDriveType := Windows.GetDriveType(PChar(LowerCase(ADrive+':\')));
  9.   Result := TDriveType(WinDriveType)
  10. end;

Of course, ona may avoid the crash by using instead something like:

Code: Pascal  [Select][+][-]
  1. type
  2.   TDriveType = (dtUnknown, dtNoRootDir, dtRemovable, dtFixed, dtRemote, dtCdrom, dtRamDisk, dtUnrecognized);
  3.  
  4. const
  5.   KnownDriveTypes = [dtUnknow..dtRamDisk];
  6.  
  7. function GetDriveType(ADrive: Char): TDriveType;
  8. var
  9.   WinDriveType: UInt;
  10. begin
  11.   WinDriveType := Windows.GetDriveType(PChar(LowerCase(ADrive+':\')));
  12.   if WinDriveType in KnownDriveTypes then
  13.     Result := TDriveType(WinDriveType)
  14.   else
  15.     Result := dtUnrecognized;
  16. end;


ETA: I'm too slow. :)
And yes, we're going OT very fast...
« Last Edit: February 23, 2019, 05:04:22 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 6017
Re: CD Eject
« Reply #31 on: February 23, 2019, 05:18:34 pm »
And yes, we're going OT very fast...
That seems to be the one thing we all agree on ;)  .. maybe it's time to drift into another thread ;-)
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Bart

  • Hero Member
  • *****
  • Posts: 5663
    • Bart en Mariska's Webstek
Re: CD Eject
« Reply #32 on: February 23, 2019, 05:31:11 pm »
ETA: I'm too slow. :)

What does ETA mean (I know it as estimated time of arrivel or a separatistic movement in Spain, neither of which you mean I guess)?

Bart

440bx

  • Hero Member
  • *****
  • Posts: 6017
Re: CD Eject
« Reply #33 on: February 23, 2019, 05:36:35 pm »
ETA: I'm too slow. :)

What does ETA mean (I know it as estimated time of arrivel or a separatistic movement in Spain, neither of which you mean I guess)?

Bart
ETA = Edited To Add
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Bart

  • Hero Member
  • *****
  • Posts: 5663
    • Bart en Mariska's Webstek
Re: CD Eject
« Reply #34 on: February 23, 2019, 05:37:36 pm »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: CD Eject
« Reply #35 on: February 23, 2019, 05:51:43 pm »
What does ETA mean (I know it as estimated time of arrivel or a separatistic movement in Spain, neither of which you mean I guess)?

Even further OT but as a Spaniard I can't avoid to comment: ETA is a terrorist organization not a separatist movement. >:(

A "separatist movement" is what the Catalonians are trying to do :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 6017
Re: CD Eject
« Reply #36 on: February 23, 2019, 06:27:57 pm »
What does ETA mean (I know it as estimated time of arrivel or a separatistic movement in Spain, neither of which you mean I guess)?

Even further OT but as a Spaniard I can't avoid to comment: ETA is a terrorist organization not a separatist movement. >:(

A "separatist movement" is what the Catalonians are trying to do :)
You're probably not Basque... but, Catalan maybe ? :)
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: CD Eject
« Reply #37 on: February 23, 2019, 08:39:15 pm »
You're probably not Basque... but, Catalan maybe ? :)

Nope, from Madrid. But I do have family from (an in) almost everywhere: Castilla, Andalusia, Catalonia, Galizia, Euskadi, ... If Spain is a cauldron of races, then Madrid is where it boiled (and boils!) harder and faster :)

But this is now wildly off-topic, so let's move on ;)
« Last Edit: February 23, 2019, 08:41:37 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018