1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
WNDPROC OldEditProc;
LRESULT CALLBACK SubEditProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
switch (Msg) {
case WM_KEYDOWN:
switch (LOWORD(wParam)) {
case VK_RETURN:
//hMainWnd is a handle to the main window
SendMessage(hMainWnd, WM_COMMAND, (WPARAM)IDC_SEND_MESSAGE_BUTTON, NULL);
return 0;
default:;
}
default:
return CallWindowProc(OldEditProc, hWnd, Msg, wParam, lParam);
}
}
HWND hMsgEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", NULL, WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL, 10, 223, 580, 25, hWnd, (HMENU)IDC_MESSAGE_EDIT_EDIT, hInst, NULL);
OldEditProc = (WNDPROC)SetWindowLongPtr(hMsgEdit, GWLP_WNDPROC, (LONG_PTR)SubEditProc);
|