C
C#8mo ago
Mustafa

✅ Receiving Input While Minimized (WinForms C#)

Pretty general question here. How would I go about receiving input from my user while they aren't tabbed into the program or have a different window as their foreground window? I'm using the InputSimulator Nuget package (InputSimulatorStandard version), and I'd like for my program to send inputs to a game window when it receives controller input. My only issue, now, is that the controller input isn't received unless I have my application as the foreground window.
private async void T_Tick(object sender, EventArgs e)
{
if (Gamepad.Gamepads.Count > 0)
{
Controller = Gamepad.Gamepads.First();
var Reading = Controller.GetCurrentReading();
switch (Reading.Buttons) {
case GamepadButtons.DPadUp:
Process[] process = Process.GetProcessesByName("RobloxPlayerBeta");

Process robloxProcess = process.FirstOrDefault();
if (robloxProcess != null)
{
IntPtr h = robloxProcess.MainWindowHandle;
SetForegroundWindow(h);
await Log("We're tabbed in");
InputSimulator inputSim = new InputSimulator();
inputSim.Mouse.VerticalScroll(3);
}
break;
// add other buttons here
}
return;
}
}
private async void T_Tick(object sender, EventArgs e)
{
if (Gamepad.Gamepads.Count > 0)
{
Controller = Gamepad.Gamepads.First();
var Reading = Controller.GetCurrentReading();
switch (Reading.Buttons) {
case GamepadButtons.DPadUp:
Process[] process = Process.GetProcessesByName("RobloxPlayerBeta");

Process robloxProcess = process.FirstOrDefault();
if (robloxProcess != null)
{
IntPtr h = robloxProcess.MainWindowHandle;
SetForegroundWindow(h);
await Log("We're tabbed in");
InputSimulator inputSim = new InputSimulator();
inputSim.Mouse.VerticalScroll(3);
}
break;
// add other buttons here
}
return;
}
}
This timer runs when a checkbox is on, and is stopped when that checkbox is turned off. It functions fine, but I can't receive said controller input unless the app is opened, which kind of ruins the whole point of this functionality.
17 Replies
Yawnder
Yawnder8mo ago
You're violating ToS. Don't expect help from anyone in this server with that.
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Mustafa
MustafaOP8mo ago
What T.O.S. have I violated? No. Controller players on Roblox can't zoom in/out properly and it's extremely limited, so I'm creating an external program which will scroll up/down for them using dpad up/down. there's no hacking or autofarm involved it is literally just for zooming in or out
Mustafa
MustafaOP8mo ago
No description
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Mustafa
MustafaOP8mo ago
I mean, I don't see why not It's similar to a macro it's basically just rebinding scroll because if you join a game on controller
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Mustafa
MustafaOP8mo ago
this is like the farthest you can zoom out
No description
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Mustafa
MustafaOP8mo ago
nah im saying i don't think there's anything in their tos that's against it so i don't see why this is against the t.o.s.
Mustafa
MustafaOP8mo ago
No description
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Mustafa
MustafaOP8mo ago
alright
Mustafa
MustafaOP8mo ago
@TeBeClone
No description
Mustafa
MustafaOP8mo ago
gonna be remaking this just posting this here in case anyone says i didn't get approval
Yawnder
Yawnder8mo ago
Great!
Want results from more Discord servers?
Add your server