I am trying to make a MFC Program using Myo.
I made several combo box control for each gesture.
This is my plan.
When I select an option of combo box, It should work as a real mouse.
(e.g. : If I choose option(Left Click),
it should allow me to do Left click when I take a pose "Fist" && Myo is in unlock state.
void CMyoControllerView::OnCbnSelchangeComboFist() {
int nIndex = m_combo_Fist.GetCurSel();
if(nIndex == 0) {// Left Click
if(collector.isUnlocked == true && collector.currentPose == myo::Pose::fist) {
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, NULL);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, NULL);
}
}
}
However, this code only affects mouse just when I change the option(ONLY ONE TIME!).
I know that I should not put this code in control event code.
The problem is that I have no idea where should I put it.
I want to make this function working continuously until I finish this program.
(Like a thread.. I have five combo box and each has different mouse event. All five function should be working together.)
Please give me some advices.
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…