Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Windows
»
Status Drives Search
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
How to know when dragging...
by
Aistis
[
Today
at 08:56:21 pm]
Tmemo add char like typin...
by
ackarwow
[
Today
at 08:41:20 pm]
Common File Dialogs Have ...
by
rvk
[
Today
at 08:22:34 pm]
[SOLVED] Set OnClick even...
by
cdbc
[
Today
at 06:54:53 pm]
Ancient Program
by
MarkMLl
[
Today
at 06:52:37 pm]
Directory-age?!?
by
MarkMLl
[
Today
at 06:40:04 pm]
SAVE StringGrid to PDF
by
seghele0
[
Today
at 06:27:02 pm]
C operators and shift
by
Seenkao
[
Today
at 06:17:30 pm]
TStatusBar.Color OK in Ob...
by
phidel
[
Today
at 05:51:41 pm]
NSHapticFeedbackPerformer
by
msintle
[
Today
at 04:52:53 pm]
kernel 6.8 and checking s...
by
MarkMLl
[
Today
at 04:35:50 pm]
fphttpapp and Windows Ser...
by
Gapes
[
Today
at 03:49:58 pm]
Inversive Geometry Curves...
by
Boleeman
[
Today
at 03:49:42 pm]
IFS Fractals: Iterating t...
by
Boleeman
[
Today
at 03:44:11 pm]
TLazSerial : serial port ...
by
CM630
[
Today
at 03:30:51 pm]
Storing line colors
by
user5
[
Today
at 03:24:24 pm]
Running 'Exec'-command do...
by
Wings2018
[
Today
at 02:46:25 pm]
Python4Lazarus Undefined ...
by
AlexTP
[
Today
at 02:26:25 pm]
Hustle - A simple task ma...
by
nomorelogic
[
Today
at 12:28:28 pm]
SQLite3 Date Problem
by
Zvoni
[
Today
at 11:54:12 am]
ZUGFeRD: Which PDF lib to...
by
cdbc
[
Today
at 08:03:31 am]
Map vs dataset
by
cdbc
[
Today
at 07:46:53 am]
TTrayIcon do not work pro...
by
Thaddy
[
Today
at 07:36:19 am]
Undefined symbol: WSRegis...
by
ljz111
[
Today
at 07:19:58 am]
Arrow keys in FV
by
Thaddy
[
Today
at 06:33:08 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Status Drives Search (Read 973 times)
d2010
Jr. Member
Posts: 62
Status Drives Search
«
on:
December 05, 2023, 08:43:15 am »
Hello.
I have in batch(".txt") script to reveal -all-drives.()
How to replace this batch(".txt") with pascal100%source?
--but only writeble disk/s drive
--but not CD-rom, not DVD
«
Last Edit: January 01, 2024, 10:54:41 am by d2010
»
Logged
Bart
Hero Member
Posts: 5466
Re: Windows. Status Drives Search
«
Reply #1 on:
December 05, 2023, 09:50:54 am »
I have a function like this:
Code: Pascal
[Select]
[+]
[-]
function
GetAvailableDrives
(
DiskMustBeInDrive
:
Boolean
=
False
;
DriveTypes
:
TDriveTypes
=
AllDriveTypes
)
:
TSysCharSet
;
As you can guess from it's signature you can search for writable drives that must be mounted.
You can find the code
here
.
Feel free to use and alter the code if so desired.
Bart
Logged
d2010
Jr. Member
Posts: 62
Re: Windows. Status Drives Search
«
Reply #2 on:
January 01, 2024, 10:54:22 am »
Thank you your-code, please you read my hints.
01)you replace upcase with locase
Code: Pascal
[Select]
[+]
[-]
D
:
=
GetLogicalDrives
;
for
C
:
=
'a'
to
'z'
do
begin
Mask
:
=
(
1
shl
(
Ord
(
c
)
-
Ord
(
'a'
)
)
)
;
if
(
Mask
and
D
)
=
Mask
then
begin
if
(
(
not
DiskMustBeInDrive
)
or
DiskInDrive
(
C
)
)
and
(
GetDriveType
(
C
)
in
DriveTypes
)
then
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Windows
»
Status Drives Search
TinyPortal
© 2005-2018