winecfg: Add dll override on return key press in combobox [resend]
Dmitry Timoshkov
dmitry at codeweavers.com
Sat Dec 27 09:18:30 CST 2008
"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?
No.
> INT_PTR is used for other window procs in
> programs/winecfg/libraries.c, too.
INT_PTR is used for dialog procs.
>>> + /* 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);
Yes, along with GWLP_WNDPROC.
--
Dmitry.
More information about the wine-devel
mailing list