Hi,
I am creating a small Windows application in Visual Studio 2010 that will detect the window name and if the window name matches the required window name, it will capture the mouse scroll events and accordingly press some function keys. To implement this, so that the process works even when it is not the active form, I need to create threads that will keep on monitoring and keep on triggering the events accordingly. For this, I have created functions
1) GetActiveWindowTitle() that fetches the current active window
2) Form1_MouseWheel(object sender, MouseEventArgs e) that detects the mouse activity and sets the value of a parameter mouseScrolldetector based on the value of e.Delta;
3) ThreadRunner class that is a class that can be used to run the thread. It contains a function DetectMouseScroll(int mouseScrollDetectorBIt)that detects the value of MouseScrolldetector and accordingly presses the function keys.
4) Now to trigger the event, I am using the following code :-
int mouseScrolldetector;
Thread thr;
ThreadRunner tr = new ThreadRunner();
thr = new Thread(new ThreadStart(tr.DetectMouseScroll(mouseScrolldetector)));
OR
thr = new Thread(new ParameterizedThreadStart(tr.DetectMouseScroll(mouseScrolldetector)));
But both of them are showing the following error : method name expected
If I change it to
thr = new Thread(new ThreadStart(tr.DetectMouseScroll));
OR
thr = new Thread(new ParameterizedThreadStart(tr.DetectMouseScroll));
then it is showing ‘no overload for the “DetectMouseScroll” matches the delegate ‘System.Threading.ParameterizedThreadStart’
Anyone has any idea of why the error Method Name expected is being shown and how to run the parameterized thread, without error
Thanks in Advance
Jashobanta Chakraborty