Hello, I was wondering how you might go about detecting a drive letter, such as D for DVD drive, if you wern't to run it on your own computer. I have programmed something that picks a certain drive letter in an attempt to match it to theirs. The reason is, I would like to make a program that opens/closes the CD/DVD drive on anyones computer, without the user having to get up, and do it themselves. Through this, I will later program a menu, so the user can pick which one he wants to open/close.
Does anyone have any thoughts on this topic, or syntax?

Thanks guys!

*SP* Detecting... :@

Recommended Answers

All 2 Replies

This Drive Picker MFC control contains the win32 api function(s) you need to get a list of valid drive letters. All you need is to call GetNumSelectedDrives(). See the explaination in the MSDN and the source code link I provided for how to interpret it.

I don't know how this can be called remotly on another computer.

Well, couldn't you use the function to determine the control of the drive?
If the drive was E: for example:
This code checks the stated drive, so how would I use this?


Thank you

string sdrive2("\\\\.\\e:"); //


HANDLE hcd = CreateFile(sdrive.c_str(),
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_READONLY,
NULL);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.