@@ -67,37 +67,43 @@ void XgDictList_ReloadList(HWND hwnd)
67
67
INT iItem = 0 ;
68
68
for (auto & entry : xg_dicts) {
69
69
LV_ITEMW item = { LVIF_TEXT };
70
+
71
+ // リストビューに一行追加する。列「ファイル名」のテキストを設定。
70
72
item.pszText = const_cast <LPWSTR>(PathFindFileNameW (entry.m_filename .c_str ()));
71
73
item.iItem = iItem;
72
74
item.iSubItem = 0 ;
73
75
ListView_InsertItem (hwndLst1, &item);
74
76
77
+ // 列「表示名」のテキストを設定。
75
78
item.iItem = iItem;
76
79
item.iSubItem = 1 ;
77
80
item.pszText = const_cast <LPWSTR>(entry.m_friendly_name .c_str ());
78
81
ListView_SetItem (hwndLst1, &item);
79
82
83
+ // ファイルの更新日時を取得するために、FindFirstFile関数を使う。
80
84
WIN32_FIND_DATAW find;
81
85
HANDLE hFind = ::FindFirstFileW (entry.m_filename .c_str (), &find);
82
86
::FindClose (hFind);
83
87
88
+ // 更新日時に従って文字列を構築する。
84
89
WCHAR szText[32 ];
85
- item. iItem = iItem ;
86
- item. iSubItem = 2 ;
90
+ FILETIME ftLocal ;
91
+ SYSTEMTIME st ;
87
92
if (hFind == INVALID_HANDLE_VALUE)
88
93
{
89
94
StringCchCopyW (szText, _countof (szText), L" N/A" );
90
95
}
91
96
else
92
97
{
93
- FILETIME ftLocal;
94
98
::FileTimeToLocalFileTime (&find.ftLastWriteTime, &ftLocal);
95
- SYSTEMTIME st;
96
99
::FileTimeToSystemTime (&ftLocal, &st);
97
100
StringCchPrintfW (szText, _countof (szText), L" %04d-%02d-%02d %02d:%02d" ,
98
101
st.wYear , st.wMonth , st.wDay , st.wHour , st.wMinute );
99
- item.pszText = szText;
100
102
}
103
+
104
+ // 列「更新日時」のテキストを設定。
105
+ item.iItem = iItem;
106
+ item.iSubItem = 2 ;
101
107
item.pszText = szText;
102
108
ListView_SetItem (hwndLst1, &item);
103
109
@@ -171,17 +177,21 @@ XgDictListDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
171
177
ListView_SetExtendedListViewStyle (hwndLst1,
172
178
LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES);
173
179
174
- // 辞書リストのヘッダーを初期化 。
180
+ // 辞書リストのヘッダーの初期化を開始 。
175
181
LV_COLUMNW column = { LVCF_TEXT | LVCF_WIDTH };
182
+
183
+ // ファイル名。
176
184
column.pszText = XgLoadStringDx1 (IDS_FILENAME);
177
185
column.cx = 200 ;
178
186
ListView_InsertColumn (hwndLst1, 0 , &column);
179
187
188
+ // 表示名。
180
189
column.pszText = XgLoadStringDx1 (IDS_DISPLAYNAME);
181
190
column.cx = 250 ;
182
191
ListView_InsertColumn (hwndLst1, 1 , &column);
183
192
184
- column.pszText = XgLoadStringDx1 (IDS_UPDATEDDATE);
193
+ // 更新日時。
194
+ column.pszText = XgLoadStringDx1 (IDS_UPDATEDTIME);
185
195
column.cx = 125 ;
186
196
ListView_InsertColumn (hwndLst1, 2 , &column);
187
197
0 commit comments