现在的位置: 首页
0℃

C#在窗体系统菜单添加自定义菜单

2012年05月20日 C#, 编程笔记 
C#在窗体系统菜单添加自定义菜单 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WindowsFormsApplication3 { public partial class Form1 : Form { [DllImport("user32.dll")] private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); [DllImport(...
阅读全文
0℃

C#软件判断版本自动升级的原理(含代码)

2012年05月19日 C#, 编程笔记 

C#软件判断版本自动升级的原理(含代码) 1、验证版本 2、下载要更新的文件,单独EXE操作这块,以方便后边的关闭程序,重新打开 3、下载完毕后,重新打开程序

阅读全文
0℃

批量设置Linux web目录和文件权限的shell脚本

2012年05月18日 Linux, Web, 建站笔记 
现在有一个/home/www目录他下面有很多子目录和文件,我现在想编一个 shell脚本来对该目录设置权限 要求: 1.对该目录下所有的子目录及以下目录都设置成为 755权限。 2.对该目录下的所有文件设置 644的权限。 代码 #!/bin/bash #1.对该目录下所有的子目录及以下目录都设置成为 755权限 find . -type d -exec chmod 755 {} \; #2.对该目录下的所有文件设置 644的权限。 find . -type f -exec chmod 644 {} \;{}
阅读全文
0℃

C#二进制流屏蔽任务管理器

2012年05月18日 未分类 
C#二进制流屏蔽任务管理器,原理就是在后台永久性独占taskmgr.exe using System; using System.Collections.Generic; using System.Text; using System.IO; namespace 二进制流屏蔽任务管理器 { class Program { static void Main(string[] args) { FileStream MyFs; //用二进制流的方法打开它.而且不关闭流.这样任务管理器就打不开了! MyFs = new FileStream(Environment.ExpandEnvironmentVariables("%windir%\\system32\\taskmgr.e...
阅读全文
0℃

C#一个活动窗体震动的例子

2012年05月18日 C#, 编程笔记 
C#一个活动窗体震动的例子,先建个Windows Application,Form1的ShowInTaskBar属性false,WindowState属性Minimized,再加个timer控件,Enable属性true写入下面代码: 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; namespace 活动窗体震动 { public partial class Form1 : Form { public Form1() { Init...
阅读全文
0℃

Godaddy无法打开、无法访问解决办法添加hosts

2012年05月16日 Web, Windows, 建站笔记 
以前Godaddy的DNS经常被墙,现在Godaddy官方网站都被墙了,我无语了。我的域名全在Godaddy上呢,如果不能访问怎么续费啊。试了一下代理可以访问,但是不方便,于是还是用HOSTS吧,把下面的内容添加到hosts文件中即可。 hosts文件的路径: C:\Windows\System32\drivers\etc\hosts #Godaddy By LanMeng.Org 97.74.104.201 www.godaddy.com 97.74.104.201 godaddy.com 216.69.149.90 idp.godaddy.com 216.69.149.215 mya.godaddy.com 97.74.104.201 cat.godaddy.com 216.69.149.203 cart.godaddy.com 64.202.165.179 h...
阅读全文
0℃

一个C#类,可实现关机、重启、注销功能

2012年05月16日 C#, 编程笔记 
一个C#类,可实现关机、重启、注销功能,首先要引用 using System.Runtime.InteropServices; 代码: public class Shudown { [StructLayout(LayoutKind.Sequential, Pack = 1)] internal struct TokPriv1Luid { public int Count; public long Luid; public int Attr; } [DllImport("kernel32.dll", ExactSpelling = true)] internal static extern IntPtr GetCurrentProcess(); [DllImport("advapi32.dll", ExactSpelling = true, SetL...
阅读全文
0℃

C#更换桌面背景图片

2012年05月16日 C#, 编程笔记 
C#更换桌面背景图片,某些时候应该用得到 [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")] public static extern int SystemParametersInfo( int uAction, int uParam, string lpvParam, int fuWinIni ); /// <summary> /// 设置背景图片 /// </summary> /// <param name="picture">图片路径</param> private void SetDestPicture(string picture) { if (File.Exists(picture)) { if (Path.GetExte...
阅读全文
0℃

C#编程中的66个开发标准,你有多少个?

2012年05月16日 C#, 编程笔记 
最近在网上发现这篇文章,看看自己掌握了多少? 1. 避免将多个类放在一个文件里面。 2. 一个文件应该只有一个命名空间,避免将多个命名空间放在同一个文件里面。 3. 一个文件最好不要超过500行的代码(不包括机器产生的代码)。 4. 一个方法的代码长度最好不要超过25行。 5. 避免方法中有超过5个参数的情况。使用结构来传递多个参数。 6. 每行代码不要超过80个字符。 7. 不要手工的修改机器产生的代码。 a) 如果需要编辑机器产生的代码,编辑格式和风格要符合该编码标准。 b) Use partial classes whenever poss...
阅读全文
0℃

C#中的高性能计时器(Daniel Strigl著,野比译)

2012年05月16日 C#, 编程笔记 
精确的时间计量方法在某些应用程序中是非常重要的。常用的 Windows API 方法 GetTickCount() 返回系统启动后经过的毫秒数。另一方面,GetTickCount() 函数仅有 1ms 的分辨精度,很不精确。故而,我们要另外寻找一种方法来精确测量时间。 Win32 API 使用 QueryPerformanceCounter() 和 QueryPerformanceFrequency() 方法支持高精度计时。这些方法,比“标准的”毫秒精度的计时方法如 GetTickCount() 之类有高得多的精度。另一方面来说,在 C# 中使用“非托管”的 API 函数会有一定的开销,但比起使用一点都不精确的 Get...
阅读全文