资源简介
遍历已知父窗里子窗所有句柄 的实例
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsHwndDemo
{
public partial class Form1 : Form
{
///
/// 取得父窗体的句柄(顶级窗体)
///
///
///
///
[DllImport(“user32.dll“)]
private static extern IntPtr FindWindow(string lpClassName string lpWindowName);
///
/// 用于枚举子窗体是的委托
///
/// 窗体句柄
/// 自定义
///
public delegate bool EnumChildWindow(IntPtr WindowHandle string num);
///
/// 获取指定窗体的所有子窗体
///
/// 窗体句柄
/// 回调委托
/// 自定义
///
[DllImport(“User32.dll“)]
public static extern int EnumChildWindows(IntPtr WinHandle EnumChildWindow ecw string name);
///
/// 获取指定窗体的标题
///
/// 窗体句柄
/// tle“>缓冲区取用于存储标题
/// 缓冲区大小
///
[DllImport(“User32.dll“)]
public static extern int GetWindowText(IntPtr WinHandle StringBuilder title int size);
//获取窗口Text
[DllImport(“user32.dll“)]
public static extern int GetWindowText(int hWnd IntPtr lpString int nMaxCount);
///
/// 获取窗体类型
///
/// 窗体句柄
/// 类型
/// 缓冲区大小
///
[DllImport(“user32.dll“)]
public static extern int GetClassName(IntPtr WinHandle StringBuilder Type int size);
///
/// 根据句柄获得进程id值
///
/// 句柄
///
///
[DllImport(“user32“)]
private static extern int GetWindowThreadProcessId(IntPtr handle out int pid);
const int WM_GETTEXT = 0x000D;
const int WM_SETTEXT = 0x000C;
const int WM_CLICK = 0x00F5;
///
/// 发送字符串给指定的控件(一般都是文本框)
///
///
///
///
///
///
[DllImport(“User32.dll“ EntryPoint = “SendM
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 20992 2016-11-23 16:53 WindowsFormsHwndDemo\.vs\WindowsFormsHwndDemo\v14\.suo
文件 189 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\App.config
文件 10752 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\bin\Debug\WindowsFormsHwndDemo.exe
文件 189 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\bin\Debug\WindowsFormsHwndDemo.exe.config
文件 22016 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\bin\Debug\WindowsFormsHwndDemo.pdb
文件 22696 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\bin\Debug\WindowsFormsHwndDemo.vshost.exe
文件 189 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\bin\Debug\WindowsFormsHwndDemo.vshost.exe.config
文件 490 2015-07-10 19:01 WindowsFormsHwndDemo\WindowsFormsHwndDemo\bin\Debug\WindowsFormsHwndDemo.vshost.exe.manifest
文件 6312 2016-11-23 17:17 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Form1.cs
文件 2070 2016-11-23 17:05 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Form1.Designer.cs
文件 5817 2016-11-23 17:05 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Form1.resx
文件 868 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7317 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 1149 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\WindowsFormsHwndDemo.csproj.FileListAbsolute.txt
文件 1012 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\WindowsFormsHwndDemo.csproj.GenerateResource.Cache
文件 2384 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\WindowsFormsHwndDemo.csprojResolveAssemblyReference.cache
文件 10752 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\WindowsFormsHwndDemo.exe
文件 180 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\WindowsFormsHwndDemo.Form1.resources
文件 22016 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\WindowsFormsHwndDemo.pdb
文件 180 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\obj\Debug\WindowsFormsHwndDemo.Properties.Resources.resources
文件 532 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Program.cs
文件 1348 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Properties\AssemblyInfo.cs
文件 2853 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Properties\Resources.Designer.cs
文件 5612 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Properties\Resources.resx
文件 1107 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Properties\Settings.Designer.cs
文件 249 2016-11-23 16:53 WindowsFormsHwndDemo\WindowsFormsHwndDemo\Properties\Settings.settings
文件 3938 2016-11-23 17:16 WindowsFormsHwndDemo\WindowsFormsHwndDemo\WindowsFormsHwndDemo.csproj
............此处省略15个文件信息
- 上一篇:数据结构 简单的目录管理系统
- 下一篇:连杆盖工艺设计!!!!!!!!!!!!
评论
共有 条评论