In the code below, How to add two events to the Enter key, for example:
1. Enter directly in the edit box, the first item in the list will be executed.
2. If there is already an item selected in the list, press Enter in the edit box to execute the selected item.
In addition, the following code, there is a problem, the Enter key can not be used in the window after execution
1. Enter directly in the edit box, the first item in the list will be executed.
2. If there is already an item selected in the list, press Enter in the edit box to execute the selected item.
In addition, the following code, there is a problem, the Enter key can not be used in the window after execution
#sub EditSubclassProc
function# hWnd message wParam lParam
int cid=GetDlgCtrlID(hWnd)
int Phwnd= GetParent(hWnd)
;OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,case WM_GETDLGCODE
,sel(wParam) case [VK_RETURN] ret DLGC_WANTALLKEYS
,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam ;;virtual key code
,,case VK_RETURN
,,;on enter in the edit box select the item in the list box
,,sel cid
,,,case 3
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(4 Phwnd)) id(4 Phwnd)
,,,case 7
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(10 Phwnd)) id(10 Phwnd)
,,,case 8
,,,SendMessage Phwnd WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(id(11 Phwnd)) id(11 Phwnd)
,,ret
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,;relay these keys to the listbox and not to the edit box
,,sel cid
,,,case 3
,,,SendMessage id(4 Phwnd) message wParam lParam
,,,case 7
,,,SendMessage id(10 Phwnd) message wParam lParam
,,,case 8
,,,SendMessage id(11 Phwnd) message wParam lParam
,,ret
int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)