C#中使用WIN32函数的回调函数
完善了“如何在C#中使用Win32和其他库”中关于EnumDesktops()函数的回调代码,可运行。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication1
{
class Program
{
delegate bool EnumDesktopProc([MarshalAs(UnmanagedType.LPTStr)]string desktopName, int lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern bool EnumDesktops(IntPtr windowStation, EnumDesktopProc callback, int lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr GetProcessWindowStation();
static bool OnDesktop(string name, int param)
{
Console.WriteLine(name);
return true;
}
static void Main(string[] args)
{
EnumDesktops(GetProcessWindowStation(), OnDesktop, 0);
}
}
}
相关文档:
1.asp.net呼叫js
Response.Write("<script language=javascript>");
&n ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace 将枚举作为键值的形式存储
{
enum Myenum
{
First=3,
Second ......
原文地址:http://msdn.microsoft.com/zh-cn/library/79b3xss3(VS.80).aspx
静态类和类成员用于创建无需创建类的实例就能够访问的数据和函数。静态类成员可用于分离独立于任何对象标识的数据和行为:无论对象发生什么更改,这些数据和函数都不会随之变化。当类中没有依赖对象标识的数据或行为时, ......
字符串的宽度自适应容器
Graphics g = Graphics.fromImage(new Bitmap(1, 1));
SizeF size = g.MeasureString(lblTitle.Text, new Font("宋体", 24 * 0.0625F, FontStyle.Bold));
float oldSize=(800*0.0625F);//1px=0.0625em
float newSize = (0.75F/size.Width )* oldSize;
size.Width 的单 ......
* Copyright all(c) 2005 ZhongFeng, http://blog.csdn.net/SW515 */
public class ValidateCode : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
this.CreateCheckCodeImage(GenerateCheckCode());
}
&nb ......