Asp.net中防止用户多次登录的方法
摘要:在web开发时,有的系统要求同一个用户在同一时间只能登录一次,也就是如果一个用户已经登录了,在退出之前如果再次登录的话需要报错。 常见的处理方法是,在用户登录时,判断此用户是否已经在Application中存在,如果存在就报错,不存在的话就加到Application中(Application是所有Session共有的,整个web应用程序唯一的一个对象):以下是引用片段: stringstr...
阅读全文
posted @
2010-03-29 18:30
一路前行
阅读(390)
推荐(0) 编辑
在asp.net中使用线程
摘要:做一个任务类,在客户端时时(暂且刷新时间为1秒)得知任务执行了多少时间,并且在成功完成任务后给出执行时间,在任务出错的时候给出出错的时间。前台<form id="Form1" method="post" runat="server"><asp:label id="lab_state" runat="server"></asp:label><br>&l...
阅读全文
posted @
2010-03-29 18:29
一路前行
阅读(301)
推荐(0) 编辑
web弹出对话框
摘要:基本介绍:showModalDialog() (IE 4+ 支持)showModelessDialog() (IE 5+ 支持)window.showModalDialog()方法用来创建一个显示HTML内容的模态对话框。window.showModelessDialog()方法用来创建一个显示HTML内容的非模态对话框。使用方法:vReturnValue = window.showModalDi...
阅读全文
posted @
2010-03-29 18:29
一路前行
阅读(462)
推荐(0) 编辑
DirectX程序例子
摘要:自己的第一个DX程序,开始学习的第一步#include<d3d9.h>LPDIRECT3D9 g_pD3D ;LPDIRECT3DDEVICE9 g_pd3dDevice ;HRESULT InitD3D(HWND hWnd){ if(NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION))) { return E_FAIL; } D3DP...
阅读全文
posted @
2010-03-29 18:24
一路前行
阅读(604)
推荐(0) 编辑
在VC中使用线程
摘要:下面是在重载了MFC中的线程操作类,这样的操作是线程安全的#include <afxwin.h>#include <iostream.h>class CUserThread : public CWinThread{public: CUserThread(AFX_THREADPROC ThreadProc); static UINT ThreadFunc(LPVOID lpa...
阅读全文
posted @
2010-03-29 18:22
一路前行
阅读(321)
推荐(0) 编辑
C++调用DLL
摘要:/* 文件名:lib.h */#ifndef LIB_H#define LIB_Hextern "C" int __declspec(dllexport) add(int x, int y);#endif/* 文件名:lib.cpp */#include "lib.h"int add(int x, int y){return x + y;}
阅读全文
posted @
2010-03-29 18:21
一路前行
阅读(322)
推荐(0) 编辑
.NET中调用API要点
摘要:在.Net Framework SDK文档中,关于调用Windows API的指示比较零散,并且其中稍全面一点的是针对Visual Basic .net讲述的。本文将C#中调用API的要点汇集如下,希望给未在C#中使用过API的朋友一点帮助。另外如果安装了Visual Studio .net的话,在C:\Program Files\Microsoft Visual Studio .NET\Fram...
阅读全文
posted @
2010-03-29 18:20
一路前行
阅读(360)
推荐(0) 编辑
C#自定义线程
摘要:二部分组成,一个线程管理类ThreadManager,一个线程类MyThreadTest类是用来测试的 1.ThreadManager.cs using System;using System.Threading;using System.Collections;namespace CustomThreadPool{/// <summary>/// 线程管理器,会开启或唤醒一个线程去执...
阅读全文
posted @
2010-03-29 18:20
一路前行
阅读(698)
推荐(0) 编辑
windows消息定义
摘要:WM_NULL 0 0 WM_CREATE 1 1 应用程序创建一个窗口WM_DESTROY? 2 2 一个窗口被销毁WM_MOVE 3 3 移动一个窗口WM_SIZE 5 5 改变一个窗口的大小WM_ACTIVATE 6 6 一个窗口被激活或失去激活状态WM_SETFOCUS 7 7 获得焦点后WM_KILLFOCUS 8 8 失去焦点WM_ENABLE A 10 改变enable状态WM_SE...
阅读全文
posted @
2010-03-29 18:19
一路前行
阅读(703)
推荐(0) 编辑
基于消息驱动的C#Windows程序
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;names...
阅读全文
posted @
2010-03-29 18:18
一路前行
阅读(312)
推荐(0) 编辑
C#使用事件
摘要:using System;namespace MyCollections { using System.Collections; public delegate void ChangedEventHandler(object sender, EventArgs e); public class ListWithChangedEvent: ArrayList { public event Chan...
阅读全文
posted @
2010-03-29 18:18
一路前行
阅读(201)
推荐(0) 编辑
.NET开发的一些小技巧
摘要:1.如何创建一个可改变大小没有标题栏的窗体?(Howtocreateaformwithresizingbordersandnotitlebar?)form1.Text=string.Empty;form1.ControlBox=false;2.如何在.NET的Windows窗体上启用XP主题集?(HowtouseXPThemeswithWindowsFormsusingthe.NET?)确认你的控...
阅读全文
posted @
2010-03-29 18:17
一路前行
阅读(381)
推荐(0) 编辑
C#调用WINDOWS API 要点
摘要:Api函数是构筑Windws应用程序的基石,每一种Windows应用程序开发工具,它提供的底层函数都间接或直接地调用了Windows API函数,同时为了实现功能扩展,一般也都提供了调用WindowsAPI函数的接口, 也就是说具备调用动态连接库的能力。Visual C#和其它开发工具一样也能够调用动态链接库的API函数。.NET框架本身提供了这样一种服务,允许受管辖的代码调用动态链接库中实现的非...
阅读全文
posted @
2010-03-29 18:16
一路前行
阅读(299)
推荐(0) 编辑
C#启动进程的方法
摘要:1.启动子进程,不等待子进程结束private void simpleRun_Click(object sender, System.EventArgs e){ System.Diagnostics.Process.Start(@"C:/listfiles.bat");}2.启动子进程,等待子进程结束,并获得输出private void runSyncAndGetResults_Click(ob...
阅读全文
posted @
2010-03-29 18:16
一路前行
阅读(896)
推荐(0) 编辑
C#下实现XP风格的按钮
摘要:XPButton.cs代码 using System; using System.Windows; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows .Forms ; namespace XPCtrl { /// <summary> /// XPButton 的摘要说明。 /// <...
阅读全文
posted @
2010-03-29 18:15
一路前行
阅读(333)
推荐(0) 编辑
提取网页中的超级链接
摘要:using System; using System.Xml; using System.Text; using System.Net; using System.IO; using System.Collections; using System.Text.RegularExpressions; public class App { public static void Main() { str...
阅读全文
posted @
2010-03-29 18:14
一路前行
阅读(437)
推荐(0) 编辑
17种正则表达式
摘要:"^\d+$" //非负整数(正整数 + 0) "^[0-9]*[1-9][0-9]*$" //正整数"^((-\d+)|(0+))$" //非正整数(负整数 + 0)"^-[0-9]*[1-9][0-9]*$" //负整数"^-?\d+$" //整数"^\d+(\.\d+)?$" //非负浮点数(正浮点数 + 0)"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([...
阅读全文
posted @
2010-03-29 18:13
一路前行
阅读(151)
推荐(0) 编辑
C#实现网页抓取函数
摘要://--需要引用usingSystem.Net以及usingSystem.IO;privatestringGetContentFromUrll(string_requestUrl){string_StrResponse="";HttpWebRequest_WebRequest=(HttpWebRequest)WebRequest.Create(_requestUrl);_WebRequest.Me...
阅读全文
posted @
2010-03-29 18:13
一路前行
阅读(318)
推荐(0) 编辑
C#反射运用
摘要:test.cs 信息using System;using System.Collections.Generic;using System.Text;namespace testclass{ public class Class1 { public string GetName1() { return "Get the name!"; } public string GetName2(string ...
阅读全文
posted @
2010-03-29 18:12
一路前行
阅读(263)
推荐(0) 编辑
C#实现托盘应用程序
摘要:下面是我根据网络上的应用程序改编的一个简单的托盘程序的DEMO,实现了一般托盘程序的基本功能using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Fo...
阅读全文
posted @
2010-03-29 18:09
一路前行
阅读(882)
推荐(0) 编辑
通过接口方式直接反射其接口类
摘要:加载DLL Assembly controlAssembly = Assembly.LoadFrom(DLLName); 获取加载对象的类型Type controlType = controlAssembly.GetType(ClassName); 加类型对象强制转换 _isoAdapter = (IRFIDISO180006BControlAdapter)Activator.CreateInst...
阅读全文
posted @
2010-03-29 18:09
一路前行
阅读(339)
推荐(0) 编辑
C#注册表操作方法
摘要:(一)写入 1.建立文件 建立一个注册表格式文件: *.reg,内容如下: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Test] "server"="192.168.66.22" "database"="NorthWind" "user"="XiaoWang" "Password"="123456" 其中: ...
阅读全文
posted @
2010-03-29 18:08
一路前行
阅读(265)
推荐(0) 编辑
C#学习网站
摘要:名称:快速入门地址http://chs.gotdotnet.com/quickstart/描述:本站点是微软.NET技术的快速入门网站,我们不必再安装.NET Framework中的快速入门示例程序,直接在网上查看此示例即看。****************************************************名称:微软官方.NET指导站点地址http://www.gotdotn...
阅读全文
posted @
2010-03-29 18:07
一路前行
阅读(1452)
推荐(0) 编辑
如何将方行的按纽改变为其他的形状
摘要:下面的代码为如何生成一个圆形的按纽的方法,主要功能的实现为调用了一系列的API来实现的.[System.Runtime.InteropServices.DllImport("gdi32")]private static extern IntPtr BeginPath(IntPtr hdc);[System.Runtime.InteropServices.DllImport("gdi32")]pri...
阅读全文
posted @
2010-03-29 18:07
一路前行
阅读(242)
推荐(0) 编辑
C#控件开发(五)
摘要:八、 提供可交互的属性视图 当你在Visual C# .NET中创建一个项目的时候,你可能会注意到属性窗口的工具栏上有一个像闪电的按钮,按下这个按钮属性窗口就会切换到事件视图,这样就可以来编辑事件处理了。 属性窗口的视图来自“属性页(Property Tabs)”,因此视图使用的最主要的类是PropertyTab,命名空间是System.Windows.Forms.Desi...
阅读全文
posted @
2010-03-29 18:06
一路前行
阅读(874)
推荐(0) 编辑
C#控件开发(四)
摘要:七、 编写和显示订制的类型 属性窗口中的编辑有如下三种工作方式:一,有些场合可以作为字符串来编辑,然后由TypeConverter来实现类型的转换。二,可以显示一个下拉列表来选择值。三,一个省略按钮提供其他的UI界面来编辑值,比如FileDialog和FontPicker。我们已经讲过了字符串形式,接着我们就来看下拉列表。 .NET framework已经包含了好几种下拉列表的例子,如Color,...
阅读全文
posted @
2010-03-29 18:05
一路前行
阅读(583)
推荐(0) 编辑
C#控件开发(三)
摘要:六、 扩展属性和字符串转换:TypeConverter和属性窗口 .NET属性窗口最重要的一个特性就是可以显示嵌套的属性,这样就提供了比属性类别更加细化和更有逻辑的分类。嵌套属性对于类目显示和排序显示都是适用的。这样可以让属性列表更加紧凑。比如我们用带有子属性X和Y的一个Location属性来代替Top和Left两个属性就更加合理。 不过,如何来决定一个属性可以展开呢?这些不是由属性窗口来决定,而...
阅读全文
posted @
2010-03-29 18:04
一路前行
阅读(618)
推荐(0) 编辑
C#控件开发(二)
摘要:五、 基础知识:使用Attribute来订制属性窗口的显示 控制显示的机制和用IDL定义的组件是一样的,不过是增加了元数据特性。控制显示使用最普遍的特性是BrowsableAttribute。默认状态下,属性窗口显示对象中定义的所有的公开的、可读的(即public、有get或者set方法的)属性,并且把他们放在“杂项(Misc)”类别中。下面是一个简单的组件例子: publ...
阅读全文
posted @
2010-03-29 18:02
一路前行
阅读(910)
推荐(0) 编辑
C#控件开发(一)
摘要:一、 摘要: 这篇文章将告诉你如何开发与.NET属性窗口交互的RAD组件 二、 内容: 简介 属性窗口可以做什么 基础知识:使用Attribute来订制属性窗口的显示 扩展属性和字符串转换:TypeConverter和属性窗口 编写和显示订制的类型 提供可交互的属性视图 我们同样可以使用它 结论 三、 简介 在Visual Basic中,属性窗口是真正实现快速应用开发的一个关键工具(RAD:Rap...
阅读全文
posted @
2010-03-29 18:01
一路前行
阅读(1214)
推荐(0) 编辑
一个C#控件开发的实例
摘要:using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Data;using System.Windows.Forms;namespace WindowsExtendedControls{ /// <summary> /// 控件 /// &l...
阅读全文
posted @
2010-03-29 18:00
一路前行
阅读(509)
推荐(0) 编辑
C#钩子本线程内消息拦截
摘要:钩子其实就是调用一下API而已:1、安装钩子: SetWindowsHookEx 函数原形:HHOOK SetWindowsHookEx( int idHook, // 钩子类型, HOOKPROC lpfn, // 钩子函数地址 INSTANCE hMod, // 钩子所在的实例的句柄, DWORD dwThreadId // 钩子所监视的线程的线程号 ) hMod: 对于线程序钩子,参数...
阅读全文
posted @
2010-03-29 17:59
一路前行
阅读(468)
推荐(0) 编辑
C#鼠标钩子运用实例
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;names...
阅读全文
posted @
2010-03-29 17:59
一路前行
阅读(1135)
推荐(0) 编辑
C#传递自定义结构体
摘要:利用WINDOWS消息循环的机制传递自定义的结构体在编程的过程中可能经常会用到,在这里我就编写了一个简单的结构体的传递代码,需要注意的是类是不能够传递的,能进行传递的只能是结构体using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawin...
阅读全文
posted @
2010-03-29 17:58
一路前行
阅读(1300)
推荐(0) 编辑
七个C#编程小技巧
摘要:一、最小化窗口 点击“X”或“Alt+F4”时,最小化窗口, 如: protectedoverridevoidWndProc(refMessagem) { constintWM_SYSCOMMAND=0x0112; constintSC_CLOSE=0xF060; if(m.Msg==WM_SYSCOMMAND&&(int)m.WPa...
阅读全文
posted @
2010-03-29 17:56
一路前行
阅读(239)
推荐(0) 编辑
自定义扩展颜色对话框
摘要:这个是我利用底层钩子技术扩展的一个颜色对话框,下面就分析代码:using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Drawing;using CustomCommonDi...
阅读全文
posted @
2010-03-29 17:54
一路前行
阅读(212)
推荐(0) 编辑
C#绘制圆角矩形
摘要:#region 绘制圆角矩形区域 internal static GraphicsPath CreateRoundedRectanglePath(Rectangle rect, int cornerRadius) { GraphicsPath roundedRect = new GraphicsPath(); roundedRect.AddArc(rect.X, rect.Y, cornerRa...
阅读全文
posted @
2010-03-29 17:50
一路前行
阅读(1123)
推荐(0) 编辑
在多线程中如何调用Winform
摘要:每一个从Control类中派生出来的WinForm类(包括Control类)都是依靠底层Windows消息和一个消息泵循环(message pump loop)来执行的。消息循环都必须有一个相对应的线程,因为发送到一个window的消息实际上只会被发送到创建该window的线程中去。其结果是,即使提供了同步(synchronization),你也无法从多线程中调用这些处理消息的方法。大多数plum...
阅读全文
posted @
2010-03-29 17:48
一路前行
阅读(298)
推荐(0) 编辑
托管dll动态加载
摘要:using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;namespace WebService1{ /// <summary> /// DllInvoke 的摘要说明 /// </summary> public class Dl...
阅读全文
posted @
2010-03-29 17:46
一路前行
阅读(330)
推荐(0) 编辑
C#动态调用非托管dll(转)
摘要:尝试着在C#下调用以前Delphi写的一些DLL,基本实现动态调用,传入回调函数,及调用带结构数组指针作为参数的函数. 虽然DllImport可以方便的静态调用DLL的函数,但在.net2.0中新增加了一个Marshal.GetDelegateForFunctionPointer 方法,可以将非托管函数指针转换为委托。 有了这个方法就可以用三个Windows API函数即:Loadlibrary,...
阅读全文
posted @
2010-03-29 17:43
一路前行
阅读(655)
推荐(0) 编辑
Win7右键不能新建文件夹
摘要:方法一:1、WIN+ R键调出运行窗口,输入regedit 调出注册表编辑器 2、依次展开注册表到如下分支:KEY_CLASSES_ROOT\Directory\Background\ shellex\ContextMenuHandlers\New,然后在右侧窗口中新建一字符串值,并将其赋值为{D969A300-E7FF-11d0-A93B-00A0C90F2719}第二种:在第一种的办法无效的前...
阅读全文
posted @
2010-03-29 15:47
一路前行
阅读(2730)
推荐(0) 编辑