New debug scheme with explicit debug channels declaration.
[wine.git] / dlls / commdlg / finddlg.c
blob19e9e3f773a96ce5df8443302437ab5e68de5f6d
1 /*
2 * COMMDLG - Find & Replace Text Dialogs
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
6 */
8 #include <ctype.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include "winbase.h"
12 #include "wine/winbase16.h"
13 #include "wine/winuser16.h"
14 #include "win.h"
15 #include "message.h"
16 #include "commdlg.h"
17 #include "resource.h"
18 #include "dialog.h"
19 #include "dlgs.h"
20 #include "module.h"
21 #include "debug.h"
22 #include "winproc.h"
24 DEFAULT_DEBUG_CHANNEL(commdlg)
27 /***********************************************************************
28 * FindText16 (COMMDLG.11)
30 HWND16 WINAPI FindText16( SEGPTR find )
32 HANDLE16 hInst;
33 LPCVOID ptr;
34 LPFINDREPLACE16 lpFind = (LPFINDREPLACE16)PTR_SEG_TO_LIN(find);
37 * FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here
38 * For now, only the standard dialog works.
40 if (lpFind->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE |
41 FR_ENABLEHOOK)) FIXME(commdlg, ": unimplemented flag (ignored)\n");
42 ptr = SYSRES_GetResPtr( SYSRES_DIALOG_FIND_TEXT );
43 hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
44 return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
45 (DLGPROC16)MODULE_GetWndProcEntry16("FindTextDlgProc"),
46 find, WIN_PROC_16 );
49 /***********************************************************************
50 * FindText32A (COMMDLG.6)
52 HWND WINAPI FindTextA( LPFINDREPLACEA lpFind )
54 HANDLE16 hInst;
55 LPCVOID ptr;
58 * FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here
59 * For now, only the standard dialog works.
61 if (lpFind->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE |
62 FR_ENABLEHOOK)) FIXME(commdlg, ": unimplemented flag (ignored)\n");
63 ptr = SYSRES_GetResPtr( SYSRES_DIALOG_FIND_TEXT );
64 hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
65 return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
66 (DLGPROC16)FindTextDlgProcA, (LPARAM)lpFind, WIN_PROC_32A );
69 /***********************************************************************
70 * FindText32W (COMMDLG.7)
72 HWND WINAPI FindTextW( LPFINDREPLACEW lpFind )
74 HANDLE16 hInst;
75 LPCVOID ptr;
78 * FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here
79 * For now, only the standard dialog works.
81 if (lpFind->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE |
82 FR_ENABLEHOOK)) FIXME(commdlg, ": unimplemented flag (ignored)\n");
83 ptr = SYSRES_GetResPtr( SYSRES_DIALOG_FIND_TEXT );
84 hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
85 return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
86 (DLGPROC16)FindTextDlgProcW, (LPARAM)lpFind, WIN_PROC_32W );
89 /***********************************************************************
90 * ReplaceText16 (COMMDLG.12)
92 HWND16 WINAPI ReplaceText16( SEGPTR find )
94 HANDLE16 hInst;
95 LPCVOID ptr;
96 LPFINDREPLACE16 lpFind = (LPFINDREPLACE16)PTR_SEG_TO_LIN(find);
99 * FIXME : We should do error checking on the lpFind structure here
100 * and make CommDlgExtendedError() return the error condition.
102 if (lpFind->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE |
103 FR_ENABLEHOOK)) FIXME(commdlg, ": unimplemented flag (ignored)\n");
104 ptr = SYSRES_GetResPtr( SYSRES_DIALOG_REPLACE_TEXT );
105 hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
106 return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
107 (DLGPROC16)MODULE_GetWndProcEntry16("ReplaceTextDlgProc"),
108 find, WIN_PROC_16 );
111 /***********************************************************************
112 * ReplaceText32A (COMDLG32.19)
114 HWND WINAPI ReplaceTextA( LPFINDREPLACEA lpFind )
116 HANDLE16 hInst;
117 LPCVOID ptr;
120 * FIXME : Should respond to FR_ENABLETEMPLATE and FR_ENABLEHOOK here
121 * For now, only the standard dialog works.
123 if (lpFind->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE |
124 FR_ENABLEHOOK)) FIXME(commdlg, ": unimplemented flag (ignored)\n");
125 ptr = SYSRES_GetResPtr( SYSRES_DIALOG_REPLACE_TEXT );
126 hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
127 return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
128 (DLGPROC16)ReplaceTextDlgProcA, (LPARAM)lpFind, WIN_PROC_32A );
131 /***********************************************************************
132 * ReplaceText32W (COMDLG32.20)
134 HWND WINAPI ReplaceTextW( LPFINDREPLACEW lpFind )
136 HANDLE16 hInst;
137 LPCVOID ptr;
140 * FIXME : We should do error checking on the lpFind structure here
141 * and make CommDlgExtendedError() return the error condition.
143 if (lpFind->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE |
144 FR_ENABLEHOOK)) FIXME(commdlg, ": unimplemented flag (ignored)\n");
145 ptr = SYSRES_GetResPtr( SYSRES_DIALOG_REPLACE_TEXT );
146 hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
147 return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
148 (DLGPROC16)ReplaceTextDlgProcW, (LPARAM)lpFind, WIN_PROC_32W );
152 /***********************************************************************
153 * FINDDLG_WMInitDialog [internal]
155 static LRESULT FINDDLG_WMInitDialog(HWND hWnd, LPARAM lParam, LPDWORD lpFlags,
156 LPSTR lpstrFindWhat, BOOL fUnicode)
158 SetWindowLongA(hWnd, DWL_USER, lParam);
159 *lpFlags &= ~(FR_FINDNEXT | FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM);
161 * FIXME : If the initial FindWhat string is empty, we should disable the
162 * FindNext (IDOK) button. Only after typing some text, the button should be
163 * enabled.
165 if (fUnicode) SetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat);
166 else SetDlgItemTextA(hWnd, edt1, lpstrFindWhat);
167 CheckRadioButton(hWnd, rad1, rad2, (*lpFlags & FR_DOWN) ? rad2 : rad1);
168 if (*lpFlags & (FR_HIDEUPDOWN | FR_NOUPDOWN)) {
169 EnableWindow(GetDlgItem(hWnd, rad1), FALSE);
170 EnableWindow(GetDlgItem(hWnd, rad2), FALSE);
172 if (*lpFlags & FR_HIDEUPDOWN) {
173 ShowWindow(GetDlgItem(hWnd, rad1), SW_HIDE);
174 ShowWindow(GetDlgItem(hWnd, rad2), SW_HIDE);
175 ShowWindow(GetDlgItem(hWnd, grp1), SW_HIDE);
177 CheckDlgButton(hWnd, chx1, (*lpFlags & FR_WHOLEWORD) ? 1 : 0);
178 if (*lpFlags & (FR_HIDEWHOLEWORD | FR_NOWHOLEWORD))
179 EnableWindow(GetDlgItem(hWnd, chx1), FALSE);
180 if (*lpFlags & FR_HIDEWHOLEWORD)
181 ShowWindow(GetDlgItem(hWnd, chx1), SW_HIDE);
182 CheckDlgButton(hWnd, chx2, (*lpFlags & FR_MATCHCASE) ? 1 : 0);
183 if (*lpFlags & (FR_HIDEMATCHCASE | FR_NOMATCHCASE))
184 EnableWindow(GetDlgItem(hWnd, chx2), FALSE);
185 if (*lpFlags & FR_HIDEMATCHCASE)
186 ShowWindow(GetDlgItem(hWnd, chx2), SW_HIDE);
187 if (!(*lpFlags & FR_SHOWHELP)) {
188 EnableWindow(GetDlgItem(hWnd, pshHelp), FALSE);
189 ShowWindow(GetDlgItem(hWnd, pshHelp), SW_HIDE);
191 ShowWindow(hWnd, SW_SHOWNORMAL);
192 return TRUE;
196 /***********************************************************************
197 * FINDDLG_WMCommand [internal]
199 static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam,
200 HWND hwndOwner, LPDWORD lpFlags,
201 LPSTR lpstrFindWhat, WORD wFindWhatLen,
202 BOOL fUnicode)
204 int uFindReplaceMessage = RegisterWindowMessageA( FINDMSGSTRING );
205 int uHelpMessage = RegisterWindowMessageA( HELPMSGSTRING );
207 switch (wParam) {
208 case IDOK:
209 if (fUnicode)
210 GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2);
211 else GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen);
212 if (IsDlgButtonChecked(hWnd, rad2))
213 *lpFlags |= FR_DOWN;
214 else *lpFlags &= ~FR_DOWN;
215 if (IsDlgButtonChecked(hWnd, chx1))
216 *lpFlags |= FR_WHOLEWORD;
217 else *lpFlags &= ~FR_WHOLEWORD;
218 if (IsDlgButtonChecked(hWnd, chx2))
219 *lpFlags |= FR_MATCHCASE;
220 else *lpFlags &= ~FR_MATCHCASE;
221 *lpFlags &= ~(FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM);
222 *lpFlags |= FR_FINDNEXT;
223 SendMessageA(hwndOwner, uFindReplaceMessage, 0,
224 GetWindowLongA(hWnd, DWL_USER) );
225 return TRUE;
226 case IDCANCEL:
227 *lpFlags &= ~(FR_FINDNEXT | FR_REPLACE | FR_REPLACEALL);
228 *lpFlags |= FR_DIALOGTERM;
229 SendMessageA(hwndOwner, uFindReplaceMessage, 0,
230 GetWindowLongA(hWnd, DWL_USER) );
231 DestroyWindow(hWnd);
232 return TRUE;
233 case pshHelp:
234 /* FIXME : should lpfr structure be passed as an argument ??? */
235 SendMessageA(hwndOwner, uHelpMessage, 0, 0);
236 return TRUE;
238 return FALSE;
242 /***********************************************************************
243 * FindTextDlgProc16 (COMMDLG.13)
245 LRESULT WINAPI FindTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
246 LPARAM lParam)
248 LPFINDREPLACE16 lpfr;
249 switch (wMsg) {
250 case WM_INITDIALOG:
251 lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(lParam);
252 return FINDDLG_WMInitDialog(hWnd, lParam, &(lpfr->Flags),
253 PTR_SEG_TO_LIN(lpfr->lpstrFindWhat), FALSE);
254 case WM_COMMAND:
255 lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(GetWindowLongA(hWnd, DWL_USER));
256 return FINDDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner,
257 &lpfr->Flags, PTR_SEG_TO_LIN(lpfr->lpstrFindWhat),
258 lpfr->wFindWhatLen, FALSE);
260 return FALSE;
263 /***********************************************************************
264 * FindTextDlgProc32A
266 LRESULT WINAPI FindTextDlgProcA(HWND hWnd, UINT wMsg, WPARAM wParam,
267 LPARAM lParam)
269 LPFINDREPLACEA lpfr;
270 switch (wMsg) {
271 case WM_INITDIALOG:
272 lpfr=(LPFINDREPLACEA)lParam;
273 return FINDDLG_WMInitDialog(hWnd, lParam, &(lpfr->Flags),
274 lpfr->lpstrFindWhat, FALSE);
275 case WM_COMMAND:
276 lpfr=(LPFINDREPLACEA)GetWindowLongA(hWnd, DWL_USER);
277 return FINDDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner,
278 &lpfr->Flags, lpfr->lpstrFindWhat, lpfr->wFindWhatLen,
279 FALSE);
281 return FALSE;
284 /***********************************************************************
285 * FindTextDlgProc32W
287 LRESULT WINAPI FindTextDlgProcW(HWND hWnd, UINT wMsg, WPARAM wParam,
288 LPARAM lParam)
290 LPFINDREPLACEW lpfr;
291 switch (wMsg) {
292 case WM_INITDIALOG:
293 lpfr=(LPFINDREPLACEW)lParam;
294 return FINDDLG_WMInitDialog(hWnd, lParam, &(lpfr->Flags),
295 (LPSTR)lpfr->lpstrFindWhat, TRUE);
296 case WM_COMMAND:
297 lpfr=(LPFINDREPLACEW)GetWindowLongA(hWnd, DWL_USER);
298 return FINDDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner,
299 &lpfr->Flags, (LPSTR)lpfr->lpstrFindWhat, lpfr->wFindWhatLen,
300 TRUE);
302 return FALSE;
306 /***********************************************************************
307 * REPLACEDLG_WMInitDialog [internal]
309 static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, LPARAM lParam,
310 LPDWORD lpFlags, LPSTR lpstrFindWhat,
311 LPSTR lpstrReplaceWith, BOOL fUnicode)
313 SetWindowLongA(hWnd, DWL_USER, lParam);
314 *lpFlags &= ~(FR_FINDNEXT | FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM);
316 * FIXME : If the initial FindWhat string is empty, we should disable the FinNext /
317 * Replace / ReplaceAll buttons. Only after typing some text, the buttons should be
318 * enabled.
320 if (fUnicode)
322 SetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat);
323 SetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith);
324 } else
326 SetDlgItemTextA(hWnd, edt1, lpstrFindWhat);
327 SetDlgItemTextA(hWnd, edt2, lpstrReplaceWith);
329 CheckDlgButton(hWnd, chx1, (*lpFlags & FR_WHOLEWORD) ? 1 : 0);
330 if (*lpFlags & (FR_HIDEWHOLEWORD | FR_NOWHOLEWORD))
331 EnableWindow(GetDlgItem(hWnd, chx1), FALSE);
332 if (*lpFlags & FR_HIDEWHOLEWORD)
333 ShowWindow(GetDlgItem(hWnd, chx1), SW_HIDE);
334 CheckDlgButton(hWnd, chx2, (*lpFlags & FR_MATCHCASE) ? 1 : 0);
335 if (*lpFlags & (FR_HIDEMATCHCASE | FR_NOMATCHCASE))
336 EnableWindow(GetDlgItem(hWnd, chx2), FALSE);
337 if (*lpFlags & FR_HIDEMATCHCASE)
338 ShowWindow(GetDlgItem(hWnd, chx2), SW_HIDE);
339 if (!(*lpFlags & FR_SHOWHELP)) {
340 EnableWindow(GetDlgItem(hWnd, pshHelp), FALSE);
341 ShowWindow(GetDlgItem(hWnd, pshHelp), SW_HIDE);
343 ShowWindow(hWnd, SW_SHOWNORMAL);
344 return TRUE;
348 /***********************************************************************
349 * REPLACEDLG_WMCommand [internal]
351 static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM16 wParam,
352 HWND hwndOwner, LPDWORD lpFlags,
353 LPSTR lpstrFindWhat, WORD wFindWhatLen,
354 LPSTR lpstrReplaceWith, WORD wReplaceWithLen,
355 BOOL fUnicode)
357 int uFindReplaceMessage = RegisterWindowMessageA( FINDMSGSTRING );
358 int uHelpMessage = RegisterWindowMessageA( HELPMSGSTRING );
360 switch (wParam) {
361 case IDOK:
362 if (fUnicode)
364 GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2);
365 GetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith, wReplaceWithLen/2);
366 } else
368 GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen);
369 GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen);
371 if (IsDlgButtonChecked(hWnd, chx1))
372 *lpFlags |= FR_WHOLEWORD;
373 else *lpFlags &= ~FR_WHOLEWORD;
374 if (IsDlgButtonChecked(hWnd, chx2))
375 *lpFlags |= FR_MATCHCASE;
376 else *lpFlags &= ~FR_MATCHCASE;
377 *lpFlags &= ~(FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM);
378 *lpFlags |= FR_FINDNEXT;
379 SendMessageA(hwndOwner, uFindReplaceMessage, 0,
380 GetWindowLongA(hWnd, DWL_USER) );
381 return TRUE;
382 case IDCANCEL:
383 *lpFlags &= ~(FR_FINDNEXT | FR_REPLACE | FR_REPLACEALL);
384 *lpFlags |= FR_DIALOGTERM;
385 SendMessageA(hwndOwner, uFindReplaceMessage, 0,
386 GetWindowLongA(hWnd, DWL_USER) );
387 DestroyWindow(hWnd);
388 return TRUE;
389 case psh1:
390 if (fUnicode)
392 GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2);
393 GetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith, wReplaceWithLen/2);
394 } else
396 GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen);
397 GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen);
399 if (IsDlgButtonChecked(hWnd, chx1))
400 *lpFlags |= FR_WHOLEWORD;
401 else *lpFlags &= ~FR_WHOLEWORD;
402 if (IsDlgButtonChecked(hWnd, chx2))
403 *lpFlags |= FR_MATCHCASE;
404 else *lpFlags &= ~FR_MATCHCASE;
405 *lpFlags &= ~(FR_FINDNEXT | FR_REPLACEALL | FR_DIALOGTERM);
406 *lpFlags |= FR_REPLACE;
407 SendMessageA(hwndOwner, uFindReplaceMessage, 0,
408 GetWindowLongA(hWnd, DWL_USER) );
409 return TRUE;
410 case psh2:
411 if (fUnicode)
413 GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2);
414 GetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith, wReplaceWithLen/2);
415 } else
417 GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen);
418 GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen);
420 if (IsDlgButtonChecked(hWnd, chx1))
421 *lpFlags |= FR_WHOLEWORD;
422 else *lpFlags &= ~FR_WHOLEWORD;
423 if (IsDlgButtonChecked(hWnd, chx2))
424 *lpFlags |= FR_MATCHCASE;
425 else *lpFlags &= ~FR_MATCHCASE;
426 *lpFlags &= ~(FR_FINDNEXT | FR_REPLACE | FR_DIALOGTERM);
427 *lpFlags |= FR_REPLACEALL;
428 SendMessageA(hwndOwner, uFindReplaceMessage, 0,
429 GetWindowLongA(hWnd, DWL_USER) );
430 return TRUE;
431 case pshHelp:
432 /* FIXME : should lpfr structure be passed as an argument ??? */
433 SendMessageA(hwndOwner, uHelpMessage, 0, 0);
434 return TRUE;
436 return FALSE;
440 /***********************************************************************
441 * ReplaceTextDlgProc16 (COMMDLG.14)
443 LRESULT WINAPI ReplaceTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
444 LPARAM lParam)
446 LPFINDREPLACE16 lpfr;
447 switch (wMsg) {
448 case WM_INITDIALOG:
449 lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(lParam);
450 return REPLACEDLG_WMInitDialog(hWnd, lParam, &lpfr->Flags,
451 PTR_SEG_TO_LIN(lpfr->lpstrFindWhat),
452 PTR_SEG_TO_LIN(lpfr->lpstrReplaceWith), FALSE);
453 case WM_COMMAND:
454 lpfr=(LPFINDREPLACE16)PTR_SEG_TO_LIN(GetWindowLongA(hWnd, DWL_USER));
455 return REPLACEDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner,
456 &lpfr->Flags, PTR_SEG_TO_LIN(lpfr->lpstrFindWhat),
457 lpfr->wFindWhatLen, PTR_SEG_TO_LIN(lpfr->lpstrReplaceWith),
458 lpfr->wReplaceWithLen, FALSE);
460 return FALSE;
463 /***********************************************************************
464 * ReplaceTextDlgProc32A
466 LRESULT WINAPI ReplaceTextDlgProcA(HWND hWnd, UINT wMsg, WPARAM wParam,
467 LPARAM lParam)
469 LPFINDREPLACEA lpfr;
470 switch (wMsg) {
471 case WM_INITDIALOG:
472 lpfr=(LPFINDREPLACEA)lParam;
473 return REPLACEDLG_WMInitDialog(hWnd, lParam, &lpfr->Flags,
474 lpfr->lpstrFindWhat, lpfr->lpstrReplaceWith, FALSE);
475 case WM_COMMAND:
476 lpfr=(LPFINDREPLACEA)GetWindowLongA(hWnd, DWL_USER);
477 return REPLACEDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner,
478 &lpfr->Flags, lpfr->lpstrFindWhat, lpfr->wFindWhatLen,
479 lpfr->lpstrReplaceWith, lpfr->wReplaceWithLen, FALSE);
481 return FALSE;
484 /***********************************************************************
485 * ReplaceTextDlgProc32W
487 LRESULT WINAPI ReplaceTextDlgProcW(HWND hWnd, UINT wMsg, WPARAM wParam,
488 LPARAM lParam)
490 LPFINDREPLACEW lpfr;
491 switch (wMsg) {
492 case WM_INITDIALOG:
493 lpfr=(LPFINDREPLACEW)lParam;
494 return REPLACEDLG_WMInitDialog(hWnd, lParam, &lpfr->Flags,
495 (LPSTR)lpfr->lpstrFindWhat, (LPSTR)lpfr->lpstrReplaceWith,
496 TRUE);
497 case WM_COMMAND:
498 lpfr=(LPFINDREPLACEW)GetWindowLongA(hWnd, DWL_USER);
499 return REPLACEDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner,
500 &lpfr->Flags, (LPSTR)lpfr->lpstrFindWhat, lpfr->wFindWhatLen,
501 (LPSTR)lpfr->lpstrReplaceWith, lpfr->wReplaceWithLen, TRUE);
503 return FALSE;