一些笔记

来源:互联网 发布:Sql修改表字段类型 编辑:程序博客网 时间:2024/05/22 12:41
 1、  datetime类型,初始化时,参数必须大于1。

2、  写注册表项,OpenSubKey必须带true。

3、  启动exe:ProcessStartInfo和WinExec("c:\\windows\\system32\\eudcedit.exe",2);

//[DllImport("kernel32.dll")]

//public static extern int WinExec(string exeName, int operType);

4、c++程序生成是提示cmd错误:

MSDN上提示错误的可能原因为:

  系统资源不足。关闭一些应用程序以解决此问题。

  没有足够的安全特权。验证是否有足够的安全特权。

  VC++ 目录中指定的可执行路径不包括您正尝试运行的工具的路径。

  对于生成文件项目,缺少要在“生成命令行”或“重新生成命令行”上运行的命 令。

  查了查资料,看到是因为VS2008的环境变量设置不对(但是怎么会不对的呢?之前不是挺好的吗?),应该如下解决:

  “工 具--选项--项目和解决方案--VC++ 目录”

        点击文件夹图标(新行 Ctrl-Insert)增加如下几行:

  $(SystemRoot)\System32

  $(SystemRoot)

  $(SystemRoot)\System32\wbem

5、关于窗口的拖动

 第一种:

//private Point myPoint;

  //private void Form1_MouseMove(object sender, MouseEventArgs e)

 //{
 //    if (e.Button == MouseButtons.Left)
        //    {
        //        Point myPosition = Control.MousePosition;
        //        myPosition.Offset(myPoint.X, myPoint.Y);
        //        this.DesktopLocation = myPosition;
        //    }
        //}
        //private void Form1_MouseDown(object sender, MouseEventArgs e)
        //{
        //    myPoint = new Point(-e.X, -e.Y);
        //}

第二种:

 [System.Runtime.InteropServices.DllImport("user32.dll")]
        public static extern bool ReleaseCapture();
        [System.Runtime.InteropServices.DllImport("user32.dll")]
        //窗口句柄,

//区别其他消息的常量值,

//与消息有关的常量值,

//数据的指针
        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
        public const int WM_SYSCOMMAND = 0x0112;
        public const int SC_MOVE = 0xF010;//移动
        public const int HTCAPTION = 0x0002;//左键

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
           try
           {
               ReleaseCapture();
               SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
           }
           catch (System.Exception ex)
           {}
        }

 

原创粉丝点击