易截截图软件、单文件、免安装、纯绿色、仅160KB

c#利用winapi遍历桌面控件算法

public enum GUIInfoType
{
     guiText.
     guiTextClass,
     guiTextParent,
     guiTextClassParent,
}
private static int level=0
public static int FindGUILike(ref int hWndArray,int hWndStart,ref string windowText,ref string className,ref string parentText)
{
int hwnd=0;
int r=0;
StringBuilder sWindowText=new StringBuilder();
StringBuilder sClassname=new StringBuilder();
StringBuilder sParentText=new StringBuilder();
if(level==0)
{
  hWndTarget=0;
  if(hWndTarget==0) hWndStart = GetDesktopWindow();
}
level=level+1;
hwnd=GetWindow(hWndStart,GW_CHILD);
while(hwnd!=0)
{
   r=FindGUILike(ref hWndArray,hwnd windowText,ref classname,ref parentText);
   sWindowText.Capacity=255;
   r=GetClassName(hwnd,sWindowsText,255);
  sClassname.Capacity=255;
  r=GetWindowText(GetParent(hwnd),sParentText,225);
  GUIInfoType guiInfoType=GetGUIInfoType(windowText,className,parentText);
  ResetGUIInfo(guiInfoType,hwnd,ref hWndArray,ref windowText,ref className,ref parentText,sWindowText,sClassname,sParentText);
  hwnd=GetWindow(hwnd,GW_HWNDNEXT);
}
level=level-1;
return 0;
}
private static GUIInfoType GetGUIInfoType(string winText,string winClass,string winTextParent)
{
  if(winText!=''&&winClass!=''&winTextParent=='')
    return GUIInfoType.guiTextClass;
  else if(winText!=''&&winClass==''&winTextParent!='')
   return GUIInfoType.guiTextParent;
  else if(winText!=''&&winClass!=''&winTextParent=='')
    return GUIInfoType.guiClassParent;
  return GUIInfoType.guiText;
}
private static void ResetGUIInfo(GUIInfoType guiInfoType,int hwnd,ref int hWndTarget,ref string windowText,ref string className,ref string parentText,StringBuilder sParentText)
{
  string clsStartedWith='';
  if(clas


相关文档:

在Asp.net(C#) 中使用 ReportViewer

a. ReportViewer关联Report1.rdlc的简单呈现
b. 对带有报表参数的Report1.rdlc的呈现
c.
利用程式生成的DataSet 填充报表
d. 调用存储过程 生成DataSet 填充报表
==========
简单的呈现
==========
1. 打开VS2005,文件->新建->网站 选择语言种类(C#)
2. 在该解决方案下
设计其已经生成的Default.aspx ......

测试语法高亮的 C# 代码的 html fragment 生成

测试语法高亮的 C# 代码的 html fragment 生成:
用csdn blog API 发布.
下面是:
public class HtmlWriter
{
   static Dictionary _colors;
   static int _colorNum;
   static StringBuilder _colorString;

C#调用 win32遍历win桌面控件的算法

private static int level=0
public static int FindGUILike(ref int hWndArray,int hWndStart,ref string windowText,ref string className,ref string parentText)
{
int hwnd=0;
int r=0;
StringBuilder sWindowText=new StringBuilder();
StringBuilder sClassname=new StringBuilder();
StringBuilder sParentT ......

c# using 关键字的用法


在net中有一个至关重要的关键字,那就是using
using一般有着以下几种用法:
1、直接引入命名空间
a、using System ,这个是最常用的,就是using+命名空间,这样就可以直接使用命名空间中的类型,而免去了使用详细的命名空间
b、使用全限定名
不用使用using System;直接在程序中调用System.Console.WriteLine("Hello ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号