How can I simulate a mouse click at a certain position on the screen?

Here’s a code that is using unmanaged functions to simulate mouse clicks : //This is a replacement for Cursor.Position in WinForms [System.Runtime.InteropServices.DllImport(“user32.dll”)] static extern bool SetCursorPos(int x, int y); [System.Runtime.InteropServices.DllImport(“user32.dll”)] public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); public const int MOUSEEVENTF_LEFTDOWN = 0x02; public const int MOUSEEVENTF_LEFTUP = …

Read more

How to get current working directory path c#?

You can use static Directory class – however current directory is distinct from the original directory, which is the one from which the process was started. System.IO.Directory.GetCurrentDirectory(); So you can use the following to get the directory path of the application executable: System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

What exactly is “managed” code?

When you compile C# code to a .exe, it is compiled to Common Intermediate Language(CIL) bytecode. Whenever you run a CIL executable it is executed on Microsofts Common Language Runtime(CLR) virtual machine. So no, it is not possible to include the VM withing your .NET executable file. You must have the .NET runtime installed on …

Read more


No need for Linq, just use dynamic (using Json.Net) dynamic obj = JObject.Parse(json); Console.WriteLine((string); Linq version would not be much readable JObject jObj = JObject.Parse(json); var url = (string)jObj.Descendants() .OfType<JProperty>() .Where(p => p.Name == “url”) .First() .Value; Documentation: LINQ to JSON