Knowledge Base Nr: 00257 moussimul.cpp - http://www.swe-kaiser.de
Downloads:
win32: maus simulieren (link-/rechtsklick, doppelklick an beliebiger position)
void CProcessSupport::DoMouseClick(int x, int y, bool bRightClick, bool bDoubleClick)
{
for (int n=0; n<(bDoubleClick ? 2 : 1); n++)
{
::SetCursorPos(x, y);
mouse_event( bRightClick ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_LEFTDOWN,
0, // horizontal position or change
0, // vertical position or change
0, // wheel movement
NULL // application-defined information
);
Sleep(100);
::SetCursorPos(x+2, y);
mouse_event( bRightClick ? MOUSEEVENTF_RIGHTUP : MOUSEEVENTF_LEFTUP,
0, // horizontal position or change
0, // vertical position or change
0, // wheel movement
NULL // application-defined information
);
Sleep(100);
}
}