Z.Javon

世界随你而转! PK ALL OBJECTS!!!!
 
 
昵称:Z.Javon
园龄:5年11个月
粉丝:0
关注:0

搜索

 
 

常用链接

  • 我的随笔
  • 我的评论
  • 我的参与
  • 最新评论
  • 我的标签

随笔分类

  • .Net Home(1) (rss)

随笔档案

  • 2007年10月 (1)
  • 2007年1月 (1)
  • 2006年9月 (1)
  • 2006年5月 (1)
  • 2006年3月 (1)

Link Resource

  • Beautiful Life
  • Msn Blog

最新评论


Powered by: 博客园
模板提供:沪江博客
博客园 | 首页 | 发新随笔 | 发新文章 | 联系 | 订阅订阅 | 管理

2007年10月8日

Agile Method

will study Agile methods next  month .

posted @ 2007-10-08 16:47 Z.Javon 阅读(30) 评论(0) 编辑
 

2007年1月11日

Windows Forms中禁用窗体的关闭按钮
有时候你会看到一些窗体,它们的标题栏上的关闭按钮被禁用了。如果程序处于某种关键进程中,你可不希望用户随意中断它,这时就可以考虑将关闭按钮禁用。.NET Framework对此没有内置的支持,不过借助于Win32 API, 可以轻松搞定。    我们要调用的Win32 API可以让我们获得对系统菜单的访问。这样我们就可以操作其中的菜单项,比如关闭,移动,大小等。下面看看具体做法。

    1、新建一个Windows应用程序,新建一个窗体,进入代码视图。

    2、添加必要的命名空间:

    using System.Runtime.InteropServices;

    3、添加必要的常数和API函数的引用:
    private const int SC_CLOSE = 0xF060;
    
private const int MF_ENABLED = 0x00000000;
    
private const int MF_GRAYED = 0x00000001;
    
private const int MF_DISABLED = 0x00000002;

    [DllImport(
"user32.dll", EntryPoint = "GetSystemMenu")]
    
private static extern IntPtr GetSystemMenu(IntPtr hWnd, int bRevert);
    [DllImport(
"User32.dll")]
    
public static extern bool EnableMenuItem(IntPtr hMenu, int uIDEnableItem, int uEnable);

    4、在窗体的Load事件处理函数内添加代码:
    IntPtr hMenu = GetSystemMenu(this.Handle, 0);
    EnableMenuItem(hMenu, SC_CLOSE, MF_DISABLED 
| MF_GRAYED);

    下面是效果图:
   
 

    那么如果该关键进程结束,需要使该按钮可用怎么办?
    使用下面的代码就可以了:

    IntPtr hMenu = GetSystemMenu(this.Handle, 0);
    EnableMenuItem(hMenu, SC_CLOSE, MF_ENABLED);

    在http://ryanfarley.com/blog/archive/2004/04/12/526.aspx中介绍了另一种做法,也可以参考一下。

 

posted @ 2007-01-11 16:05 Z.Javon 阅读(112) 评论(0) 编辑
 

2006年9月15日

UFT-8 Convert WideChar

Public Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
Public Const CP_UTF8 = 65001

Public Function UTF8_Decode(bUTF8() As Byte) As String
    Dim lRet As Long
    Dim lLen As Long
    Dim lBufferSize As Long
    Dim sBuffer As String
    Dim bBuffer() As Byte
   
    lLen = UBound(bUTF8) + 1
   
    If lLen = 0 Then Exit Function
   
    lBufferSize = lLen * 2
   
    sBuffer = String$(lBufferSize, Chr(0))
   
    lRet = MultiByteToWideChar(CP_UTF8, 0, VarPtr(bUTF8(0)), lLen, StrPtr(sBuffer), lBufferSize)
   
    If lRet <> 0 Then
        sBuffer = Left(sBuffer, lRet)
    End If
   
    UTF8_Decode = sBuffer 'Right(sBuffer, Len(sBuffer) - 1)
End Function

posted @ 2006-09-15 14:33 Z.Javon 阅读(60) 评论(0) 编辑
 

2006年5月30日

C# ref dll >> parameters corresponding table

Wtypes.h 中的非托管类型 非托管 C 语言类型 托管类名 说明
HANDLE void* System.IntPtr 32 位
BYTE unsigned char System.Byte 8 位
SHORT short System.Int16 16 位
WORD unsigned short System.UInt16 16 位
INT int System.Int32 32 位
UINT unsigned int System.UInt32 32 位
LONG long System.Int32 32 位
BOOL long System.Int32 32 位
DWORD unsigned long System.UInt32 32 位
ULONG unsigned long System.UInt32 32 位
CHAR char System.Char 用 ANSI 修饰。
LPSTR char* System.String 或 System.Text.StringBuilder 用 ANSI 修饰。
LPCSTR Const char* System.String 或 System.Text.StringBuilder 用 ANSI 修饰。
LPWSTR wchar_t* System.String 或 System.Text.StringBuilder 用 Unicode 修饰。
LPCWSTR Const wchar_t* System.String 或 System.Text.StringBuilder 用 Unicode 修饰。
FLOAT Float System.Single 32 位
DOUBLE Double System.Double 64 位

posted @ 2006-05-30 19:24 Z.Javon 阅读(58) 评论(0) 编辑
 

2006年3月14日

write an updatable ActiveX control for web page in VB6
http://www.codeproject.com/vbscript/vbActiveXControl.asp#xx922173xx

the Method  is good,
but all activeX Controls may download freely ,
so the security is a big question.
for intranet,not for internet!
posted @ 2006-03-14 18:08 Z.Javon 阅读(38) 评论(0) 编辑
 
仅列出标题