Re: winecfg: Add dll override on return key press in combobox [resend]
2008/12/27 Dmitry Timoshkov dmi...@codeweavers.com: Andre Wisplinghoff andre.wisplingh...@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. +/* 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); -- Andre Wisplinghoff
Re: winecfg: Add dll override on return key press in combobox [resend]
2008/12/27 Andre Wisplinghoff andre.wisplingh...@gmail.com: 2008/12/27 Dmitry Timoshkov dmi...@codeweavers.com: Andre Wisplinghoff andre.wisplingh...@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
Re: winecfg: Add dll override on return key press in combobox [resend]
Andre Wisplinghoff andre.wisplingh...@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.
Re: winecfg: Add dll override on return key press in combobox [resend]
Andre Wisplinghoff andre.wisplingh...@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. +/* 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. -- Dmitry.