ReactOS  0.4.14-dev-50-g13bb5e2
CSearchBar Class Reference

#include <CSearchBar.h>

Inheritance diagram for CSearchBar:
Collaboration diagram for CSearchBar:

Public Types

enum  { IDD = IDD_SEARCH_DLG }
 
- Public Types inherited from IOleWindow
typedef IOleWindowLPOLEWINDOW
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IObjectWithSite
typedef IObjectWithSiteLPOBJECTWITHSITE
 
- Public Types inherited from IPersistStream
typedef IPersistStreamLPPERSISTSTREAM
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Public Types inherited from IDispatch
typedef IDispatchLPDISPATCH
 
- Public Types inherited from ATL::CWindowImplRoot< CWindow >
enum  
 

Public Member Functions

 CSearchBar ()
 
VOID SetText (LPCWSTR lpszText)
 
HWND Create (HWND hwndParent)
 
 CSearchBar ()
 
virtual ~CSearchBar ()
 
virtual HRESULT STDMETHODCALLTYPE GetWindow (HWND *lphwnd)
 
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp (BOOL fEnterMode)
 
virtual HRESULT STDMETHODCALLTYPE CloseDW (DWORD dwReserved)
 
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW (const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
 
virtual HRESULT STDMETHODCALLTYPE ShowDW (BOOL fShow)
 
virtual HRESULT STDMETHODCALLTYPE GetBandInfo (DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
 
virtual HRESULT STDMETHODCALLTYPE SetSite (IUnknown *pUnkSite)
 
virtual HRESULT STDMETHODCALLTYPE GetSite (REFIID riid, void **ppvSite)
 
virtual HRESULT STDMETHODCALLTYPE UIActivateIO (BOOL fActivate, LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE HasFocusIO ()
 
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO (LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE GetClassID (CLSID *pClassID)
 
virtual HRESULT STDMETHODCALLTYPE IsDirty ()
 
virtual HRESULT STDMETHODCALLTYPE Load (IStream *pStm)
 
virtual HRESULT STDMETHODCALLTYPE Save (IStream *pStm, BOOL fClearDirty)
 
virtual HRESULT STDMETHODCALLTYPE GetSizeMax (ULARGE_INTEGER *pcbSize)
 
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount (UINT *pctinfo)
 
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo (UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
virtual HRESULT STDMETHODCALLTYPE Invoke (DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IDockingWindow
HRESULT ResizeBorderDW ([in] LPCRECT prcBorder, [in] IUnknown *punkToolbarSite, [in] BOOL fReserved)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from IObjectWithSite
HRESULT GetSite ([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
 
- Public Member Functions inherited from IDispatch
HRESULT RemoteInvoke ([in] DISPID dispIdMember, [in] REFIID riid, [in] LCID lcid, [in] DWORD dwFlags, [in] DISPPARAMS *pDispParams, [out] VARIANT *pVarResult, [out] EXCEPINFO *pExcepInfo, [out] UINT *pArgErr, [in] UINT cVarRef, [in, size_is(cVarRef)] UINT *rgVarRefIdx, [in, out, size_is(cVarRef)] VARIANTARG *rgVarRef)
 
- Public Member Functions inherited from ATL::CDialogImpl< CSearchBar >
HWND Create (HWND hWndParent, LPARAM dwInitParam=NULL)
 
INT_PTR DoModal (HWND hWndParent=::GetActiveWindow(), LPARAM dwInitParam=NULL)
 
BOOL EndDialog (_In_ int nRetCode)
 
BOOL DestroyWindow ()
 
- Public Member Functions inherited from ATL::CDialogImplBaseT< CWindow >
virtual ~CDialogImplBaseT ()
 
virtual DLGPROC GetDialogProc ()
 
virtual void OnFinalMessage (HWND)
 
- Public Member Functions inherited from ATL::CWindowImplRoot< CWindow >
 CWindowImplRoot ()
 
virtual ~CWindowImplRoot ()
 
- Public Member Functions inherited from ATL::CWindow
 CWindow (HWND hWnd=NULL)
 
 operator HWND () const
 
UINT ArrangeIconicWindows ()
 
void Attach (HWND hWndNew)
 
HDC BeginPaint (LPPAINTSTRUCT lpPaint)
 
BOOL BringWindowToTop ()
 
BOOL CenterWindow (HWND hWndCenter=NULL)
 
BOOL ChangeClipboardChain (HWND hWndNewNext)
 
BOOL CheckDlgButton (int nIDButton, UINT nCheck)
 
BOOL CheckRadioButton (int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
 
HWND ChildWindowFromPoint (POINT point) const
 
HWND ChildWindowFromPointEx (POINT point, UINT uFlags) const
 
BOOL ClientToScreen (LPPOINT lpPoint) const
 
BOOL ClientToScreen (LPRECT lpRect) const
 
HWND Create (LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
BOOL CreateCaret (HBITMAP pBitmap)
 
BOOL CreateGrayCaret (int nWidth, int nHeight)
 
BOOL CreateSolidCaret (int nWidth, int nHeight)
 
HDWP DeferWindowPos (HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
 
BOOL DestroyWindow ()
 
HWND Detach ()
 
int DlgDirList (LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType)
 
int DlgDirListComboBox (LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType)
 
BOOL DlgDirSelect (LPTSTR lpString, int nCount, int nIDListBox)
 
BOOL DlgDirSelectComboBox (LPTSTR lpString, int nCount, int nIDComboBox)
 
void DragAcceptFiles (BOOL bAccept=TRUE)
 
BOOL DrawMenuBar ()
 
BOOL EnableScrollBar (UINT uSBFlags, UINT uArrowFlags=ESB_ENABLE_BOTH)
 
BOOL EnableWindow (BOOL bEnable=TRUE)
 
void EndPaint (LPPAINTSTRUCT lpPaint)
 
BOOL FlashWindow (BOOL bInvert)
 
BOOL GetClientRect (LPRECT lpRect) const
 
HDC GetDC ()
 
HDC GetDCEx (HRGN hRgnClip, DWORD flags)
 
HWND GetDescendantWindow (int nID) const
 
HRESULT GetDlgControl (int nID, REFIID iid, void **ppCtrl)
 
int GetDlgCtrlID () const
 
HRESULT GetDlgHost (int nID, REFIID iid, void **ppHost)
 
HWND GetDlgItem (int nID)
 
UINT GetDlgItemInt (int nID, BOOL *lpTrans=NULL, BOOL bSigned=TRUE) const
 
UINT GetDlgItemText (int nID, LPTSTR lpStr, int nMaxCount) const
 
BOOL GetDlgItemText (int nID, BSTR &bstrText) const
 
DWORD GetExStyle () const
 
HFONT GetFont () const
 
DWORD GetHotKey () const
 
HICON GetIcon (BOOL bBigIcon=TRUE) const
 
HWND GetLastActivePopup () const
 
HMENU GetMenu () const
 
HWND GetNextDlgGroupItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
HWND GetNextDlgTabItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
CWindow GetParent () const
 
BOOL GetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo)
 
BOOL GetScrollPos (int nBar)
 
BOOL GetScrollRange (int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
 
DWORD GetStyle () const
 
HMENU GetSystemMenu (BOOL bRevert)
 
HWND GetTopLevelParent () const
 
HWND GetTopLevelWindow () const
 
HWND GetTopWindow () const
 
BOOL GetUpdateRect (LPRECT lpRect, BOOL bErase=FALSE)
 
int GetUpdateRgn (HRGN hRgn, BOOL bErase=FALSE)
 
HWND GetWindow (UINT nCmd) const
 
DWORD GetWindowContextHelpId () const
 
HDC GetWindowDC ()
 
LONG GetWindowLong (int nIndex) const
 
LONG_PTR GetWindowLongPtr (int nIndex) const
 
BOOL GetWindowPlacement (WINDOWPLACEMENT *lpwndpl) const
 
DWORD GetWindowProcessID ()
 
BOOL GetWindowRect (LPRECT lpRect) const
 
int GetWindowRgn (HRGN hRgn)
 
int GetWindowText (LPTSTR lpszStringBuf, int nMaxCount) const
 
BOOL GetWindowText (BSTR &bstrText)
 
int GetWindowTextLength () const
 
DWORD GetWindowThreadID ()
 
WORD GetWindowWord (int nIndex) const
 
void GotoDlgCtrl (HWND hWndCtrl) const
 
BOOL HideCaret ()
 
BOOL HiliteMenuItem (HMENU hMenu, UINT uHiliteItem, UINT uHilite)
 
BOOL Invalidate (BOOL bErase=TRUE)
 
BOOL InvalidateRect (LPCRECT lpRect, BOOL bErase=TRUE)
 
void InvalidateRgn (HRGN hRgn, BOOL bErase=TRUE)
 
BOOL IsChild (const HWND hWnd) const
 
BOOL IsDialogMessage (LPMSG lpMsg)
 
UINT IsDlgButtonChecked (int nIDButton) const
 
BOOL IsIconic () const
 
BOOL IsParentDialog ()
 
BOOL IsWindow () const
 
BOOL IsWindowEnabled () const
 
BOOL IsWindowVisible () const
 
BOOL IsWindowUnicode ()
 
BOOL IsZoomed () const
 
BOOL KillTimer (UINT_PTR nIDEvent)
 
BOOL LockWindowUpdate (BOOL bLock=TRUE)
 
int MapWindowPoints (HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
 
int MapWindowPoints (HWND hWndTo, LPRECT lpRect) const
 
int MessageBox (LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
 
BOOL ModifyStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL ModifyStyleEx (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL MoveWindow (int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
 
void NextDlgCtrl () const
 
BOOL OpenClipboard ()
 
BOOL PostMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void PrevDlgCtrl () const
 
void Print (HDC hDC, DWORD dwFlags) const
 
void PrintClient (HDC hDC, DWORD dwFlags) const
 
BOOL RedrawWindow (LPCRECT lpRectUpdate=NULL, HRGN hRgnUpdate=NULL, UINT flags=RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE)
 
int ReleaseDC (HDC hDC)
 
BOOL ResizeClient (int nWidth, int nHeight, BOOL bRedraw=FALSE)
 
BOOL ScreenToClient (LPPOINT lpPoint) const
 
BOOL ScrollWindow (int xAmount, int yAmount, LPCRECT lpRect=NULL, LPCRECT lpClipRect=NULL)
 
int ScrollWindowEx (int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags)
 
LRESULT SendDlgItemMessage (int nID, UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
LRESULT SendMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void SendMessageToDescendants (UINT message, WPARAM wParam=0, LPARAM lParam=0, BOOL bDeep=TRUE)
 
BOOL SendNotifyMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
HWND SetActiveWindow ()
 
HWND SetCapture ()
 
HWND SetClipboardViewer ()
 
int SetDlgCtrlID (int nID)
 
BOOL SetDlgItemInt (int nID, UINT nValue, BOOL bSigned=TRUE)
 
BOOL SetDlgItemText (int nID, LPCTSTR lpszString)
 
HWND SetFocus ()
 
void SetFont (HFONT hFont, BOOL bRedraw=TRUE)
 
int SetHotKey (WORD wVirtualKeyCode, WORD wModifiers)
 
HICON SetIcon (HICON hIcon, BOOL bBigIcon=TRUE)
 
BOOL SetMenu (HMENU hMenu)
 
HWND SetParent (HWND hWndNewParent)
 
void SetRedraw (BOOL bRedraw=TRUE)
 
int SetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw=TRUE)
 
int SetScrollPos (int nBar, int nPos, BOOL bRedraw=TRUE)
 
BOOL SetScrollRange (int nBar, int nMinPos, int nMaxPos, BOOL bRedraw=TRUE)
 
UINT_PTR SetTimer (UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
 
BOOL SetWindowContextHelpId (DWORD dwContextHelpId)
 
LONG SetWindowLong (int nIndex, LONG dwNewLong)
 
LONG_PTR SetWindowLongPtr (int nIndex, LONG_PTR dwNewLong)
 
BOOL SetWindowPlacement (const WINDOWPLACEMENT *lpwndpl)
 
BOOL SetWindowPos (HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
 
int SetWindowRgn (HRGN hRgn, BOOL bRedraw=FALSE)
 
BOOL SetWindowText (LPCTSTR lpszString)
 
WORD SetWindowWord (int nIndex, WORD wNewWord)
 
BOOL ShowCaret ()
 
BOOL ShowOwnedPopups (BOOL bShow=TRUE)
 
BOOL ShowScrollBar (UINT nBar, BOOL bShow=TRUE)
 
BOOL ShowWindow (int nCmdShow)
 
BOOL ShowWindowAsync (int nCmdShow)
 
BOOL UpdateWindow ()
 
BOOL ValidateRect (LPCRECT lpRect)
 
BOOL ValidateRgn (HRGN hRgn)
 
BOOL WinHelp (LPCTSTR lpszHelp, UINT nCmd=HELP_CONTEXT, DWORD dwData=0)
 
- Public Member Functions inherited from ATL::CMessageMap
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID)=0
 

Public Attributes

const INT m_Width
 
const INT m_Height
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from IDispatch
const DISPID DISPID_UNKNOWN = -1
 
const DISPID DISPID_VALUE = 0
 
const DISPID DISPID_PROPERTYPUT = -3
 
const DISPID DISPID_NEWENUM = -4
 
const DISPID DISPID_EVALUATE = -5
 
const DISPID DISPID_CONSTRUCTOR = -6
 
const DISPID DISPID_DESTRUCTOR = -7
 
const DISPID DISPID_COLLECT = -8
 
- Public Attributes inherited from ATL::CWindowImplRoot< CWindow >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 
- Public Attributes inherited from ATL::CWindow
HWND m_hWnd
 

Private Member Functions

HRESULT GetSearchResultsFolder (IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder)
 
BOOL GetAddressEditBoxPath (WCHAR *szPath)
 
void SetSearchInProgress (BOOL bInProgress)
 
HRESULT TrySubscribeToSearchEvents ()
 
LRESULT OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetFocus (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSearchButtonClicked (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnStopButtonClicked (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Private Attributes

CComPtr< IUnknownm_pSite
 
CComPtr< IAddressEditBox > m_AddressEditBox
 
BOOL m_bVisible
 

Additional Inherited Members

- Static Public Member Functions inherited from ATL::CComCoClass< CSearchBar, &CLSID_FileSearchBand >
static LPCTSTR WINAPI GetObjectDescription ()
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Static Public Member Functions inherited from ATL::CDialogImplBaseT< CWindow >
static INT_PTR CALLBACK StartDialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CWindow
static LPCTSTR GetWndClassName ()
 
static LRESULT SendMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
- Static Public Attributes inherited from ATL::CWindow
static RECT rcDefault
 

Detailed Description

Definition at line 717 of file gui.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
IDD 

Definition at line 81 of file CSearchBar.h.

81 { IDD = IDD_SEARCH_DLG };
#define IDD_SEARCH_DLG
Definition: resource.h:160

Constructor & Destructor Documentation

◆ CSearchBar() [1/2]

CSearchBar::CSearchBar ( )
inline

Definition at line 724 of file gui.cpp.

724  : m_Width(200), m_Height(22)
725  {
726  }
const INT m_Width
Definition: gui.cpp:721
const INT m_Height
Definition: gui.cpp:722

◆ CSearchBar() [2/2]

CSearchBar::CSearchBar ( )

◆ ~CSearchBar()

CSearchBar::~CSearchBar ( )
virtual

Definition at line 29 of file CSearchBar.cpp.

30 {
31 }

Member Function Documentation

◆ CloseDW()

HRESULT STDMETHODCALLTYPE CSearchBar::CloseDW ( DWORD  dwReserved)
virtual

Implements IDockingWindow.

Definition at line 284 of file CSearchBar.cpp.

285 {
286  // We do nothing, we don't have anything to save yet
287  TRACE("CloseDW called\n");
288  return S_OK;
289 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ ContextSensitiveHelp()

HRESULT STDMETHODCALLTYPE CSearchBar::ContextSensitiveHelp ( BOOL  fEnterMode)
virtual

Implements IOleWindow.

Definition at line 276 of file CSearchBar.cpp.

277 {
279  return E_NOTIMPL;
280 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Create()

HWND CSearchBar::Create ( HWND  hwndParent)
inline

Definition at line 733 of file gui.cpp.

734  {
735  ATL::CStringW szBuf;
738  0, 0, m_Width, m_Height,
739  hwndParent, (HMENU) NULL,
740  hInst, 0);
741 
743  szBuf.LoadStringW(IDS_SEARCH_TEXT);
744  SetWindowTextW(szBuf);
745  return m_hWnd;
746  }
HGDIOBJ WINAPI GetStockObject(_In_ int)
const INT m_Width
Definition: gui.cpp:721
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define IDS_SEARCH_TEXT
Definition: resource.h:87
const INT m_Height
Definition: gui.cpp:722
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HWND m_hWnd
Definition: atlwin.h:268
HINSTANCE hInst
Definition: dxdiag.c:13
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETFONT
Definition: winuser.h:1632
#define ES_LEFT
Definition: pedump.c:664
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define ES_AUTOHSCROLL
Definition: pedump.c:672

Referenced by CMainWindow::CreateSearchBar().

◆ GetAddressEditBoxPath()

BOOL CSearchBar::GetAddressEditBoxPath ( WCHAR szPath)
private

Definition at line 210 of file CSearchBar.cpp.

211 {
212  HWND hComboboxEx = GetDlgItem(IDC_SEARCH_COMBOBOX);
213  ::GetWindowTextW(hComboboxEx, szPath, MAX_PATH);
214  INT iSelectedIndex = SendMessageW(hComboboxEx, CB_GETCURSEL, 0, 0);
215  if (iSelectedIndex != CB_ERR)
216  {
217  WCHAR szItemText[MAX_PATH];
218  COMBOBOXEXITEMW item = {0};
219  item.mask = CBEIF_LPARAM | CBEIF_TEXT;
220  item.iItem = iSelectedIndex;
221  item.pszText = szItemText;
222  item.cchTextMax = _countof(szItemText);
223  SendMessageW(hComboboxEx, CBEM_GETITEMW, 0, (LPARAM)&item);
224 
225  if (!wcscmp(szItemText, szPath) && SHGetPathFromIDListW((LPCITEMIDLIST)item.lParam, szItemText))
226  {
227  StringCbCopyW(szPath, MAX_PATH * sizeof(WCHAR), szItemText);
228  return TRUE;
229  }
230  }
231 
235 }
#define TRUE
Definition: types.h:120
#define _countof(array)
Definition: fontsub.cpp:30
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1280
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1925
DWORD dwAttributes
Definition: vdmdbg.h:34
#define CBEIF_TEXT
Definition: commctrl.h:3758
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define CBEM_GETITEMW
Definition: commctrl.h:3815
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2410
HWND GetDlgItem(int nID)
Definition: atlwin.h:571
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define CBEIF_LPARAM
Definition: commctrl.h:3763
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_SEARCH_COMBOBOX
Definition: resource.h:166
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static ATOM item
Definition: dde.c:856
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
LPCWSTR szPath
Definition: env.c:35
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166

Referenced by OnSearchButtonClicked().

◆ GetBandInfo()

HRESULT STDMETHODCALLTYPE CSearchBar::GetBandInfo ( DWORD  dwBandID,
DWORD  dwViewMode,
DESKBANDINFO pdbi 
)
virtual

Implements IDeskBand.

Definition at line 306 of file CSearchBar.cpp.

307 {
308  if (!pdbi)
309  {
310  return E_INVALIDARG;
311  }
312 
313  if (pdbi->dwMask & DBIM_MINSIZE)
314  {
315  pdbi->ptMinSize.x = 200;
316  pdbi->ptMinSize.y = 30;
317  }
318 
319  if (pdbi->dwMask & DBIM_MAXSIZE)
320  {
321  pdbi->ptMaxSize.y = -1;
322  }
323 
324  if (pdbi->dwMask & DBIM_INTEGRAL)
325  {
326  pdbi->ptIntegral.y = 1;
327  }
328 
329  if (pdbi->dwMask & DBIM_ACTUAL)
330  {
331  pdbi->ptActual.x = 200;
332  pdbi->ptActual.y = 30;
333  }
334 
335  if (pdbi->dwMask & DBIM_TITLE)
336  {
337  if (!LoadStringW(_AtlBaseModule.GetResourceInstance(), IDS_SEARCHLABEL, pdbi->wszTitle, _countof(pdbi->wszTitle)))
339  }
340 
341  if (pdbi->dwMask & DBIM_MODEFLAGS)
342  {
343  pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
344  }
345 
346  if (pdbi->dwMask & DBIM_BKCOLOR)
347  {
348  pdbi->dwMask &= ~DBIM_BKCOLOR;
349  }
350  return S_OK;
351 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define _countof(array)
Definition: fontsub.cpp:30
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define IDS_SEARCHLABEL
Definition: resource.h:121
#define S_OK
Definition: intsafe.h:59

◆ GetClassID()

HRESULT STDMETHODCALLTYPE CSearchBar::GetClassID ( CLSID pClassID)
virtual

Implements IPersist.

Definition at line 440 of file CSearchBar.cpp.

441 {
442  if (!pClassID)
443  return E_POINTER;
444  *pClassID = CLSID_FileSearchBand;
445  return S_OK;
446 }
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ GetIDsOfNames()

HRESULT STDMETHODCALLTYPE CSearchBar::GetIDsOfNames ( REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
virtual

Implements IDispatch.

Definition at line 489 of file CSearchBar.cpp.

490 {
492  return E_NOTIMPL;
493 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetSearchResultsFolder()

HRESULT CSearchBar::GetSearchResultsFolder ( IShellBrowser **  ppShellBrowser,
HWND pHwnd,
IShellFolder **  ppShellFolder 
)
private

Definition at line 76 of file CSearchBar.cpp.

77 {
78  HRESULT hr;
79  CComPtr<IShellBrowser> pShellBrowser;
80  if (!ppShellBrowser)
81  ppShellBrowser = &pShellBrowser;
82  if (!*ppShellBrowser)
83  {
86  return hr;
87  }
88 
89  CComPtr<IShellView> pShellView;
90  hr = (*ppShellBrowser)->QueryActiveShellView(&pShellView);
91  if (FAILED(hr) || !pShellView)
92  return hr;
93 
94  CComPtr<IFolderView> pFolderView;
95  hr = pShellView->QueryInterface(IID_PPV_ARG(IFolderView, &pFolderView));
96  if (FAILED(hr) || !pFolderView)
97  return hr;
98 
99  CComPtr<IShellFolder> pShellFolder;
100  if (!ppShellFolder)
101  ppShellFolder = &pShellFolder;
102  hr = pFolderView->GetFolder(IID_PPV_ARG(IShellFolder, ppShellFolder));
103  if (FAILED(hr) || !pShellFolder)
104  return hr;
105 
106  CLSID clsid;
107  hr = IUnknown_GetClassID(*ppShellFolder, &clsid);
108  if (FAILED(hr))
109  return hr;
110  if (clsid != CLSID_FindFolder)
111  return E_FAIL;
112 
113  if (pHwnd)
114  {
115  hr = pShellView->GetWindow(pHwnd);
116  if (FAILED_UNEXPECTEDLY(hr))
117  return hr;
118  }
119 
120  return S_OK;
121 }
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *clsid)
Definition: ordinal.c:1404
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
CComPtr< IUnknown > m_pSite
Definition: CSearchBar.h:25
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
#define SID_SShellBrowser
Definition: shlguid.h:125

Referenced by OnSearchButtonClicked(), OnStopButtonClicked(), and TrySubscribeToSearchEvents().

◆ GetSite()

HRESULT STDMETHODCALLTYPE CSearchBar::GetSite ( REFIID  riid,
void **  ppvSite 
)
virtual

Definition at line 393 of file CSearchBar.cpp.

394 {
395  if (!ppvSite)
396  return E_POINTER;
397  *ppvSite = m_pSite;
398  return S_OK;
399 }
CComPtr< IUnknown > m_pSite
Definition: CSearchBar.h:25
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ GetSizeMax()

HRESULT STDMETHODCALLTYPE CSearchBar::GetSizeMax ( ULARGE_INTEGER pcbSize)
virtual

Implements IPersistStream.

Definition at line 468 of file CSearchBar.cpp.

469 {
470  // TODO: calculate max size
472  return E_NOTIMPL;
473 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetTypeInfo()

HRESULT STDMETHODCALLTYPE CSearchBar::GetTypeInfo ( UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
virtual

Implements IDispatch.

Definition at line 483 of file CSearchBar.cpp.

484 {
486  return E_NOTIMPL;
487 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetTypeInfoCount()

HRESULT STDMETHODCALLTYPE CSearchBar::GetTypeInfoCount ( UINT pctinfo)
virtual

Implements IDispatch.

Definition at line 477 of file CSearchBar.cpp.

478 {
480  return E_NOTIMPL;
481 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetWindow()

HRESULT STDMETHODCALLTYPE CSearchBar::GetWindow ( HWND lphwnd)
virtual

Implements IOleWindow.

Definition at line 268 of file CSearchBar.cpp.

269 {
270  if (!lphwnd)
271  return E_INVALIDARG;
272  *lphwnd = m_hWnd;
273  return S_OK;
274 }
#define E_INVALIDARG
Definition: ddrawi.h:101
HWND m_hWnd
Definition: atlwin.h:268
#define S_OK
Definition: intsafe.h:59

◆ HasFocusIO()

HRESULT STDMETHODCALLTYPE CSearchBar::HasFocusIO ( )
virtual

Definition at line 419 of file CSearchBar.cpp.

420 {
421  return S_OK;
422 }
#define S_OK
Definition: intsafe.h:59

◆ Invoke()

HRESULT STDMETHODCALLTYPE CSearchBar::Invoke ( DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
virtual

Implements IDispatch.

Definition at line 519 of file CSearchBar.cpp.

520 {
521  switch (dispIdMember)
522  {
525  {
527 
528  // Remove the search results folder from the address box
529  CComPtr<IDispatch> pDispatch;
530  HRESULT hResult = m_AddressEditBox->QueryInterface(IID_PPV_ARG(IDispatch, &pDispatch));
531  if (FAILED_UNEXPECTEDLY(hResult))
532  return hResult;
533  pDispatch->Invoke(dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
534  CComPtr<IShellService> pShellService;
535  hResult = m_AddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &pShellService));
536  if (FAILED_UNEXPECTEDLY(hResult))
537  return hResult;
538  hResult = pShellService->SetOwner(NULL);
539  if (FAILED_UNEXPECTEDLY(hResult))
540  return hResult;
541  HWND hComboboxEx = GetDlgItem(IDC_SEARCH_COMBOBOX);
542  int index = SendMessageW(hComboboxEx, CB_GETCOUNT, 0, 0);
543  if (index <= 0)
544  return S_OK;
545  COMBOBOXEXITEMW item = {0};
546  item.mask = CBEIF_LPARAM;
547  item.iItem = index - 1;
548  SendMessageW(hComboboxEx, CBEM_GETITEMW, 0, (LPARAM)&item);
549  if (!item.lParam)
550  return S_OK;
551  CComPtr<IShellFolder> pDesktopFolder;
552  hResult = SHGetDesktopFolder(&pDesktopFolder);
553  if (FAILED_UNEXPECTEDLY(hResult))
554  return hResult;
555  CComPtr<IShellFolder> pShellFolder;
556  hResult = pDesktopFolder->BindToObject((LPCITEMIDLIST)item.lParam, NULL, IID_PPV_ARG(IShellFolder, &pShellFolder));
557  if (FAILED(hResult))
558  return S_OK;
559  CLSID clsid;
560  hResult = IUnknown_GetClassID(pShellFolder, &clsid);
561  if (SUCCEEDED(hResult) && clsid == CLSID_FindFolder)
562  {
563  SendMessageW(hComboboxEx, CBEM_DELETEITEM, item.iItem, 0);
564  SendMessageW(hComboboxEx, CB_SETCURSEL, 0, 0);
565  }
566  return S_OK;
567  }
569  case DISPID_SEARCHABORT:
571  return S_OK;
572  default:
573  return E_INVALIDARG;
574  }
575 }
CComPtr< IAddressEditBox > m_AddressEditBox
Definition: CSearchBar.h:26
REFIID riid
Definition: precomp.h:44
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define DISPID_DOCUMENTCOMPLETE
Definition: webchild.h:61
#define IID_PPV_ARG(Itype, ppType)
#define DISPID_SEARCHABORT
Definition: exdispid.h:174
#define CBEM_DELETEITEM
Definition: commctrl.h:3803
#define E_INVALIDARG
Definition: ddrawi.h:101
#define DISPID_NAVIGATECOMPLETE2
Definition: webchild.h:54
#define CBEM_GETITEMW
Definition: commctrl.h:3815
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define DISPID_SEARCHCOMPLETE
Definition: exdispid.h:173
GLuint index
Definition: glext.h:6031
HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *clsid)
Definition: ordinal.c:1404
HWND GetDlgItem(int nID)
Definition: atlwin.h:571
#define CBEIF_LPARAM
Definition: commctrl.h:3763
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define IDC_SEARCH_COMBOBOX
Definition: resource.h:166
REFCLSID clsid
Definition: msctf.c:84
#define CB_SETCURSEL
Definition: winuser.h:1943
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define S_OK
Definition: intsafe.h:59
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void SetSearchInProgress(BOOL bInProgress)
Definition: CSearchBar.cpp:495
HRESULT TrySubscribeToSearchEvents()
Definition: CSearchBar.cpp:504
#define CB_GETCOUNT
Definition: winuser.h:1924
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by OnInitDialog().

◆ IsDirty()

HRESULT STDMETHODCALLTYPE CSearchBar::IsDirty ( void  )
virtual

Implements IPersistStream.

Definition at line 450 of file CSearchBar.cpp.

451 {
453  return E_NOTIMPL;
454 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Load()

HRESULT STDMETHODCALLTYPE CSearchBar::Load ( IStream pStm)
virtual

Implements IPersistStream.

Definition at line 456 of file CSearchBar.cpp.

457 {
459  return E_NOTIMPL;
460 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OnInitDialog()

LRESULT CSearchBar::OnInitDialog ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 33 of file CSearchBar.cpp.

34 {
36 
37  HWND hCombobox = GetDlgItem(IDC_SEARCH_COMBOBOX);
38  CComPtr<IImageList> pImageList;
39  HRESULT hResult = SHGetImageList(SHIL_SMALL, IID_PPV_ARG(IImageList, &pImageList));
40  SendMessage(hCombobox, CBEM_SETIMAGELIST, 0, FAILED_UNEXPECTEDLY(hResult) ? 0 : reinterpret_cast<LPARAM>(pImageList.p));
41 
44  HWND hEditControl = reinterpret_cast<HWND>(SendMessage(hCombobox, CBEM_GETEDITCONTROL, 0, 0));
45  hResult = CAddressEditBox_CreateInstance(IID_PPV_ARG(IAddressEditBox, &m_AddressEditBox));
46  if (FAILED_UNEXPECTEDLY(hResult))
47  return FALSE;
48 
49  hResult = m_AddressEditBox->Init(hCombobox, hEditControl, 0, m_pSite);
50  if (FAILED_UNEXPECTEDLY(hResult))
51  return FALSE;
52 
53  // Subscribe to navigation events
54  CComPtr<IShellBrowser> pShellBrowser;
56  DWORD dwAdviseCookie;
57  if (SUCCEEDED(hResult))
58  AtlAdvise(pShellBrowser, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &dwAdviseCookie);
59 
60  // Invoke the navigate event in case a search results folder is already open
61  DISPPARAMS params = {0};
63 
64  return TRUE;
65 }
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: CSearchBar.cpp:519
#define TRUE
Definition: types.h:120
CComPtr< IAddressEditBox > m_AddressEditBox
Definition: CSearchBar.h:26
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
Definition: atl.c:46
HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv)
Definition: browseui.cpp:33
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
#define DISPATCH_METHOD
Definition: oleauto.h:1006
GLenum const GLfloat * params
Definition: glext.h:5645
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2013
#define DISPID_NAVIGATECOMPLETE2
Definition: webchild.h:54
smooth NULL
Definition: ftsmooth.c:416
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3805
HWND GetDlgItem(int nID)
Definition: atlwin.h:571
#define CBEM_SETIMAGELIST
Definition: commctrl.h:3799
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
CComPtr< IUnknown > m_pSite
Definition: CSearchBar.h:25
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_SEARCH_COMBOBOX
Definition: resource.h:166
#define CBEM_SETEXTENDEDSTYLE
Definition: commctrl.h:3807
#define CBES_EX_NOSIZELIMIT
Definition: commctrl.h:3826
#define GUID_NULL
Definition: ks.h:106
void SetSearchInProgress(BOOL bInProgress)
Definition: CSearchBar.cpp:495
struct stdole::DISPPARAMS DISPPARAMS
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
#define SHIL_SMALL
Definition: shellapi.h:183
#define CBES_EX_CASESENSITIVE
Definition: commctrl.h:3827
#define SID_SShellBrowser
Definition: shlguid.h:125
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ OnSearchButtonClicked()

LRESULT CSearchBar::OnSearchButtonClicked ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL bHandled 
)
private

Definition at line 123 of file CSearchBar.cpp.

124 {
125  size_t len = 0;
126  WCHAR endchar;
127  WCHAR startchar;
128 
129  CComHeapPtr<SearchStart> pSearchStart(static_cast<SearchStart *>(CoTaskMemAlloc(sizeof(SearchStart))));
130  GetDlgItemText(IDC_SEARCH_FILENAME, pSearchStart->szFileName, _countof(pSearchStart->szFileName));
131  GetDlgItemText(IDC_SEARCH_QUERY, pSearchStart->szQuery, _countof(pSearchStart->szQuery));
132  if (!GetAddressEditBoxPath(pSearchStart->szPath))
133  {
134  ShellMessageBoxW(_AtlBaseModule.GetResourceInstance(), m_hWnd, MAKEINTRESOURCEW(IDS_SEARCHINVALID), MAKEINTRESOURCEW(IDS_SEARCHLABEL), MB_OK | MB_ICONERROR, pSearchStart->szPath);
135  return 0;
136  }
137 
138  // See if we have an szFileName by testing for its entry lenth > 0 and our searched FileName does not contain
139  // an asterisk or a question mark. If so, then prepend and append an asterisk to the searched FileName.
140  // (i.e. it's equivalent to searching for *<the_file_name>* )
141  if (FAILED (StringCchLengthW (pSearchStart->szFileName, MAX_PATH, &len))) return 0;
142  if ((len > 0) && !wcspbrk(pSearchStart->szFileName, L"*?"))
143  {
144  endchar = pSearchStart->szFileName[len - 1];
145  startchar = pSearchStart->szFileName[0];
146  if ((len < MAX_PATH - 1) && (startchar != L'*'))
147  {
148  memmove(&pSearchStart->szFileName[1], &pSearchStart->szFileName[0],
149  len * sizeof(WCHAR) + sizeof(WCHAR));
150  len = len + 1;
151  pSearchStart->szFileName[0] = L'*';
152  }
153 
154  // See if our last character is an asterisk and if not and we have room then add one
155  if ((len < MAX_PATH - 1) && (endchar != L'*'))
156  StringCchCatW(pSearchStart->szFileName, MAX_PATH, L"*");
157  }
158 
159  // Print our final search string for szFileName
160  TRACE("Searched szFileName is '%S'.\n", pSearchStart->szFileName);
161 
162  CComPtr<IShellBrowser> pShellBrowser;
164  if (FAILED_UNEXPECTEDLY(hr))
165  return 0;
166 
167  HWND hwnd;
168  if (FAILED(GetSearchResultsFolder(&pShellBrowser, &hwnd, NULL)))
169  {
170  // Open a new search results folder
171  WCHAR szShellGuid[MAX_PATH];
172  const WCHAR shellGuidPrefix[] = L"shell:::";
173  memcpy(szShellGuid, shellGuidPrefix, sizeof(shellGuidPrefix));
174  hr = StringFromGUID2(CLSID_FindFolder, szShellGuid + _countof(shellGuidPrefix) - 1,
175  _countof(szShellGuid) - _countof(shellGuidPrefix));
176  if (FAILED_UNEXPECTEDLY(hr))
177  return 0;
178 
179  CComHeapPtr<ITEMIDLIST> findFolderPidl;
180  hr = SHParseDisplayName(szShellGuid, NULL, &findFolderPidl, 0, NULL);
181  if (FAILED_UNEXPECTEDLY(hr))
182  return 0;
183 
184  hr = pShellBrowser->BrowseObject(findFolderPidl, 0);
185  if (FAILED_UNEXPECTEDLY(hr))
186  return 0;
187 
188  hr = GetSearchResultsFolder(&pShellBrowser, &hwnd, NULL);
189  if (FAILED_UNEXPECTEDLY(hr))
190  return 0;
191  }
192 
193  ::PostMessageW(hwnd, WM_SEARCH_START, 0, (LPARAM) pSearchStart.Detach());
194 
196 
197  return 0;
198 }
#define IDC_SEARCH_FILENAME
Definition: resource.h:162
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDC_SEARCH_QUERY
Definition: resource.h:163
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define IDS_SEARCHINVALID
Definition: resource.h:167
#define _countof(array)
Definition: fontsub.cpp:30
#define WM_SEARCH_START
Definition: shellfind.h:29
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
BOOL GetAddressEditBoxPath(WCHAR *szPath)
Definition: CSearchBar.cpp:210
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder)
Definition: CSearchBar.cpp:76
#define IDS_SEARCHLABEL
Definition: resource.h:121
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:26
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
CComPtr< IUnknown > m_pSite
Definition: CSearchBar.h:25
int ShellMessageBoxW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,...)
Definition: shellord.c:337
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
HWND m_hWnd
Definition: atlwin.h:268
UINT GetDlgItemText(int nID, LPTSTR lpStr, int nMaxCount) const
Definition: atlwin.h:583
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1367
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
void SetSearchInProgress(BOOL bInProgress)
Definition: CSearchBar.cpp:495
#define MB_OK
Definition: winuser.h:784
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:842
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SID_SShellBrowser
Definition: shlguid.h:125
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

◆ OnSetFocus()

LRESULT CSearchBar::OnSetFocus ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 69 of file CSearchBar.cpp.

70 {
71  IUnknown_OnFocusChangeIS(m_pSite, static_cast<IDeskBand *>(this), TRUE);
72  bHandled = FALSE;
73  return TRUE;
74 }
#define TRUE
Definition: types.h:120
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4594
CComPtr< IUnknown > m_pSite
Definition: CSearchBar.h:25

◆ OnSize()

LRESULT CSearchBar::OnSize ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 237 of file CSearchBar.cpp.

238 {
239  INT iWidth = LOWORD(lParam);
240  INT iPadding = 10;
241 
243 
245  HDWP hdwp = BeginDeferWindowPos(_countof(inputs));
246  for (SIZE_T i = 0; i < _countof(inputs); i++)
247  {
248  CWindow wnd = (CWindow) GetDlgItem(inputs[i]);
249  RECT rect;
250  wnd.GetWindowRect(&rect);
251  POINT pt = { rect.left, rect.top };
252  ScreenToClient(&pt);
253  hdwp = wnd.DeferWindowPos(hdwp,
254  HWND_TOP,
255  iPadding,
256  pt.y,
257  iWidth - iPadding * 2,
258  rect.bottom - rect.top,
260  }
261  EndDeferWindowPos(hdwp);
262 
263  return 0;
264 }
#define IDC_PROGRESS_BAR
Definition: resource.h:134
#define IDC_SEARCH_FILENAME
Definition: resource.h:162
#define IDC_SEARCH_QUERY
Definition: resource.h:163
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define pt(x, y)
Definition: drawing.c:79
#define _countof(array)
Definition: fontsub.cpp:30
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1220
#define HWND_TOP
Definition: winuser.h:1193
#define SWP_NOZORDER
Definition: winuser.h:1232
CWindow(HWND hWnd=NULL)
Definition: atlwin.h:271
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
#define SWP_NOCOPYBITS
Definition: winuser.h:1228
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDC_SEARCH_BUTTON
Definition: resource.h:164
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
BOOL GetWindowRect(LPRECT lpRect) const
Definition: atlwin.h:764
smooth NULL
Definition: ftsmooth.c:416
HWND GetDlgItem(int nID)
Definition: atlwin.h:571
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define IDC_SEARCH_COMBOBOX
Definition: resource.h:166
BOOL ScreenToClient(LPPOINT lpPoint) const
Definition: atlwin.h:1024
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define IDC_SEARCH_STOP_BUTTON
Definition: resource.h:165
#define SWP_NOMOVE
Definition: winuser.h:1229
HDWP DeferWindowPos(HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
Definition: atlwin.h:422
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234
#define IDC_SEARCH_LABEL
Definition: resource.h:161

◆ OnStopButtonClicked()

LRESULT CSearchBar::OnStopButtonClicked ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL bHandled 
)
private

Definition at line 200 of file CSearchBar.cpp.

201 {
202  HWND hwnd;
204  if (SUCCEEDED(hr))
206 
207  return 0;
208 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder)
Definition: CSearchBar.cpp:76
LONG HRESULT
Definition: typedefs.h:77
#define WM_SEARCH_STOP
Definition: shellfind.h:30
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ ResizeBorderDW()

HRESULT STDMETHODCALLTYPE CSearchBar::ResizeBorderDW ( const RECT prcBorder,
IUnknown punkToolbarSite,
BOOL  fReserved 
)
virtual

Definition at line 291 of file CSearchBar.cpp.

292 {
293  /* Must return E_NOTIMPL according to MSDN */
294  return E_NOTIMPL;
295 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Save()

HRESULT STDMETHODCALLTYPE CSearchBar::Save ( IStream pStm,
BOOL  fClearDirty 
)
virtual

Implements IPersistStream.

Definition at line 462 of file CSearchBar.cpp.

463 {
465  return E_NOTIMPL;
466 }
#define UNIMPLEMENTED
Definition: CSearchBar.cpp:20
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ SetSearchInProgress()

void CSearchBar::SetSearchInProgress ( BOOL  bInProgress)
private

Definition at line 495 of file CSearchBar.cpp.

496 {
499  HWND hProgressBar = GetDlgItem(IDC_PROGRESS_BAR);
500  ::ShowWindow(hProgressBar, bInProgress ? SW_SHOW : SW_HIDE);
501  ::PostMessage(hProgressBar, PBM_SETMARQUEE, bInProgress, 0);
502 }
#define IDC_PROGRESS_BAR
Definition: resource.h:134
#define PBM_SETMARQUEE
Definition: commctrl.h:2171
#define SW_HIDE
Definition: winuser.h:762
#define IDC_SEARCH_BUTTON
Definition: resource.h:164
#define SW_SHOW
Definition: winuser.h:769
HWND GetDlgItem(int nID)
Definition: atlwin.h:571
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1265
BOOL PostMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:976
#define IDC_SEARCH_STOP_BUTTON
Definition: resource.h:165

Referenced by Invoke(), OnInitDialog(), and OnSearchButtonClicked().

◆ SetSite()

HRESULT STDMETHODCALLTYPE CSearchBar::SetSite ( IUnknown pUnkSite)
virtual

Implements IObjectWithSite.

Definition at line 355 of file CSearchBar.cpp.

356 {
357  HRESULT hr;
358  HWND parentWnd;
359 
360  if (pUnkSite == m_pSite)
361  return S_OK;
362 
363  TRACE("SetSite called \n");
364  if (!pUnkSite)
365  {
366  DestroyWindow();
367  m_hWnd = NULL;
368  return S_OK;
369  }
370 
371  hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
372  if (!SUCCEEDED(hr))
373  {
374  ERR("Could not get parent's window ! Status: %08lx\n", hr);
375  return E_INVALIDARG;
376  }
377 
378  m_pSite = pUnkSite;
379 
380  if (m_hWnd)
381  {
382  // Change its parent
383  SetParent(parentWnd);
384  }
385  else
386  {
387  CDialogImpl::Create(parentWnd);
388 
389  }
390  return S_OK;
391 }
HRESULT hr
Definition: shlfolder.c:183
_In_ BOOLEAN Create
Definition: pstypes.h:511
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1283
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
CComPtr< IUnknown > m_pSite
Definition: CSearchBar.h:25
HWND m_hWnd
Definition: atlwin.h:268
BOOL DestroyWindow()
Definition: atlwin.h:428
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
HWND SetParent(HWND hWndNewParent)
Definition: atlwin.h:1160
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ SetText()

VOID CSearchBar::SetText ( LPCWSTR  lpszText)
inline

Definition at line 728 of file gui.cpp.

729  {
731  }
LONG_PTR LPARAM
Definition: windef.h:208
#define SB_SETTEXT
Definition: commctrl.h:1921
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SBT_NOBORDERS
Definition: commctrl.h:1943

◆ ShowDW()

HRESULT STDMETHODCALLTYPE CSearchBar::ShowDW ( BOOL  fShow)
virtual

Implements IDockingWindow.

Definition at line 297 of file CSearchBar.cpp.

298 {
299  m_bVisible = fShow;
300  ShowWindow(fShow);
301  return S_OK;
302 }
BOOL m_bVisible
Definition: CSearchBar.h:27
#define S_OK
Definition: intsafe.h:59
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1265

◆ TranslateAcceleratorIO()

HRESULT STDMETHODCALLTYPE CSearchBar::TranslateAcceleratorIO ( LPMSG  lpMsg)
virtual

Definition at line 424 of file CSearchBar.cpp.

425 {
426  if (IsDialogMessage(lpMsg))
427  return S_OK;
428 
429  if ((lpMsg->hwnd == m_hWnd || IsChild(lpMsg->hwnd)))
430  {
431  TranslateMessage(lpMsg);
432  DispatchMessage(lpMsg);
433  return S_OK;
434  }
435 
436  return S_FALSE;
437 }
BOOL IsDialogMessage(LPMSG lpMsg)
Definition: atlwin.h:852
#define DispatchMessage
Definition: winuser.h:5666
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL IsChild(const HWND hWnd) const
Definition: atlwin.h:846
#define S_FALSE
Definition: winerror.h:2357
HWND m_hWnd
Definition: atlwin.h:268
#define S_OK
Definition: intsafe.h:59
HWND hwnd
Definition: winuser.h:3088

◆ TrySubscribeToSearchEvents()

HRESULT CSearchBar::TrySubscribeToSearchEvents ( )
private

Definition at line 504 of file CSearchBar.cpp.

505 {
506  CComPtr<IShellFolder> pShellFolder;
507  HRESULT hr = GetSearchResultsFolder(NULL, NULL, &pShellFolder);
508  if (FAILED(hr))
509  return hr;
510 
511  DWORD fAdviseCookie;
512  hr = AtlAdvise(pShellFolder, static_cast<IDispatch *>(this), DIID_DSearchCommandEvents, &fAdviseCookie);
513  if (FAILED_UNEXPECTEDLY(hr))
514  return hr;
515 
516  return S_OK;
517 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
Definition: atl.c:46
smooth NULL
Definition: ftsmooth.c:416
HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder)
Definition: CSearchBar.cpp:76
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59

Referenced by Invoke().

◆ UIActivateIO()

HRESULT STDMETHODCALLTYPE CSearchBar::UIActivateIO ( BOOL  fActivate,
LPMSG  lpMsg 
)
virtual

Definition at line 403 of file CSearchBar.cpp.

404 {
405  if (fActivate)
406  {
407  //SetFocus();
408  SetActiveWindow();
409  }
410  // TODO: handle message
411  if(lpMsg)
412  {
413  TranslateMessage(lpMsg);
414  DispatchMessage(lpMsg);
415  }
416  return S_OK;
417 }
#define DispatchMessage
Definition: winuser.h:5666
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define S_OK
Definition: intsafe.h:59
HWND SetActiveWindow()
Definition: atlwin.h:1094

Member Data Documentation

◆ m_AddressEditBox

CComPtr<IAddressEditBox> CSearchBar::m_AddressEditBox
private

Definition at line 26 of file CSearchBar.h.

Referenced by Invoke(), and OnInitDialog().

◆ m_bVisible

BOOL CSearchBar::m_bVisible
private

Definition at line 27 of file CSearchBar.h.

Referenced by ShowDW().

◆ m_Height

const INT CSearchBar::m_Height

Definition at line 722 of file gui.cpp.

Referenced by Create().

◆ m_pSite

CComPtr<IUnknown> CSearchBar::m_pSite
private

◆ m_Width

const INT CSearchBar::m_Width

Definition at line 721 of file gui.cpp.

Referenced by Create(), and CMainWindow::OnSize().


The documentation for this class was generated from the following files: