From 8c92ba009d2aec43df3d483abf30f3c09d850f53 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 6 Mar 2010 23:55:32 +0300 Subject: [PATCH] shell32/shellview: Implemented IFolderView::GetFocusedItem. --- dlls/shell32/shlview.c | 10 +++++++--- dlls/shell32/tests/shlview.c | 13 +++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 8778dbd6e12..f718c2bbe5b 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -2750,9 +2750,13 @@ static HRESULT WINAPI IFView_GetSelectionMarkedItem(IFolderView *iface, int *ite static HRESULT WINAPI IFView_GetFocusedItem(IFolderView *iface, int *item) { - IShellViewImpl *This = impl_from_IFolderView(iface); - FIXME("(%p)->(%p), stub\n", This, item); - return E_NOTIMPL; + IShellViewImpl *This = impl_from_IFolderView(iface); + + TRACE("(%p)->(%p)\n", This, item); + + *item = SendMessageW(This->hWndList, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); + + return S_OK; } static HRESULT WINAPI IFView_GetItemPosition(IFolderView *iface, PCUITEMID_CHILD pidl, POINT *ppt) diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c index fd65e49a9df..2cd4c4b0adf 100644 --- a/dlls/shell32/tests/shlview.c +++ b/dlls/shell32/tests/shlview.c @@ -303,6 +303,11 @@ static const struct message folderview_getselectionmarked_seq[] = { { 0 } }; +static const struct message folderview_getfocused_seq[] = { + { LVM_GETNEXTITEM, sent|wparam|lparam, -1, LVNI_FOCUSED }, + { 0 } +}; + static void test_IShellView_CreateViewWindow(void) { IShellFolder *desktop; @@ -379,6 +384,7 @@ if (0) /* crashes on XP */ hr = IFolderView_GetSelectionMarkedItem(fv, NULL); + hr = IFolderView_GetFocusedItem(fv, NULL); } browser = IShellBrowserImpl_Construct(); @@ -435,6 +441,13 @@ if (0) ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getselectionmarked_seq, "IFolderView::GetSelectionMarkedItem", FALSE); + /* IFolderView::GetFocusedItem */ + flush_sequences(sequences, NUM_MSG_SEQUENCES); + hr = IFolderView_GetFocusedItem(fv, &ret); + ok(hr == S_OK, "got (0x%08x)\n", hr); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getfocused_seq, + "IFolderView::GetFocusedItem", FALSE); + IShellBrowser_Release(browser); IFolderView_Release(fv); IShellView_Release(view);