Forcing a Mouse Click
BlitzPlus Forums/BlitzPlus Programming/Forcing a Mouse Click| 
 | ||
| Does anyone know of a way to make the mouse click on a location without actually having to have a person do it manually?  I've been working on writing an auto-clicking program but it never occurred to me to see if Blitz was able to click the mouse by itself.  Any help or info would be appreciated. | 
| 
 | ||
| Someone just posted some code in the archives, for blitzmax, however, but it was easily possible with API calls. | 
| 
 | ||
| Function SimulateMouseClick(x%, y%) cur_x% = MouseX():cur_y% = MouseY() api_SetCursorPos(x%, y%) api_mouse_event($0201, 0, 0, 0, 0) api_mouse_event($0202, 0, 0, 0, 0) api_SetCursorPos(cur_x%, cur_y%) End Function | 
| 
 | ||
| needs a .decls file, too .lib "user32.dll" api_SetCursorPos% (x%, y%) : "SetCursorPos" api_mouse_event (dwFlags%, dx%, dy%, cButtons%, dwExtraInfo%) : "mouse_event" | 
| 
 | ||
| Just read on MSD the 'mouse_event' command is not supposed to be used anymore, you're supposed to use SendInput. meh. | 
| 
 | ||
| Let me guess, because of the new and cool OS Vista? |