-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatTextArea.h
More file actions
41 lines (36 loc) · 912 Bytes
/
ChatTextArea.h
File metadata and controls
41 lines (36 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "rfc/rfc.h"
#include "CustomMessages.h"
class ChatTextArea : public KTextArea
{
public:
LRESULT OnKeyDown(WPARAM wParam, LPARAM lParam)
{
// Check if Ctrl+S is pressed
if ((GetKeyState(VK_CONTROL) & 0x8000) && wParam == 'S')
{
::PostMessageW(compParentHWND, RFC_CUSTOM_MESSAGE, CTRL_S_PRESSED_MSG, 0);
return 0; // Stop further processing
}
else
{
return KTextArea::WindowProc(compHWND, WM_KEYDOWN, wParam, lParam);
}
}
LRESULT OnWMChar(WPARAM wParam, LPARAM lParam)
{
// Prevent the beep for Ctrl+S by ignoring WM_CHAR when Ctrl is pressed
if ((GetKeyState(VK_CONTROL) & 0x8000) && wParam == 19) // 19 is the ASCII value of Ctrl+S
{
return 0;
}
else
{
return KTextArea::WindowProc(compHWND, WM_CHAR, wParam, lParam);
}
}
BEGIN_KMSG_HANDLER
ON_KMSG(WM_KEYDOWN, OnKeyDown)
ON_KMSG(WM_CHAR, OnWMChar)
END_KMSG_HANDLER(KTextArea)
};