C#枚举其他进程中具有滚动条的控件

来源:百度知道 编辑:UC知道 时间:2024/06/14 09:46:16
象Spy++那样,枚举所有的别的进程的控件。只是要求控件具有WS_VSCROLL和WS_HSCROLL的Style(即具有滚动条的控件)。
我的编程需要控制其他进程的滚动条,因为编程的时候我不能确定要发消息给哪个窗口,所以我要列出具有滚动条控件的窗口标题给用户选择。
我知道是用FindWindowEx一一列举,但是不知道如何判断控件是否具有滚动条,只列举具有滚动条的控件的主窗口标题。要怎么实现?请给出C#代码。

这个确实实现不了。在VC中可以实现,
但你可以近似地模仿。
在VC的钩子中也可以实现,后来Visual版本,好像都没有这个功能 了。
换其它的方法吧。
给你偏文章,参考一下,不知道对你有没有用。

Set a mouse hook
To set a hook, call the SetWindowsHookEx function from the User32.dll file. This function installs an application-defined hook procedure in the hook chain that is associated with the hook.

To set a mouse hook and to monitor the mouse events, follow these steps: 1. Start Microsoft Visual Studio .NET.
2. On the File menu, point to New, and then click Project.
3. In the New Project dialog box, click Visual C# Projects under Project Types, and then click Windows Application under Templates. In the Name box, type ThreadSpecificMouseHook. By default, a form that is named Form1 is created.
4. Add the following line of code in the Form1.cs file after the other using statements.using System.Runtime.InteropServices;

5. Add following code in the Form1 class.public delegate int HookProc(int nCode, IntPtr w