分两步回答吧 
第一个如何得到光驱的盘符
第二个如何改File open的目录

解决方案 »

  1.   

    2.
    CFileDialog dlg(TRUE);
    dlg.m_ofn.lpstrInitialDir = "F:\\光盘路径"; //光盘路径
    dlg.DoModal();
      

  2.   

    GetDriveType("D:") == DRIVE_CDROM 
    判断是否为光驱
      

  3.   

    以下是遍历驱动器,取各个驱动器属性的函数,驱动器类型为DRIVE_CDROM的是光驱。int  FillPacket_drivers(CBuffer *pBuffer)
    {
    int DriveType;
    char drivers[160];
    char FreeByteChar[100], TotalByteChar[100];
    __int64 fulldisk;
    DWORD SectorsPerCluster, BytesPerSectors, FreeCluster, TotalCluster;
    __int64 i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; drivers[0] = 0;
    fulldisk = 0;
    if(GetLogicalDriveStrings(sizeof(drivers), drivers) >0)
    {
    char *p = drivers;
    while(*p)
    {
    pBuffer->Format(" %s\t%-20s", p, cv_drivetype(p, &DriveType));
    if( (DriveType == DRIVE_FIXED) &&
    GetDiskFreeSpace(p, &SectorsPerCluster, &BytesPerSectors, &FreeCluster, &TotalCluster) &&
    GetDiskFreeSpaceEx(p, (PULARGE_INTEGER)&i64FreeBytesToCaller, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes) )
    {
    fulldisk += i64TotalBytes; i64FreeBytes  /= 1024;
    i64TotalBytes /= 1024; pBuffer->Format("%d S/C  %d B/S  Free %-10s KB,  Total %-10s KB",
    SectorsPerCluster,
    BytesPerSectors,
    cv_s_int64u(i64FreeBytes, FreeByteChar, sizeof(FreeByteChar)),
    cv_s_int64u(i64TotalBytes,TotalByteChar, sizeof(TotalByteChar)) );
    }
    pBuffer->Format("\r\n");
    p += strlen(p) + 1; //
    } fulldisk /= 1024 ;
    pBuffer->Format("\t\t\tTotal Disk %s KB\r\n", cv_s_int64u(fulldisk, TotalByteChar, sizeof(TotalByteChar)) );
    }
    return pBuffer->GetBufferLen();
    }设置打开路径如下:
    CFileDialog dlg(TRUE, ...);
    dlg.m_ofn.lpstrInitialDir = "G:\\"; //G为光盘盘符
      

  4.   

    for(char ch='A';ch<'Z';ch++)
    {
        CString str;
        str.Format("%c:",ch);
        if(GetDriveType(str) == DRIVE_CDROM)
        {
            CFileDialog dlg(TRUE);
            dlg.m_ofn.lpstrInitialDir =str;
            dlg.DoModal();
            break;
        }
    }