[SHELLFIND] Remove unnecessary data member for focus
[reactos.git] / dll / win32 / browseui / shellfind / CSearchBar.cpp
1 /*
2 * ReactOS Explorer
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 #include "CSearchBar.h"
20 #include <psdk/wingdi.h>
21 #include <commoncontrols.h>
22 #include <../browseui.h>
23 #include <shellapi.h>
24 #include <exdispid.h>
25
26 WINE_DEFAULT_DEBUG_CHANNEL(shellfind);
27
28 #if 1
29 #undef UNIMPLEMENTED
30
31 #define UNIMPLEMENTED DbgPrint("%s is UNIMPLEMENTED!\n", __FUNCTION__)
32 #endif
33
34 CSearchBar::CSearchBar() :
35 pSite(NULL),
36 fVisible(FALSE)
37 {
38 }
39
40 CSearchBar::~CSearchBar()
41 {
42 }
43
44 LRESULT CSearchBar::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
45 {
46 SetSearchInProgress(FALSE);
47
48 HWND hCombobox = GetDlgItem(IDC_SEARCH_COMBOBOX);
49 IImageList *pImageList;
50 HRESULT hResult = SHGetImageList(SHIL_SMALL, IID_PPV_ARG(IImageList, &pImageList));
51 SendMessage(hCombobox, CBEM_SETIMAGELIST, 0, FAILED_UNEXPECTEDLY(hResult) ? 0 : reinterpret_cast<LPARAM>(pImageList));
52
53 SendMessage(hCombobox, CBEM_SETEXTENDEDSTYLE,
54 CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
55 HWND hEditControl = reinterpret_cast<HWND>(SendMessage(hCombobox, CBEM_GETEDITCONTROL, 0, 0));
56 hResult = CAddressEditBox_CreateInstance(IID_PPV_ARG(IAddressEditBox, &m_AddressEditBox));
57 if (FAILED_UNEXPECTEDLY(hResult))
58 return hResult;
59
60 CComPtr<IShellService> pShellService;
61 hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &pShellService));
62 if (FAILED_UNEXPECTEDLY(hResult))
63 return hResult;
64 hResult = fAddressEditBox->Init(hCombobox, fEditControl, 0, pSite);
65 if (FAILED_UNEXPECTEDLY(hResult))
66 return hResult;
67
68 CComPtr<IDispatch> pDispatch;
69 hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IDispatch, &pDispatch));
70 if (FAILED_UNEXPECTEDLY(hResult))
71 return hResult;
72 DISPPARAMS params = {0};
73 hResult = pDispatch->Invoke(DISPID_NAVIGATECOMPLETE2, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
74
75 hResult = pShellService->SetOwner(NULL);
76 if (FAILED_UNEXPECTEDLY(hResult))
77 return hResult;
78
79 return 0;
80 }
81
82 HRESULT CSearchBar::ExecuteCommand(CComPtr<IContextMenu>& menu, UINT nCmd)
83 {
84 CComPtr<IOleWindow> pBrowserOleWnd;
85 CMINVOKECOMMANDINFO cmi;
86 HWND browserWnd;
87 HRESULT hr;
88
89 hr = IUnknown_QueryService(pSite, SID_SShellBrowser, IID_PPV_ARG(IOleWindow, &pBrowserOleWnd));
90 if (FAILED_UNEXPECTEDLY(hr))
91 return hr;
92
93 hr = pBrowserOleWnd->GetWindow(&browserWnd);
94 if (FAILED_UNEXPECTEDLY(hr))
95 return hr;
96
97 ZeroMemory(&cmi, sizeof(cmi));
98 cmi.cbSize = sizeof(cmi);
99 cmi.lpVerb = MAKEINTRESOURCEA(nCmd);
100 cmi.hwnd = browserWnd;
101 if (GetKeyState(VK_SHIFT) & 0x8000)
102 cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
103 if (GetKeyState(VK_CONTROL) & 0x8000)
104 cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
105
106 return menu->InvokeCommand(&cmi);
107 }
108
109
110 // *** ATL event handlers ***
111 LRESULT CSearchBar::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
112 {
113 IUnknown_OnFocusChangeIS(pSite, reinterpret_cast<IUnknown*>(this), TRUE);
114 bHandled = FALSE;
115 return TRUE;
116 }
117
118 HRESULT CSearchBar::GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder)
119 {
120 HRESULT hr;
121 CComPtr<IShellBrowser> pShellBrowser;
122 if (!ppShellBrowser)
123 ppShellBrowser = &pShellBrowser;
124 if (!*ppShellBrowser)
125 {
126 hr = IUnknown_QueryService(m_pSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, ppShellBrowser));
127 if (FAILED_UNEXPECTEDLY(hr))
128 return hr;
129 }
130
131 CComPtr<IShellView> pShellView;
132 hr = (*ppShellBrowser)->QueryActiveShellView(&pShellView);
133 if (FAILED(hr) || !pShellView)
134 return hr;
135
136 CComPtr<IFolderView> pFolderView;
137 hr = pShellView->QueryInterface(IID_PPV_ARG(IFolderView, &pFolderView));
138 if (FAILED(hr) || !pFolderView)
139 return hr;
140
141 CComPtr<IShellFolder> pShellFolder;
142 if (!ppShellFolder)
143 ppShellFolder = &pShellFolder;
144 hr = pFolderView->GetFolder(IID_PPV_ARG(IShellFolder, ppShellFolder));
145 if (FAILED(hr) || !pShellFolder)
146 return hr;
147
148 CLSID clsid;
149 hr = IUnknown_GetClassID(*ppShellFolder, &clsid);
150 if (FAILED(hr))
151 return hr;
152 if (clsid != CLSID_FindFolder)
153 return E_FAIL;
154
155 if (pHwnd)
156 {
157 hr = pShellView->GetWindow(pHwnd);
158 if (FAILED_UNEXPECTEDLY(hr))
159 return hr;
160 }
161
162 return S_OK;
163 }
164
165 LRESULT CSearchBar::OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
166 {
167 CComHeapPtr<SearchStart> pSearchStart((SearchStart *)SHAlloc(sizeof(SearchStart)));
168 GetDlgItemText(IDC_SEARCH_FILENAME, pSearchStart->szFileName, _countof(pSearchStart->szFileName));
169 GetDlgItemText(IDC_SEARCH_QUERY, pSearchStart->szQuery, _countof(pSearchStart->szQuery));
170 if (!GetAddressEditBoxPath(pSearchStart->szPath))
171 {
172 ShellMessageBoxW(_AtlBaseModule.GetResourceInstance(), m_hWnd, MAKEINTRESOURCEW(IDS_SEARCHINVALID), MAKEINTRESOURCEW(IDS_SEARCHLABEL), MB_OK | MB_ICONERROR, pSearchStart->szPath);
173 return TRUE;
174 }
175
176 CComPtr<IShellBrowser> pShellBrowser;
177 HRESULT hr = IUnknown_QueryService(pSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pShellBrowser));
178 if (FAILED_UNEXPECTEDLY(hr))
179 return hr;
180
181 HWND hwnd;
182 if (FAILED(GetSearchResultsFolder(&pShellBrowser, &hwnd, NULL)))
183 {
184 // Open a new search results folder
185 WCHAR szShellGuid[MAX_PATH];
186 const WCHAR shellGuidPrefix[] = L"shell:::";
187 memcpy(szShellGuid, shellGuidPrefix, sizeof(shellGuidPrefix));
188 hr = StringFromGUID2(CLSID_FindFolder, szShellGuid + _countof(shellGuidPrefix) - 1,
189 _countof(szShellGuid) - _countof(shellGuidPrefix));
190 if (FAILED_UNEXPECTEDLY(hr))
191 return hr;
192
193 CComHeapPtr<ITEMIDLIST> findFolderPidl;
194 hr = SHParseDisplayName(szShellGuid, NULL, &findFolderPidl, 0, NULL);
195 if (FAILED_UNEXPECTEDLY(hr))
196 return hr;
197
198 hr = pShellBrowser->BrowseObject(findFolderPidl, 0);
199 if (FAILED_UNEXPECTEDLY(hr))
200 return hr;
201
202 CComPtr<IShellFolder> pShellFolder;
203 hr = GetSearchResultsFolder(*pShellBrowser, &hwnd, &pShellFolder);
204 if (FAILED_UNEXPECTEDLY(hr))
205 return hr;
206
207 // Subscribe to search events
208 DWORD fAdviseCookie;
209 hr = AtlAdvise(pShellFolder, static_cast<IDispatch *>(this), DIID_DSearchCommandEvents, &fAdviseCookie);
210 if (FAILED_UNEXPECTEDLY(hr))
211 return hr;
212 }
213
214 ::PostMessageW(hwnd, WM_SEARCH_START, 0, (LPARAM) pSearchStart.Detach());
215
216 SetSearchInProgress(TRUE);
217
218 return TRUE;
219 }
220
221 LRESULT CSearchBar::OnStopButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
222 {
223 HWND hwnd;
224 HRESULT hr = GetSearchResultsFolder(NULL, &hwnd, NULL);
225 if (SUCCEEDED(hr))
226 ::PostMessageW(hwnd, WM_SEARCH_STOP, 0, 0);
227
228 return TRUE;
229 }
230
231 BOOL CSearchBar::GetAddressEditBoxPath(WCHAR (&szPath)[MAX_PATH])
232 {
233 HWND hComboboxEx = GetDlgItem(IDC_SEARCH_COMBOBOX);
234 ::GetWindowTextW(hComboboxEx, szPath, _countof(szPath));
235 INT iSelectedIndex = SendMessageW(hComboboxEx, CB_GETCURSEL, 0, 0);
236 if (iSelectedIndex != CB_ERR)
237 {
238 WCHAR szItemText[MAX_PATH];
239 COMBOBOXEXITEMW item = {0};
240 item.mask = CBEIF_LPARAM | CBEIF_TEXT;
241 item.iItem = iSelectedIndex;
242 item.pszText = szItemText;
243 item.cchTextMax = _countof(szItemText);
244 SendMessageW(hComboboxEx, CBEM_GETITEMW, 0, (LPARAM)&item);
245
246 if (!wcscmp(szItemText, szPath) && SHGetPathFromIDListW((LPCITEMIDLIST)item.lParam, szPath))
247 {
248 return TRUE;
249 }
250 }
251
252 DWORD dwAttributes = GetFileAttributesW(szPath);
253 return dwAttributes != INVALID_FILE_ATTRIBUTES
254 && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY);
255 }
256
257 LRESULT CSearchBar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
258 {
259 INT iWidth = LOWORD(lParam);
260 INT iPadding = 10;
261
262 ((CWindow)GetDlgItem(IDC_SEARCH_LABEL)).SetWindowPos(NULL, 0, 0, iWidth - iPadding, 40, SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);
263
264 HWND inputs[] = { GetDlgItem(IDC_SEARCH_FILENAME), GetDlgItem(IDC_SEARCH_QUERY), GetDlgItem(IDC_SEARCH_COMBOBOX), GetDlgItem(IDC_SEARCH_BUTTON), GetDlgItem(IDC_SEARCH_STOP_BUTTON), GetDlgItem(IDC_PROGRESS_BAR) };
265 for (SIZE_T i = 0; i < _countof(inputs); i++)
266 {
267 CWindow wFileName = (CWindow) inputs[i];
268 RECT rect;
269 wFileName.GetWindowRect(&rect);
270 POINT pt = { rect.left, rect.top };
271 ScreenToClient(&pt);
272 wFileName.MoveWindow(iPadding, pt.y, iWidth - iPadding * 2, rect.bottom - rect.top);
273 }
274
275 return 0;
276 }
277
278
279 // *** IOleWindow methods ***
280 HRESULT STDMETHODCALLTYPE CSearchBar::GetWindow(HWND *lphwnd)
281 {
282 if (!lphwnd)
283 return E_INVALIDARG;
284 *lphwnd = m_hWnd;
285 return S_OK;
286 }
287
288 HRESULT STDMETHODCALLTYPE CSearchBar::ContextSensitiveHelp(BOOL fEnterMode)
289 {
290 UNIMPLEMENTED;
291 return E_NOTIMPL;
292 }
293
294
295 // *** IDockingWindow methods ***
296 HRESULT STDMETHODCALLTYPE CSearchBar::CloseDW(DWORD dwReserved)
297 {
298 // We do nothing, we don't have anything to save yet
299 TRACE("CloseDW called\n");
300 return S_OK;
301 }
302
303 HRESULT STDMETHODCALLTYPE CSearchBar::ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
304 {
305 /* Must return E_NOTIMPL according to MSDN */
306 return E_NOTIMPL;
307 }
308
309 HRESULT STDMETHODCALLTYPE CSearchBar::ShowDW(BOOL fShow)
310 {
311 fVisible = fShow;
312 ShowWindow(fShow);
313 return S_OK;
314 }
315
316
317 // *** IDeskBand methods ***
318 HRESULT STDMETHODCALLTYPE CSearchBar::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
319 {
320 if (!pdbi)
321 {
322 return E_INVALIDARG;
323 }
324
325 if (pdbi->dwMask & DBIM_MINSIZE)
326 {
327 pdbi->ptMinSize.x = 200;
328 pdbi->ptMinSize.y = 30;
329 }
330
331 if (pdbi->dwMask & DBIM_MAXSIZE)
332 {
333 pdbi->ptMaxSize.y = -1;
334 }
335
336 if (pdbi->dwMask & DBIM_INTEGRAL)
337 {
338 pdbi->ptIntegral.y = 1;
339 }
340
341 if (pdbi->dwMask & DBIM_ACTUAL)
342 {
343 pdbi->ptActual.x = 200;
344 pdbi->ptActual.y = 30;
345 }
346
347 if (pdbi->dwMask & DBIM_TITLE)
348 {
349 if (!LoadStringW(_AtlBaseModule.GetResourceInstance(), IDS_SEARCHLABEL, pdbi->wszTitle, _countof(pdbi->wszTitle)))
350 return HRESULT_FROM_WIN32(GetLastError());
351 }
352
353 if (pdbi->dwMask & DBIM_MODEFLAGS)
354 {
355 pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
356 }
357
358 if (pdbi->dwMask & DBIM_BKCOLOR)
359 {
360 pdbi->dwMask &= ~DBIM_BKCOLOR;
361 }
362 return S_OK;
363 }
364
365 LRESULT CALLBACK MyWindowProc(
366 _In_ HWND hwnd,
367 _In_ UINT uMsg,
368 _In_ WPARAM wParam,
369 _In_ LPARAM lParam
370 )
371 {
372 return 0;
373 }
374
375 // *** IObjectWithSite methods ***
376 HRESULT STDMETHODCALLTYPE CSearchBar::SetSite(IUnknown *pUnkSite)
377 {
378 HRESULT hr;
379 HWND parentWnd;
380
381 if (pUnkSite == pSite)
382 return S_OK;
383
384 TRACE("SetSite called \n");
385 if (!pUnkSite)
386 {
387 DestroyWindow();
388 m_hWnd = NULL;
389 }
390
391 if (pUnkSite != pSite)
392 {
393 pSite = NULL;
394 }
395
396 if(!pUnkSite)
397 return S_OK;
398
399 hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
400 if (!SUCCEEDED(hr))
401 {
402 ERR("Could not get parent's window ! Status: %08lx\n", hr);
403 return E_INVALIDARG;
404 }
405
406 pSite = pUnkSite;
407
408 if (m_hWnd)
409 {
410 // Change its parent
411 SetParent(parentWnd);
412 }
413 else
414 {
415 CDialogImpl::Create(parentWnd);
416
417 }
418 return S_OK;
419 }
420
421 HRESULT STDMETHODCALLTYPE CSearchBar::GetSite(REFIID riid, void **ppvSite)
422 {
423 if (!ppvSite)
424 return E_POINTER;
425 *ppvSite = pSite;
426 return S_OK;
427 }
428
429
430 // *** IOleCommandTarget methods ***
431 HRESULT STDMETHODCALLTYPE CSearchBar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
432 {
433 UNIMPLEMENTED;
434 return E_NOTIMPL;
435 }
436
437 HRESULT STDMETHODCALLTYPE CSearchBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
438 {
439 UNIMPLEMENTED;
440 return E_NOTIMPL;
441 }
442
443
444 // *** IServiceProvider methods ***
445 HRESULT STDMETHODCALLTYPE CSearchBar::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
446 {
447 /* FIXME: we probably want to handle more services here */
448 return IUnknown_QueryService(pSite, SID_SShellBrowser, riid, ppvObject);
449 }
450
451
452 // *** IInputObject methods ***
453 HRESULT STDMETHODCALLTYPE CSearchBar::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
454 {
455 if (fActivate)
456 {
457 //SetFocus();
458 SetActiveWindow();
459 }
460 // TODO: handle message
461 if(lpMsg)
462 {
463 TranslateMessage(lpMsg);
464 DispatchMessage(lpMsg);
465 }
466 return S_OK;
467 }
468
469 HRESULT STDMETHODCALLTYPE CSearchBar::HasFocusIO()
470 {
471 return S_OK;
472 }
473
474 HRESULT STDMETHODCALLTYPE CSearchBar::TranslateAcceleratorIO(LPMSG lpMsg)
475 {
476 if (IsDialogMessage(lpMsg))
477 return S_OK;
478
479 if ((lpMsg->hwnd == m_hWnd || IsChild(lpMsg->hwnd)))
480 {
481 TranslateMessage(lpMsg);
482 DispatchMessage(lpMsg);
483 return S_OK;
484 }
485
486 return S_FALSE;
487 }
488
489 // *** IPersist methods ***
490 HRESULT STDMETHODCALLTYPE CSearchBar::GetClassID(CLSID *pClassID)
491 {
492 if (!pClassID)
493 return E_POINTER;
494 memcpy(pClassID, &CLSID_FileSearchBand, sizeof(CLSID));
495 return S_OK;
496 }
497
498
499 // *** IPersistStream methods ***
500 HRESULT STDMETHODCALLTYPE CSearchBar::IsDirty()
501 {
502 UNIMPLEMENTED;
503 return E_NOTIMPL;
504 }
505
506 HRESULT STDMETHODCALLTYPE CSearchBar::Load(IStream *pStm)
507 {
508 UNIMPLEMENTED;
509 return E_NOTIMPL;
510 }
511
512 HRESULT STDMETHODCALLTYPE CSearchBar::Save(IStream *pStm, BOOL fClearDirty)
513 {
514 UNIMPLEMENTED;
515 return E_NOTIMPL;
516 }
517
518 HRESULT STDMETHODCALLTYPE CSearchBar::GetSizeMax(ULARGE_INTEGER *pcbSize)
519 {
520 // TODO: calculate max size
521 UNIMPLEMENTED;
522 return E_NOTIMPL;
523 }
524
525
526 // *** IWinEventHandler methods ***
527 HRESULT STDMETHODCALLTYPE CSearchBar::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
528 {
529 return S_OK;
530 }
531
532 HRESULT STDMETHODCALLTYPE CSearchBar::IsWindowOwner(HWND hWnd)
533 {
534 return (hWnd == m_hWnd) ? S_OK : S_FALSE;
535 }
536
537 // *** IBandNavigate methods ***
538 HRESULT STDMETHODCALLTYPE CSearchBar::Select(long paramC)
539 {
540 UNIMPLEMENTED;
541 return E_NOTIMPL;
542 }
543
544 // *** INamespaceProxy ***
545 HRESULT STDMETHODCALLTYPE CSearchBar::GetNavigateTarget(long paramC, long param10, long param14)
546 {
547 UNIMPLEMENTED;
548 return E_NOTIMPL;
549 }
550
551 HRESULT STDMETHODCALLTYPE CSearchBar::Invoke(long paramC)
552 {
553 UNIMPLEMENTED;
554 return E_NOTIMPL;
555 }
556
557 HRESULT STDMETHODCALLTYPE CSearchBar::OnSelectionChanged(long paramC)
558 {
559 UNIMPLEMENTED;
560 return E_NOTIMPL;
561 }
562
563 HRESULT STDMETHODCALLTYPE CSearchBar::RefreshFlags(long paramC, long param10, long param14)
564 {
565 UNIMPLEMENTED;
566 return E_NOTIMPL;
567 }
568
569 HRESULT STDMETHODCALLTYPE CSearchBar::CacheItem(long paramC)
570 {
571 UNIMPLEMENTED;
572 return E_NOTIMPL;
573 }
574
575 // *** IDispatch methods ***
576 HRESULT STDMETHODCALLTYPE CSearchBar::GetTypeInfoCount(UINT *pctinfo)
577 {
578 UNIMPLEMENTED;
579 return E_NOTIMPL;
580 }
581
582 HRESULT STDMETHODCALLTYPE CSearchBar::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
583 {
584 UNIMPLEMENTED;
585 return E_NOTIMPL;
586 }
587
588 HRESULT STDMETHODCALLTYPE CSearchBar::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
589 {
590 UNIMPLEMENTED;
591 return E_NOTIMPL;
592 }
593
594 void CSearchBar::SetSearchInProgress(BOOL bInProgress)
595 {
596 ::ShowWindow(GetDlgItem(IDC_SEARCH_BUTTON), bInProgress ? SW_HIDE : SW_SHOW);
597 ::ShowWindow(GetDlgItem(IDC_SEARCH_STOP_BUTTON), bInProgress ? SW_SHOW : SW_HIDE);
598 HWND hProgressBar = GetDlgItem(IDC_PROGRESS_BAR);
599 ::ShowWindow(hProgressBar, bInProgress ? SW_SHOW : SW_HIDE);
600 ::PostMessage(hProgressBar, PBM_SETMARQUEE, bInProgress, 0);
601 }
602
603 HRESULT STDMETHODCALLTYPE CSearchBar::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
604 {
605 if (dispIdMember == DISPID_SEARCHCOMPLETE || dispIdMember == DISPID_SEARCHABORT)
606 {
607 SetSearchInProgress(FALSE);
608 return S_OK;
609 }
610 return E_INVALIDARG;
611 }