04-28 00:20
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

[C/C++] MFC / 시스템의 드라이브 문자 표시 본문

Programming/C&C++

[C/C++] MFC / 시스템의 드라이브 문자 표시

cinema4dr12 2015. 1. 2. 12:49

MFC에서 자신의 Windows Machine의 논리 드라이브 문자 표시하는 방법은 다음과 같다:


[Header File]

CComboBox m_wndDevices;
CEdit m_wndVolume;


[Source Code]

CString s;
DWORD dwDrives = ::GetLogicalDrives();

for (int i = 0; dwDrives != 0; i++, dwDrives >>= 1)
{
	if ((dwDrives & 0x01) == 0x01)
	{
		s.Format(_T("%c:"), 'A' + i);
		m_wndDevices.AddString(s);
	}
}
if (m_nVolume > (m_wndDevices.GetCount() - 1))
	m_nVolume = (m_wndDevices.GetCount() - 1);
m_wndDevices.SetCurSel(m_nVolume);


Comments