m_combo4.Dir(DDL_DRIVES | DDL_EXCLUSIVE, _T(""));上面这段代码,其中m_combo4是一个CComboBox对象
本来该语句执行过后,CComboBox应该可以选择盘符,但实际上CComboBox中什么都没有
我感到很奇怪,恳请高手指教

解决方案 »

  1.   

    // Add all the files and directories in the windows directory.
    TCHAR lpszWinPath[MAX_PATH], lpszOldPath[MAX_PATH];
    VERIFY(0 < ::GetWindowsDirectory(lpszWinPath, MAX_PATH));// Make the windows directory the current directory.
    ::GetCurrentDirectory(MAX_PATH, lpszOldPath);
    ::SetCurrentDirectory(lpszWinPath);m_pComboBox->ResetContent();
    m_pComboBox->Dir(DDL_READWRITE|DDL_DIRECTORY, _T("*.*"));// Reset the current directory to its previous path.
    ::SetCurrentDirectory(lpszOldPath);
      

  2.   

    2楼贴的就是MSDN例子。楼主看看吧另外这个函数是有返回值的,可以看看返回值的内容。排排错