Microsoft Temasはマウスイベントを起こさないまま5分間放置すると「離席中表示になる」

離席中の間は通知も飛ばないので不便なので,

#include <Windows.h>
#include <winuser.h>

#include <iostream>
using namespace std;

int main() {
  POINT point_old;
  int same_point_cnt = 0;
  GetCursorPos(&point_old);
  cout << "start" << endl;
  while(1){
    Sleep(1000 * 60);

    POINT point_new;
    GetCursorPos(&point_new);
    cout << point_new.x << " " << point_new.y << " " << endl;
    if(point_old.x == point_new.x && point_old.y == point_new.y){
      same_point_cnt++;
      cout << same_point_cnt << endl;
    }else{
      same_point_cnt = 0;
      swap(point_old, point_new);
      cout << "reset" << endl;
      continue;
    }

    if(same_point_cnt == 3){
      cout << "execute" << endl;
      same_point_cnt = 0;
      mouse_event(1, 0, 0, 0, 0);
      GetCursorPos(&point_old);
    }

  }
  return 0;
}

dllに依存しないようにコンパイルする場合は--statcフラグを付ける

参考