i think i have a lead to a question that has been asked a lot of times, but as far as i know (please correct me if im wrong) has never been answered...
the question is, how can a program be notified the minute a cd is inserted into the tray....
this is my lead....
it's obvious it has something to do with mci (duh, that's how you can open a tray through a program) and i was looking the other day at api-guide on "mciSendString"....
i noticed the last parameter, "hwndCallback"....
here is the description: "Handle of a callback window if the 'notify' flag was specified in the command string." !
this means, our program can be notified somehow if we do a certain mci command and add "notify" to it...
it might just work, please help me solve this everlasting question!
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here! Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
and yet another lead!
when the drive is closed, we can send an mci command to the drive to close itself, and use the "notify" flag so when it's done it'll notify us.... now we just have to learn how to use that notify flag with the hwnd!
please help me!
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here! Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
sorry for not replying ctrcpblade, i was in camp in the middle of nowhere sleeping under the stars and building everything i needed for five days.... can't think of any better way to spend my time....
anyway, yep, that really helps! ill try, please people help us, this is a question that bugs many people i know.....
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here! Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
I got my code detecting when a cd has been inserted or removed. I'll post the coding when I can figure out how to detect what drive Windows is talking about.
why not post the code and we'll help you detect it?
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here! Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
in mci that's not how it works, when you put a notify tag in an mcisendmessage command, it sends an mm_mcinotify (i think) message, and that's why we have to subclass....
btw, i don't think this approach is correct, i have tried closing the cd with a notify, and it started it, and my cd being closed, it immediately notified me....
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here! Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
that's really weird, it doesn't get any wm_devicechanged message though the dbl click works fine, though now i know how it works, ill try to get it to work myself....
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here! Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
i think i have found a better way to do what we wan't to do....
check this out: http://www.pscode.com/vb/scripts/Sho...23405&lngWId=1
it also does media added by get a registering an sh notification message and reading a SHCNE_MEDIAINSERTED and a SHCNE_MEDIAREMOVED...
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here! Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
Error:
Project library not found (something like that)
VB Code:
[COLOR=deeppink]Sub ProcessDeviceChange(wParam As Long, lParam As Long)[/COLOR]
Dim DBHdr As DEV_BROADCAST_HDR
Dim DBVol As DEV_BROADCAST_VOLUME
CopyMemory DBHdr, ByVal lParam, LenB(DBHdr)
Select Case wParam
Case DBT_DEVICEARRIVAL
'See if a CD-ROM or DVD was inserted into a drive.
If DBHdr.dbch_devicetype = DBT_DEVTYP_VOLUME Then
CopyMemory DBVol, ByVal lParam, LenB(DBVol)
If (DBVol.dbcv_flags And DBTF_MEDIA) = DBTF_MEDIA Then
frmMain.lstChanged.AddItem "New media inserted in drive " + Chr$(FirstDriveFromMask(DBVol.dbcv_unitmask))
End If
End If
Case DBT_DEVICEREMOVECOMPLETE
'See if a CD-ROM or DVD was removed from a drive.
If DBHdr.dbch_devicetype = DBT_DEVTYP_VOLUME Then
CopyMemory DBVol, ByVal lParam, LenB(DBVol)
If (DBVol.dbcv_flags And DBTF_MEDIA) = DBTF_MEDIA Then
frmMain.lstChanged.AddItem "Media removed from drive " + Chr$(FirstDriveFromMask(DBVol.dbcv_unitmask))
End If
End If
End Select
End Sub
WinXPPro / VB6
EDIT:
Story as follows:
The CDROM was empty. Ran program and inserted media, error as above. I closed program, and the media was still in drive. I ran the program, opened CDROM and took out media, and it worked. I closed program, and inserted then took out and it now works...anyone know why?
thanks,
alacritous
Last edited by alacritous; Sep 23rd, 2003 at 04:59 PM.
Highlights the pink, when I inserted the media, read my EDIT though, before you jump to conclusions.. ill be on aim if you want alacritous8 but I'll be eatting for a lil...