Created
April 27, 2012 19:28
-
-
Save enkore/2512070 to your computer and use it in GitHub Desktop.
Ctrl+A (Select All) with edit controls without ES_MULTILINE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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