none
Why is "dbcv_flags = 0" for external DVD burner? RRS feed

  • Question

  • I am implementing an application to detect external DVD burner and read/Write data to the CD.

    below is the sample code i have written.

    case WM_DEVICECHANGE:
        {
            DEV_BROADCAST_HDR *pdbch = (DEV_BROADCAST_HDR *)lParam;
            switch (wParam)
            {
            case DBT_DEVICEARRIVAL:
            {
                if (pdbch->dbch_devicetype == DBT_DEVTYP_VOLUME)
                {
                    PDEV_BROADCAST_VOLUME pdbcv = (PDEV_BROADCAST_VOLUME)lParam;
                    if (pdbcv->dbcv_flags == DBTF_MEDIA)
                    {
                        MessageBox(NULL, L"CD/DVD detected", L"Caption", MB_OK);
                    }
                }
                break;
            }
            case DBT_DEVICEREMOVECOMPLETE:
            {
                MessageBox(NULL, L"CD/DVD Removed", L"Caption", MB_OK);
                break;
            }
        }

    i have a case where CD/DVD is already in tray and connect the burner to the application, here i am not able to read CD content for the first time as pdbcv->dbcv_flags is not DBTF_MEDIA.

    All other subsequent Eject/Insert's are working fine. Problem is only when we connect burner with already CD/DVD inside.

    Friday, July 26, 2019 10:22 AM