E
E
ElderHobo2016-07-01 01:16:29
C++ / C#
ElderHobo, 2016-07-01 01:16:29

C++/cli win forms global click interception?

It is necessary to force the stream to turn on when a key is pressed. Windows Forms generally does not work well with an event such as pressing a physical button. And you need to make it so that it detects pressing even when there is no focus on the form, that is, it is collapsed. It is necessary that the loop inside the thread work while the key is pressed.

public: void Thread()
       {
         do {

          //делаем чота

           Sleep(300);
         } while (checkBox1->Checked);

       }

  //тут мы зажимаем клавишу 
  {
    Thread^ myThread2;
    myThread2 = gcnew Thread(gcnew ThreadStart(this, &MyForm::Thread));
    myThread2->Start();
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2016-07-01
@Rou1997

WinAPI GetAsyncKeyState, and .NET doesn't really have a standard "wrapper" for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question