|
-
August 8th, 2005, 10:20 AM
#1
Obtaining the handle of CD drive
Hi,
I am using the following piece of code to obtain the handle to CD drive. This piece of code is working in WinXP and Win2k but its not able to get the handle in Win98.
HANDLE m_hDevice;
m_hDevice = CreateFile("\\\\?\\G:", GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
if (m_hDevice==INVALID_HANDLE_VALUE)
{
AfxMessageBox("Cannot get handle");
}
Can someone help me ?
Regards
Gaurav
-
August 8th, 2005, 10:24 AM
#2
Re: Obtaining the handle of CD drive
What happens when you remove/change the "FILE_SHARE_WRITE"
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
-
August 8th, 2005, 11:13 AM
#3
Re: Obtaining the handle of CD drive
from MSDN
CreateFile
The CreateFile function creates or opens the following objects and returns a handle that can be used to access the object:
Consoles
Communications resources
Directories (open only)
Disk devices (Windows NT/2000 only)
^^^^^^^^^^^^^^^^^^^^^^^^^^
Files
Mailslots
Pipes
 Originally Posted by gaurav1115
Hi,
I am using the following piece of code to obtain the handle to CD drive. This piece of code is working in WinXP and Win2k but its not able to get the handle in Win98.
HANDLE m_hDevice;
m_hDevice = CreateFile("\\\\?\\G:", GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
if (m_hDevice==INVALID_HANDLE_VALUE)
{
AfxMessageBox("Cannot get handle");
}
Can someone help me ?
Regards
Gaurav
Let me simply be your friend!
-
August 9th, 2005, 06:03 AM
#4
Re: Obtaining the handle of CD drive
 Originally Posted by Vanaj
What happens when you remove/change the "FILE_SHARE_WRITE"
I tried but the problem persists
-
August 9th, 2005, 06:06 AM
#5
Re: Obtaining the handle of CD drive
 Originally Posted by wonder88
from MSDN
CreateFile
The CreateFile function creates or opens the following objects and returns a handle that can be used to access the object:
Consoles
Communications resources
Directories (open only)
Disk devices (Windows NT/2000 only)
^^^^^^^^^^^^^^^^^^^^^^^^^^
Files
Mailslots
Pipes
Thanks Dear. Do you know some other way to get the handle of CD drive in Win98.
-
August 9th, 2005, 06:42 AM
#6
Re: Obtaining the handle of CD drive
What was the Error you are getting...
you can get it by using GetLastError()...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|