随笔分类 -  代码片段

WndProc(ref Message m)
摘要:WndProc(ref Message m)protected override void WndProc(ref Message m){ const int WM_SYSCOMMAND = 0x0112; const int SC_CLOSE = 0xF060; if (m.Msg == WM_SYSCOMMAND && (int) m.WParam == SC_CLOSE) { // 屏蔽传入的消息事件 this.WindowState = FormWindowState.Minimized; return; } ... 阅读全文

posted @ 2012-11-30 14:27 SuperCai 阅读(818) 评论(0) 推荐(0)

[转]DllImport属性详解
摘要:DllImport属性详解(http://blog.csdn.net/yyz_2637/article/details/5340365)API函数是构筑Windows的基石, 是Windows编程的必备利器。每一种Windows应用程序开发工具都提供间接或者直接的方式调用Win32API,C#也不例外。使用Win32API的一个好处就是,我们可以实现更多的功能。首先,要引入命名空间:using System.Runtime.InteropServices;然后,声明在程序中所要用到的API函数。注意方法体为空。DllImport属性用于指定包含外部方法的实现的dll位置。(1)DllImpor 阅读全文

posted @ 2012-11-30 14:13 SuperCai 阅读(1580) 评论(0) 推荐(0)

日期时间格式化(到毫秒)
摘要:using System;using System.Collections.Generic;using System.Globalization;using System.Threading;public class MyClass{ public static void RunSnippet() { DateTime thisDate = DateTime.Now; DateTime utcDate = thisDate.ToUniversalTime(); //DateTime unspecifiedDate = new Date... 阅读全文

posted @ 2011-12-13 10:59 SuperCai 阅读(1835) 评论(0) 推荐(0)

[转]使用foreach 循环删除DataRow的时候的问题
摘要:http://hi.baidu.com/ilovehaley/blog/item/906be189f1087fba0e24446d.html集合已修改;枚举操作可能无法执行。使用foreach 循环删除DataRow的时候的问题!1.需求 从页面上获得多条记录到DataTable-->从DataTable里删除数据库里已有的记录--》把没有的记录插入到数据库中去。2.实现思路:获得页面上所有记录,使用foreach循环DataTable把数据库里已有的删除掉,最后更新数据库。(放到DataTable前先判断是否在数据库中存在要好一点,这里只用来学习DataRow的方法)3.问题:在for 阅读全文

posted @ 2011-12-05 16:44 SuperCai 阅读(2289) 评论(0) 推荐(0)

UTC时间与WINDOWS时间互换
摘要://UTC时间转WINDOWS时间 public DateTime UTCToDateTime(double l) { DateTime dtZone = new DateTime(1970, 1, 1, 0, 0, 0); dtZone = dtZone.AddSeconds(l); return dtZone.ToLocalTime(); } //WINDOWS时间转UTC时间 public double DateTimeToUTC(DateTime vDate) { TimeZone tz = TimeZone.CurrentTimeZone; vDate = vDate.ToUnive 阅读全文

posted @ 2011-11-30 13:51 SuperCai 阅读(498) 评论(0) 推荐(0)

动态内存中加载DLL的问题
摘要:Private Sub RunMain(ByVal Dllpath As String, ByVal types As String) Dim str(1) As String Try Dim asm As [Assembly] '加载DLL '这里要检测文件是否存在 Dim FS As New System.IO.FileStream(Dllpath, FileMode.Open) 'Application.StartupPath & "\jad.dll" Dim ms As New MemoryStream Dim data As Byt 阅读全文

posted @ 2008-02-28 11:59 SuperCai 阅读(696) 评论(0) 推荐(0)

导航