MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / OnInitDialog

Method OnInitDialog

Explorer++/Explorer++/SetDefaultColumnsDialog.cpp:28–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28INT_PTR SetDefaultColumnsDialog::OnInitDialog()
29{
30 m_icon.reset(LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_MAIN)));
31 SetClassLongPtr(m_hDlg, GCLP_HICONSM, reinterpret_cast<LONG_PTR>(m_icon.get()));
32
33 HWND hComboBox = GetDlgItem(m_hDlg, IDC_DEFAULTCOLUMNS_COMBOBOX);
34
35 TCHAR szFolderName[MAX_PATH];
36 int iPos;
37
38 GetCsidlDisplayName(CSIDL_CONTROLS, szFolderName, SIZEOF_ARRAY(szFolderName), SHGDN_INFOLDER);
39 iPos = static_cast<int>(SendMessage(hComboBox, CB_INSERTSTRING, static_cast<WPARAM>(-1),
40 reinterpret_cast<LPARAM>(szFolderName)));
41 m_FolderMap.insert(
42 std::unordered_map<int, FolderType>::value_type(iPos, FolderType::ControlPanel));
43
44 LoadString(GetInstance(), IDS_DEFAULTCOLUMNS_GENERAL, szFolderName, SIZEOF_ARRAY(szFolderName));
45 iPos = static_cast<int>(SendMessage(hComboBox, CB_INSERTSTRING, static_cast<WPARAM>(-1),
46 reinterpret_cast<LPARAM>(szFolderName)));
47 m_FolderMap.insert(std::unordered_map<int, FolderType>::value_type(iPos, FolderType::General));
48
49 GetCsidlDisplayName(CSIDL_DRIVES, szFolderName, SIZEOF_ARRAY(szFolderName), SHGDN_INFOLDER);
50 iPos = static_cast<int>(SendMessage(hComboBox, CB_INSERTSTRING, static_cast<WPARAM>(-1),
51 reinterpret_cast<LPARAM>(szFolderName)));
52 m_FolderMap.insert(std::unordered_map<int, FolderType>::value_type(iPos, FolderType::Computer));
53
54 GetCsidlDisplayName(
55 CSIDL_CONNECTIONS, szFolderName, SIZEOF_ARRAY(szFolderName), SHGDN_INFOLDER);
56 iPos = static_cast<int>(SendMessage(hComboBox, CB_INSERTSTRING, static_cast<WPARAM>(-1),
57 reinterpret_cast<LPARAM>(szFolderName)));
58 m_FolderMap.insert(std::unordered_map<int, FolderType>::value_type(iPos, FolderType::Network));
59
60 GetCsidlDisplayName(CSIDL_NETWORK, szFolderName, SIZEOF_ARRAY(szFolderName), SHGDN_INFOLDER);
61 iPos = static_cast<int>(SendMessage(hComboBox, CB_INSERTSTRING, static_cast<WPARAM>(-1),
62 reinterpret_cast<LPARAM>(szFolderName)));
63 m_FolderMap.insert(
64 std::unordered_map<int, FolderType>::value_type(iPos, FolderType::NetworkPlaces));
65
66 GetCsidlDisplayName(CSIDL_PRINTERS, szFolderName, SIZEOF_ARRAY(szFolderName), SHGDN_INFOLDER);
67 iPos = static_cast<int>(SendMessage(hComboBox, CB_INSERTSTRING, static_cast<WPARAM>(-1),
68 reinterpret_cast<LPARAM>(szFolderName)));
69 m_FolderMap.insert(std::unordered_map<int, FolderType>::value_type(iPos, FolderType::Printers));
70
71 GetCsidlDisplayName(CSIDL_BITBUCKET, szFolderName, SIZEOF_ARRAY(szFolderName), SHGDN_INFOLDER);
72 iPos = static_cast<int>(SendMessage(hComboBox, CB_INSERTSTRING, static_cast<WPARAM>(-1),
73 reinterpret_cast<LPARAM>(szFolderName)));
74 m_FolderMap.insert(
75 std::unordered_map<int, FolderType>::value_type(iPos, FolderType::RecycleBin));
76
77 auto folderType = m_psdcdps->m_FolderType;
78 auto itr = std::find_if(m_FolderMap.begin(), m_FolderMap.end(),
79 [folderType](const std::unordered_map<int, FolderType>::value_type &vt) {
80 return vt.second == folderType;
81 });
82 SendMessage(hComboBox, CB_SETCURSEL, itr->first, 0);
83
84 m_PreviousFolderType = m_psdcdps->m_FolderType;
85

Callers

nothing calls this directly

Calls 8

GetCsidlDisplayNameFunction · 0.85
LoadStringFunction · 0.85
resetMethod · 0.80
RestoreDialogPositionMethod · 0.80
getMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected