Hello,
Once again its a late night behind the warm glow of the CRT...
How is it that a windows control like an editbox/textbox can
process ALL the WM_KEY(DOWN/UP) messages but when you make a
custom control it seems like windows filters out the ESC, ARROW,
and ENTER keys. I have put together a simple example in which the
above happens...
------------------
Cheers
Once again its a late night behind the warm glow of the CRT...
How is it that a windows control like an editbox/textbox can
process ALL the WM_KEY(DOWN/UP) messages but when you make a
custom control it seems like windows filters out the ESC, ARROW,
and ENTER keys. I have put together a simple example in which the
above happens...
Code:
#compile exe #include "win32api.inc" function GridProc(byval hwnd as long, byval wmsg as long, byval wparam as long, byval lparam as long) export as long dim ps as local PAINTSTRUCT dim hdc as local long dim wr as local RECT select case wmsg case %WM_PAINT GetClientRect hwnd, wr hdc = BeginPaint(hwnd, ps) DrawFrameControl hdc, wr, %DFC_BUTTON, %DFCS_BUTTONPUSH EndPaint hwnd, ps case %WM_KEYDOWN SetWindowText GetParent(hwnd), format$(wparam) case else function = DefWindowProc(hwnd, wmsg, wparam, lparam) end select end function callback function dlgproc as long dim szClassName as asciiz * 64 dim wc as local WNDCLASSEX select case cbmsg case %WM_INITDIALOG szClassName = "SysGrid32" wc.cbSize = sizeof(wc) wc.style = %CS_HREDRAW or %CS_VREDRAW wc.lpfnWndProc = codeptr(GridProc) wc.cbClsExtra = 0 wc.cbWndExtra = 0 wc.hInstance = GetWindowLong(cbhndl, %GWL_HINSTANCE) wc.hIcon = %NULL wc.hIconSm = %NULL wc.hCursor = LoadCursor(%NULL, byval %IDC_ARROW) wc.hbrBackground = %COLOR_WINDOWFRAME wc.lpszClassName = varptr(szClassName) wc.lpszMenuName = %NULL if (RegisterClassEx(wc) = %FALSE) then MessageBox %HWND_DESKTOP, "Unable to register window class", "message", %MB_OK or %MB_ICONERROR exit function end if control add "SysGrid32", cbhndl, 100, "", 8, 8, 32, 14, %WS_CHILD or %WS_VISIBLE end select end function function pbmain as long dim hdlg as local long dialog new %NULL, "KeyDown test", 1, 1, 256, 256, %WS_OVERLAPPEDWINDOW, %WS_EX_TOOLWINDOW to hdlg dialog show modal hdlg call dlgproc end function
Cheers
Comment