static void postMessage(int x, int y, unsigned int msg) { HWND hwnd = windowFromPoint(x, y); if(hwnd!=NULL) { PostMessage(hwnd, msg, 0, (y << 16 | x)); } else { std::cout << "No Window Error (In Native Code)" << std::endl; } }
/* * Class: NativeMacro * Method: scrollDown * Signature: ()V */ JNIEXPORT void JNICALL Java_NativeMacro_scrollDown (JNIEnv * env, jobject jobj, jint x, jint y, jint lines) { HWND hwnd = windowFromPoint(x, y); if(hwnd!=NULL) { for(int a = 0; a < lines; a++) { PostMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0); } } else { std::cout << "No Window Error (In Native Code)" << std::endl; } }
void AutoSelectMode::onMouseMove(__in int x, __in int y) { if (x == m_iPrevMouseXPos && y == m_iPrevMouseYPos) { return; } m_iPrevMouseXPos = x; m_iPrevMouseYPos = y; UIScreenCaptureMgr::Instance()->changeBkCursor(FALSE); if (ScreenCommon::isLButtonDown()) { return; } ScreenCaptureWndInfo *wndInfo = windowFromPoint(x, y); if (wndInfo->getHwnd() != m_hPrevMouseWindow) { m_hPrevMouseWindow = wndInfo->getHwnd(); UIScreenCaptureMgr::Instance()->sendBkgMessage(WM_SNAPSHOT_MOUSE_WINDOW_CHANGE, 0, (LPARAM)wndInfo->getRect()); } }
static void postKeyMessage(int x, int y, unsigned int msg) { SetForegroundWindow(windowFromPoint(x, y)); switch(msg) { case 'a' : pressKey(A); break; case 'b' : pressKey(B); break; case 'A' : pressShifted(A);break; case '1' : pressKey(ONE); break; case '2' : pressKey(TWO); break; case '3' : pressKey(THREE); break; case '4' : pressKey(FOUR); break; case '5' : pressKey(FIVE); break; case '6' : pressKey(SIX); break; case '7' : pressKey(SEVEN); break; case '8' : pressKey(EIGHT); break; case '9' : pressKey(NINE); break; case '0' : pressKey(ZERO); break; case '\t' : pressKey(TAB); break; case '\n' : pressKey(ENTER); break; } }