Home > Software design >  Some applications don't respond to win32gui clicks
Some applications don't respond to win32gui clicks

Time:12-23

Background: I was trying to program an auto clicker to click in the background to an application (Roblox, not trying to do anything malicious). I was able to get the window and perform commands like closing it. However, when trying to send clicks to the window it returns 0. (I'm using SendMessage so I don't activate the window)

Minimum reproducible example:

import win32gui
import win32con
import win32api

hwnd = win32gui.FindWindow(None, "Roblox")


while True:
    lParam = win32api.MAKELONG(100, 100)
    temp = win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, None, lParam)
    win32gui.SendMessage(hwnd, win32con.WM_LBUTTONUP, None, lParam)
    print(temp)

Things I tried:

  1. I tried changing the window to see if it was the wrong window, or if it didn't see the window
  2. I tried sending the message normally:
lParam = win32api.MAKELONG(100, 100)  # Get the coordinates and change to long
temp = win32gui.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, None, lParam)  # Send message to handle
win32gui.SendMessage(hwnd, win32con.WM_LBUTTONUP, None, lParam)  # Release key from sent message to handle
  1. I tried it with other windows, and it worked, but not for Roblox
  2. I tried with other commands and it works, but clicks don't. This works: (So I know it's the right window)
temp = win32gui.SendMessage(hwnd, win32con.WM_CLOSE, 0, 0)  # Close window with SendMessage

CodePudding user response:

All roblox games will allow manual clicks. However, some games may deny the signals as it may give the players unfair advantages over other players. I, as a lua developer myself, stop players from autoclicking as it will ruin the whole point of my tycoon.

CodePudding user response:

Some Roblox games prevent auto clicking.

  • Related