Skip to content

Instantly share code, notes, and snippets.

@enkore
Created April 27, 2012 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enkore/2512070 to your computer and use it in GitHub Desktop.
Save enkore/2512070 to your computer and use it in GitHub Desktop.
Ctrl+A (Select All) with edit controls without ES_MULTILINE
LRESULT CALLBACK EditWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_KEYDOWN:
switch(wParam) {
case 'A': // Ctrl+A = select all
if(GetKeyState(VK_CONTROL) & 0x8000) {
SendMessage(hWnd, EM_SETSEL, 0, -1);
}
break;
}
}
return CallWindowProc(EditPrevWndProc, hWnd, message, wParam, lParam);
}
...
EditPrevWndProc = reinterpret_cast<WNDPROC>(SetWindowLong(hEdit, GWL_WNDPROC, reinterpret_cast<LONG>(&EditWindowProc)));
// EditPrevWndProc is a global variable, is the same for all edit controls...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment