Module: wine Branch: master Commit: 4145fe0ec2943b1ad81cf812a5f8963911bf442e URL: http://source.winehq.org/git/wine.git/?a=commit;h=4145fe0ec2943b1ad81cf812a5...
Author: Andrew Nguyen anguyen@codeweavers.com Date: Tue Feb 1 04:16:30 2011 -0600
shell32: Store the autocompletion object pointer in a window property rather than in the window user data.
---
dlls/shell32/autocomplete.c | 8 +++++--- dlls/shell32/tests/autocomplete.c | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c index 95db44c..b259f6f 100644 --- a/dlls/shell32/autocomplete.c +++ b/dlls/shell32/autocomplete.c @@ -82,7 +82,9 @@ typedef struct static const IAutoComplete2Vtbl acvt; static const IAutoCompleteDropDownVtbl acdropdownvt;
- +static const WCHAR autocomplete_propertyW[] = {'W','i','n','e',' ','A','u','t','o', + 'c','o','m','p','l','e','t','e',' ', + 'c','o','n','t','r','o','l',0}; /* converts This to an interface pointer */ @@ -273,7 +275,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit( This->initialized = TRUE; This->hwndEdit = hwndEdit; This->wpOrigEditProc = (WNDPROC) SetWindowLongPtrW( hwndEdit, GWLP_WNDPROC, (LONG_PTR) ACEditSubclassProc); - SetWindowLongPtrW( hwndEdit, GWLP_USERDATA, (LONG_PTR)This); + SetPropW( hwndEdit, autocomplete_propertyW, This );
if (This->options & ACO_AUTOSUGGEST) create_listbox(This); @@ -464,7 +466,7 @@ static const IAutoCompleteDropDownVtbl acdropdownvt = */ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - IAutoCompleteImpl *This = (IAutoCompleteImpl *)GetWindowLongPtrW(hwnd, GWLP_USERDATA); + IAutoCompleteImpl *This = GetPropW(hwnd, autocomplete_propertyW); LPOLESTR strs; HRESULT hr; WCHAR hwndText[255]; diff --git a/dlls/shell32/tests/autocomplete.c b/dlls/shell32/tests/autocomplete.c index a96aa97..5ff8847 100644 --- a/dlls/shell32/tests/autocomplete.c +++ b/dlls/shell32/tests/autocomplete.c @@ -141,6 +141,7 @@ static IAutoComplete *test_init(void) HRESULT r; IAutoComplete *ac; IUnknown *acSource; + LONG_PTR user_data;
/* AutoComplete instance */ r = CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, @@ -163,10 +164,16 @@ static IAutoComplete *test_init(void) } ok(r == S_OK, "no IID_IACList (0x%08x)\n", r);
+ user_data = GetWindowLongPtrA(hEdit, GWLP_USERDATA); + ok(user_data == 0, "Expected the edit control user data to be zero\n"); + /* bind to edit control */ r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL); ok(r == S_OK, "Init returned 0x%08x\n", r);
+ user_data = GetWindowLongPtrA(hEdit, GWLP_USERDATA); + ok(user_data == 0, "Expected the edit control user data to be zero\n"); + IUnknown_Release(acSource);
return ac;