public struct POINTAPI
{
public int x;
public int y;
}
public static void GetWindowfromPoint(ref int hwnd,ref StringBuilder winText,ref StringBuilder clsName,ref StringBuilder pText)
{
int parentHandle=0;
int maxLen=128;
POINTAPI pnt = new POINTAPI();
parentHandle=GetCursorPos(ref pnt);
hwnd=WindowfromPoint(pnt.x,pnt.y);
winText =new StringBuilder(maxLen);
parentHandle=GetWindowText(hwnd,winText,maxLen);
clsName=new StringBuilder(maxLen);
parentHandle=GetClassName(hwnd,clsName,maxLen);
pText=new StringBuilder(maxLen);
parentHandle=GetParent(hwnd);
parentHandle=GetWindowText(parentHandle,pText,maxLen);
}
测试语法高亮的 C# 代码的 html fragment 生成:
用csdn blog API 发布.
下面是:
public class HtmlWriter
{
static Dictionary _colors;
static int _colorNum;
static StringBuilder _colorString;
C#正则表达式编程(三):Match类和Group类用法 收藏 此文于2010-03-09被推荐到CSDN首页
如何被推荐?
前面两篇讲述了正则表达式的基础和一些简单的例子,这篇将稍微深入一点探讨一下正则表达式分组,在.NET中正则表达式分组是用Math类来代表的。
首先先看一段代码:
view plaincopy to clipboardprint?
/// &l ......
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 ......
在net中有一个至关重要的关键字,那就是using
using一般有着以下几种用法:
1、直接引入命名空间
a、using System ,这个是最常用的,就是using+命名空间,这样就可以直接使用命名空间中的类型,而免去了使用详细的命名空间
b、使用全限定名
不用使用using System;直接在程序中调用System.Console.WriteLine("Hello ......
今天看了我的老师钟声的书《Java程序员上班那点儿事》,其中有一段关于Java实现动态编译的代码使我很受启发,决定在.NET中尝试一下。
引入下列命名空间:
using System.CodeDom;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
C#代码:
&n ......