@@ -151,9 +151,8 @@ DoLoadIcons(HWND hwndDlg, PPICK_ICON_CONTEXT pIconContext, LPCWSTR pszFile)
151151 }
152152 }
153153
154- // Set the text and reset the edit control's modification flag
155154 SetDlgItemTextW (hwndDlg, IDC_EDIT_PATH, pIconContext->szPath );
156- SendDlgItemMessage (hwndDlg, IDC_EDIT_PATH, EM_SETMODIFY, FALSE , 0 );
155+ SendMessageW (pIconContext-> hDlgCtrl , LB_SETCURSEL, 0 , 0 );
157156
158157 if (pIconContext->nIcons == 0 )
159158 {
@@ -194,9 +193,7 @@ INT_PTR CALLBACK PickIconProc(
194193 HICON hIcon;
195194 INT index, count;
196195 WCHAR szText[MAX_PATH], szFilter[100 ];
197- CStringW strTitle;
198196 OPENFILENAMEW ofn;
199-
200197 PPICK_ICON_CONTEXT pIconContext = (PPICK_ICON_CONTEXT)GetWindowLongPtr (hwndDlg, DWLP_USER);
201198
202199 switch (uMsg)
@@ -251,18 +248,11 @@ INT_PTR CALLBACK PickIconProc(
251248 case IDOK:
252249 {
253250 /* Check whether the path edit control has been modified; if so load the icons instead of validating */
254- if (SendDlgItemMessage (hwndDlg, IDC_EDIT_PATH, EM_GETMODIFY, 0 , 0 ))
251+ GetDlgItemTextW (hwndDlg, IDC_EDIT_PATH, szText, _countof (szText));
252+ if (lstrcmpiW (szText, pIconContext->szPath ))
255253 {
256- /* Reset the edit control's modification flag and retrieve the text */
257- SendDlgItemMessage (hwndDlg, IDC_EDIT_PATH, EM_SETMODIFY, FALSE , 0 );
258- GetDlgItemTextW (hwndDlg, IDC_EDIT_PATH, szText, _countof (szText));
259-
260- // Load the icons
261254 if (!DoLoadIcons (hwndDlg, pIconContext, szText))
262255 NoIconsInFile (hwndDlg, pIconContext);
263-
264- // Set the selection
265- SendMessageW (pIconContext->hDlgCtrl , LB_SETCURSEL, 0 , 0 );
266256 break ;
267257 }
268258
@@ -293,6 +283,7 @@ INT_PTR CALLBACK PickIconProc(
293283 case IDC_BUTTON_PATH:
294284 {
295285 // Choose the module path
286+ CStringW strTitle;
296287 szText[0 ] = 0 ;
297288 szFilter[0 ] = 0 ;
298289 ZeroMemory (&ofn, sizeof (ofn));
@@ -310,9 +301,6 @@ INT_PTR CALLBACK PickIconProc(
310301 // Load the icons
311302 if (!DoLoadIcons (hwndDlg, pIconContext, szText))
312303 NoIconsInFile (hwndDlg, pIconContext);
313-
314- // Set the selection
315- SendMessageW (pIconContext->hDlgCtrl , LB_SETCURSEL, 0 , 0 );
316304 break ;
317305 }
318306
@@ -331,8 +319,9 @@ INT_PTR CALLBACK PickIconProc(
331319 lpdis = (LPDRAWITEMSTRUCT)lParam;
332320 if (lpdis->itemID == (UINT)-1 )
333321 break ;
334- switch (lpdis->itemAction )
322+ switch (lpdis->itemAction ) // FIXME: MSDN says that more than one of these can be set
335323 {
324+ // FIXME: ODA_FOCUS
336325 case ODA_SELECT:
337326 case ODA_DRAWENTIRE:
338327 {
0 commit comments