Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Is it possible to detect CD roms?

Author
Message
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 11th Nov 2006 15:53
Hello all,
it's been a while since i've used DBC now

i was thinking that it would be fun to write a file browser,
but i'm having trouble detecting CD Rom devices.

what i mean by this is that by performing a checklist for drives gives me a list of available drives. (C: D: E: F: G: I: J: in my situation).
i know that I: and J: are Cd/Dvd Rom Devices, but how can i tell DBC that they are?

if somebody else was going to run my file browser, and if I manually added a CD-Rom icon for I: and J: then that will be very confusing. Maybe because those are network connections or external Hard Drives or whatever.

So again,
How, if at all, can i make DBC detect CD Roms?

Thanks

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 12th Nov 2006 02:15
This is just a thought and may not work because of Read/Write CDs... but if you try to write a little file to that drive and it doesn't actually create the file then the drive is probably a CD-ROM.
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Nov 2006 11:32
in the diagnostic program i wrote with help of others should answer your question
http://forum.thegamecreators.com/?m=forum_view&t=92795&b=6

Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 12th Nov 2006 12:21
Thank you indi,
i will take a look at it and see if i can get it to work with DBC.
otherwise Grog's suggestions could work.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Nov 2006 13:48
It was made in DBC, so it should be good to go.

Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 13th Nov 2006 17:04
indi,
i can't seem to find the part of the code where it detects hard drives / cd-rom devices.
i downloaded this: http://forum.thegamecreators.com/xt/xt_apollo_download.php?i=1042020

oh and you say it was made in DBC but i cannot compile it with DBC.
works OK in DBPro though. even so it doesn't search for HD/CD-Rom Devices.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 13th Nov 2006 23:33 Edited at: 13th Nov 2006 23:35
try this version perhaps.
http://forum.thegamecreators.com/?m=forum_view&t=78108&b=1

one part your looking for is this component and then you will need the print out to text file component.




Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Nov 2006 03:24 Edited at: 14th Nov 2006 17:47
@Lukas W

Here ya go:



Enjoy your day.
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 14th Nov 2006 17:03
Sorry indi, i couldn't get it to work.
great application though

Latch, thanks for that. it was very easy to implement it to the browser

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Nov 2006 17:53
You're welcome!

One thing though, it seems that whenever I edit a post, the backslashes disappear. In the above code, some of the backslashes had disappeared. I put them back in but so you know, there has to be a backslash in

if bit = 1
drive$(bitpos-(n-1))=chr$(ascii)+":\"
print drive$(bitpos-(n-1));" ";
drivetype=call dll(1,"GetDriveTypeA",drive$(bitpos-(n-1)))
print drivetype$(drivetype)
endif

Each drive string has to be in the format <letter>:\ in order for the GetDriveTypeA() function to work properly. If the slash is not there, the wrong drive type could be returned.

Enjoy your day.
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 14th Nov 2006 19:33
oh i see. well i didn't notice anything wrong though.
however in my browser, to make it fit with the rest of the code that I had previously written i had to remove the backslashes anyway
I just added it to "drivetype=call dll(1,"GetDriveTypeA", drivename$+"\")" and i suppose it will work just as fine

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 18th Nov 2006 23:47
Should work just as long as you are sending a string to GetDriveTypeA() that looks something like A:\ (or C:\ or whatever)

Without the slash, it works to an extent but can return the wrong drive type on partitions, especially with multiple hard drives. I haven't seen it return the wrong type on CDs or DVDs yet, but it's better to be safe and keep it in the format A:\ .

Enjoy your day.

Login to post a reply

Server time is: 2026-07-10 14:58:30
Your offset time is: 2026-07-10 14:58:30