Skip to main content
spelling
Source Link
Jason Aller
  • 3.7k
  • 28
  • 43
  • 40

I am currently developing a C# .NET console application on my computer wichwhich allows me to move a virtual joystick by mouvingmoving my mouse to the joystick and pressing down(currently not implemented) and moving the mouse up and down to move vorwardforward etc.  (in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 

I am currently developing a C# .NET console application on my computer wich allows me to move a virtual joystick by mouving my mouse to the joystick and pressing down(currently not implemented) and moving the mouse up and down to move vorward etc.(in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 

I am currently developing a C# .NET console application on my computer which allows me to move a virtual joystick by moving my mouse to the joystick and pressing down(currently not implemented) and moving the mouse up and down to move forward etc.  (in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 
added 164 characters in body
Source Link

I am currently developing a C# .NET console application on my computer wich allows me to move a virtual joystick by mouving my mouse to the joystick and pressing down(currently not implemented) and moving the mouse up and down to move vorward etc.(in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 

I am currently developing a C# .NET console application to move a virtual joystick (in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 

I am currently developing a C# .NET console application on my computer wich allows me to move a virtual joystick by mouving my mouse to the joystick and pressing down(currently not implemented) and moving the mouse up and down to move vorward etc.(in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 
deleted 9 characters in body; edited title
Source Link
General Grievance
  • 5.1k
  • 39
  • 40
  • 60

Simulate mouse input on touchscreen without handicapping user input

I am currently developing a C# .NET console application to move a virtual joystick (in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 

Thanks!

Simulate mouse input without handicapping user input

I am currently developing a C# .NET console application to move a virtual joystick (in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 

Thanks!

Simulate mouse input on touchscreen without handicapping user input

I am currently developing a C# .NET console application to move a virtual joystick (in any game like Brawl Stars, etc.). I set up a Samsung Flow smartphone screen, which allows me to access my phone from my computer, and I created a script that moves my mouse to the position of the joystick.

However, I now have the problem that I can't use my mouse while the program is running because it is constantly being "teleported" to the joystick. Additionally, I want to do the same with another joystick, but obviously, I can't have two cursors.

So, how can I simulate mouse movement and clicking without having to give up control of my real cursor?

Here is the code I'm currently using:

[DllImport("user32.dll")] static extern short GetAsyncKeyState(int vKey); [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); const int VK_W = 0x57; const int VK_S = 0x53; const int VK_A = 0x41; const int VK_D = 0x44; const int VK_P = 0x50; static bool running = false; static void Main() { Console.WriteLine("Press 'P' to start/stop the process."); while (true) { if (GetAsyncKeyState(VK_P) < 0) { running = !running; Console.WriteLine(running ? "Process started." : "Process stopped."); Thread.Sleep(500); } if (running) { walk(); } Thread.Sleep(100); } } static void walk() { int x = 0; int y = 0; if (GetAsyncKeyState(VK_W) < 0) { y += 132; } if (GetAsyncKeyState(VK_S) < 0) { y -= 132; } if (GetAsyncKeyState(VK_A) < 0) { x -= 132; } if (GetAsyncKeyState(VK_D) < 0) { x += 132; } SetCursorPos(295 + x, 823 + y); } 
edited tags; edited title
Link
General Grievance
  • 5.1k
  • 39
  • 40
  • 60
Loading
Source Link
Loading