winecfg: Add dll override on return key press in combobox [resend]

Reece Dunn msclrhd at googlemail.com
Sat Dec 27 08:42:41 CST 2008


2008/12/27 Andre Wisplinghoff <andre.wisplinghoff at gmail.com>:
> 2008/12/27 Dmitry Timoshkov <dmitry at codeweavers.com>:
>> "Andre Wisplinghoff" <andre.wisplinghoff at gmail.com> wrote:
>>
>>> +INT_PTR CALLBACK
>>> +comboedit_wndproc (HWND hEdit, UINT uMsg, WPARAM wParam, LPARAM lParam)
>>
>> INT_PTR is wrong return value type for a window proc.
>
> so it should be HRESULT? INT_PTR is used for other window procs in
> programs/winecfg/libraries.c, too.

LRESULT is the return type for WndProc functions. HRESULT is used by COM.

The signatures for the other WndProc functions should be fixed too,
but in a different patch.

>>> +    /* subclass dllcombo's edit to allow return keypress handling  */
>>> +    GetComboBoxInfo(GetDlgItem(dialog, IDC_DLLCOMBO), &cbinfo);
>>> +    edit = cbinfo.hwndItem;  /* retrieve edit box handle */
>>> +    oldWndProc = (LONG_PTR)SetWindowLong(edit, GWL_WNDPROC,
>>> +                          (DWORD) comboedit_wndproc);
>>> +    SetWindowLong(edit, GWL_USERDATA, (DWORD)oldWndProc);
>>
>> The code is above is not 64-bit safe.
>
> I'm not used to 64-bit programming but willing to learn. Is using
> SetWindowLongPtr enough to make it 64-bit safe?:
>
> oldWndProc = SetWindowLongPtr(edit, GWL_WNDPROC,
>                          (LONG_PTR) comboedit_wndproc);
> SetWindowLongPtr(edit, GWL_USERDATA, (LONG_PTR) oldWndProc);

Should be. However, you should use GWLP_WNDPROC and GWLP_USERDATA
instead (http://msdn.microsoft.com/en-us/library/ms644898(VS.85).aspx).

- Reece



More information about the wine-devel mailing list