question

bobuckman-8186 avatar image
0 Votes"
bobuckman-8186 asked Castorix31 answered

How to make key detection while the application is running in C++/CLR

Hi, a VC++ noob here that needs some help please.
So I have a C++/CLR .NET Form. What I want to achieve is while the application is running and you press a button then a message box appears with the message of the key you pressed. Anyone knows how to do this?

c++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
1 Vote"
Castorix31 answered

You can override ProcessCmdKey, like :

 protected: virtual bool ProcessCmdKey(Message% msg, Keys keyData) override
 {
     MessageBox::Show(keyData.ToString());
     return Form::ProcessCmdKey(msg, keyData);
 }

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.