Commit 4145fe0e authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

shell32: Store the autocompletion object pointer in a window property rather…

shell32: Store the autocompletion object pointer in a window property rather than in the window user data.
parent 4dc30448
......@@ -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];
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment