<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kernel2Heart &#187; Programming</title>
	<atom:link href="http://www.kernel2heart.com/labels/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kernel2heart.com</link>
	<description>一个人的内心里,究竟隐藏了什么呢?</description>
	<lastBuildDate>Fri, 20 May 2011 05:10:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>C#实现图片格式转换</title>
		<link>http://www.kernel2heart.com/2010/12/csharp-to-convent-picture/</link>
		<comments>http://www.kernel2heart.com/2010/12/csharp-to-convent-picture/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 13:33:10 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2010/12/csharp-to-convent-picture/</guid>
		<description><![CDATA[其实最近入手了Amazon Kindle，但是收了一些漫画，是GIF格式的。为了能在Kindle上看漫画，需要转换成为JPG，然后制作成PDF。 核心代码很简单，如下： for &#40;int i = 0; i &#60; PicList.Items.Count; i++&#41; //图片之前保存在了PicList中 &#123; try &#123; string FileName = PicList.Items&#91;i&#93;.ToString&#40;&#41;; string newName = System.IO.Path.GetFileName&#40;FileName&#41;; newName = newName.Replace&#40;&#34;gif&#34;, &#34;jpg&#34;&#41;; Bitmap bm = new Bitmap&#40;FileName&#41;; if &#40;checkBox1.Checked == true&#41; &#123; if &#40;File.Exists&#40;FileName&#41;&#41; &#8230; <a href="http://www.kernel2heart.com/2010/12/csharp-to-convent-picture/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>其实最近入手了Amazon Kindle，但是收了一些漫画，是GIF格式的。为了能在Kindle上看漫画，需要转换成为JPG，然后制作成PDF。</p>
<p>  <span id="more-489"></span>
<p>核心代码很简单，如下：</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">            <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> PicList<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">//图片之前保存在了PicList中</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">try</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #6666cc; font-weight: bold;">string</span> FileName <span style="color: #008000;">=</span> PicList<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #6666cc; font-weight: bold;">string</span> newName <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">IO</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Path</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetFileName</span><span style="color: #008000;">&#40;</span>FileName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    newName <span style="color: #008000;">=</span> newName<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;gif&quot;</span>, <span style="color: #666666;">&quot;jpg&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    Bitmap bm <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Bitmap<span style="color: #008000;">&#40;</span>FileName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>checkBox1<span style="color: #008000;">.</span><span style="color: #008000;">Checked</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>File<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>FileName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                        <span style="color: #008000;">&#123;</span>
                            File<span style="color: #008000;">.</span><span style="color: #0000FF;">Delete</span><span style="color: #008000;">&#40;</span>FileName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        <span style="color: #008000;">&#125;</span>
                    <span style="color: #008000;">&#125;</span>
                    bm<span style="color: #008000;">.</span><span style="color: #0000FF;">Save</span><span style="color: #008000;">&#40;</span>savePath <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\\</span>&quot;</span> <span style="color: #008000;">+</span> newName, ImageFormat<span style="color: #008000;">.</span><span style="color: #0000FF;">Jpeg</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//savepath是保存路径</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span><span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Exception</span> ex<span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    MessageBox<span style="color: #008000;">.</span><span style="color: #0000FF;">Show</span><span style="color: #008000;">&#40;</span>ex<span style="color: #008000;">.</span><span style="color: #0000FF;">Message</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
            PicList<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>代码简单，各位见谅，下次更新一个制作pdf的功能上来。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2010/12/csharp-to-convent-picture/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>C#获取本机CPU、内存信息类</title>
		<link>http://www.kernel2heart.com/2010/08/c-sharp-get-pc-cpu-memory-class/</link>
		<comments>http://www.kernel2heart.com/2010/08/c-sharp-get-pc-cpu-memory-class/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 13:27:53 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2010/08/c-sharp-get-pc-cpu-memory-class/</guid>
		<description><![CDATA[代码写的很烂，多多包涵就是了，用起来感觉还可以，需要几个using： using System.Runtime.InteropServices; using System.Management; 其中System.Management需要手工添加，发布时，需要附带System.Management.dll。 public class SystemInfo &#123; &#160; &#91;StructLayout&#40;LayoutKind.Sequential&#41;&#93; private struct MEMORY_INFO &#123; public uint dwLength; public uint dwMemoryLoad; public uint dwTotalPhys; public uint dwAvailPhys; public uint dwTotalPageFile; public uint dwAvailPageFile; public uint dwTotalVirtual; public uint dwAvailVirtual; &#8230; <a href="http://www.kernel2heart.com/2010/08/c-sharp-get-pc-cpu-memory-class/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>代码写的很烂，多多包涵就是了，用起来感觉还可以，需要几个using：</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Runtime.InteropServices</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Management</span><span style="color: #008000;">;</span></pre></div></div>

<p>其中System.Management需要手工添加，发布时，需要附带System.Management.dll。</p>
<p><span id="more-461"></span></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SystemInfo
    <span style="color: #008000;">&#123;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>StructLayout<span style="color: #008000;">&#40;</span>LayoutKind<span style="color: #008000;">.</span><span style="color: #0000FF;">Sequential</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">struct</span> MEMORY_INFO
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwLength<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwMemoryLoad<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwTotalPhys<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwAvailPhys<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwTotalPageFile<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwAvailPageFile<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwTotalVirtual<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> dwAvailVirtual<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#91;</span>DllImport<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;kernel32&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> <span style="color: #6666cc; font-weight: bold;">void</span> GlobalMemoryStatus<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">ref</span>  MEMORY_INFO meminfo<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> 
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> m_ProcessorCount <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>   <span style="color: #008080; font-style: italic;">//CPU个数</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> PerformanceCounter pcCpuLoad<span style="color: #008000;">;</span>   <span style="color: #008080; font-style: italic;">//CPU计数器</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">long</span> m_PhysicalMemory <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>   <span style="color: #008080; font-style: italic;">//物理内存</span>
&nbsp;
        <span style="color: #008080;">#region 构造函数</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> SystemInfo<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//初始化CPU计数器</span>
            pcCpuLoad <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> PerformanceCounter<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Processor&quot;</span>, <span style="color: #666666;">&quot;% Processor Time&quot;</span>, <span style="color: #666666;">&quot;_Total&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            pcCpuLoad<span style="color: #008000;">.</span><span style="color: #0000FF;">MachineName</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;.&quot;</span><span style="color: #008000;">;</span>
            pcCpuLoad<span style="color: #008000;">.</span><span style="color: #0000FF;">NextValue</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//CPU个数</span>
            m_ProcessorCount <span style="color: #008000;">=</span> Environment<span style="color: #008000;">.</span><span style="color: #0000FF;">ProcessorCount</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//获得物理内存</span>
            ManagementClass mc <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ManagementClass<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Win32_ComputerSystem&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            ManagementObjectCollection moc <span style="color: #008000;">=</span> mc<span style="color: #008000;">.</span><span style="color: #0000FF;">GetInstances</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>ManagementObject mo <span style="color: #0600FF; font-weight: bold;">in</span> moc<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>mo<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;TotalPhysicalMemory&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    m_PhysicalMemory <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">long</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&#40;</span>mo<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;TotalPhysicalMemory&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region CPU个数</span>
        <span style="color: #008080; font-style: italic;">///</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// 获取CPU个数</span>
        <span style="color: #008080; font-style: italic;">/// </span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> ProcessorCount
        <span style="color: #008000;">&#123;</span>
            get
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> m_ProcessorCount<span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region CPU占用率</span>
        <span style="color: #008080; font-style: italic;">///</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// 获取CPU占用率</span>
        <span style="color: #008080; font-style: italic;">/// </span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">float</span> CpuLoad
        <span style="color: #008000;">&#123;</span>
            get
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> pcCpuLoad<span style="color: #008000;">.</span><span style="color: #0000FF;">NextValue</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region 可用内存</span>
        <span style="color: #008080; font-style: italic;">///</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// 获取可用内存</span>
        <span style="color: #008080; font-style: italic;">/// </span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">long</span> MemoryAvailable
        <span style="color: #008000;">&#123;</span>
            get
            <span style="color: #008000;">&#123;</span>
                <span style="color: #6666cc; font-weight: bold;">long</span> availablebytes <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
                ManagementClass mos <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ManagementClass<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Win32_OperatingSystem&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>ManagementObject mo <span style="color: #0600FF; font-weight: bold;">in</span> mos<span style="color: #008000;">.</span><span style="color: #0000FF;">GetInstances</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>mo<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;FreePhysicalMemory&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        availablebytes <span style="color: #008000;">=</span> <span style="color: #FF0000;">1024</span> <span style="color: #008000;">*</span> <span style="color: #6666cc; font-weight: bold;">long</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&#40;</span>mo<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;FreePhysicalMemory&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>availablebytes <span style="color: #008000;">/</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region 物理内存</span>
        <span style="color: #008080; font-style: italic;">///</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// 获取物理内存</span>
        <span style="color: #008080; font-style: italic;">/// </span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> PhysicalMemory
        <span style="color: #008000;">&#123;</span>
            get
            <span style="color: #008000;">&#123;</span>
                <span style="color: #6666cc; font-weight: bold;">double</span> temp <span style="color: #008000;">=</span> Math<span style="color: #008000;">.</span><span style="color: #0000FF;">Round</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">float</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>m_PhysicalMemory <span style="color: #008000;">/</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&#40;</span>temp<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
&nbsp;
        <span style="color: #008080;">#region 物理内存占用率</span>
        <span style="color: #008080; font-style: italic;">///</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// 获取物理内存占用率</span>
        <span style="color: #008080; font-style: italic;">/// </span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">uint</span> PhysicalMemoryLoad
        <span style="color: #008000;">&#123;</span>
            get
            <span style="color: #008000;">&#123;</span>
                MEMORY_INFO MemInfo <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MEMORY_INFO<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                GlobalMemoryStatus<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">ref</span>  MemInfo<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> MemInfo<span style="color: #008000;">.</span><span style="color: #0000FF;">dwMemoryLoad</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080;">#endregion</span>
    <span style="color: #008000;">&#125;</span></pre></div></div>

<p><script type='text/javascript'>
alimama_pid='mm_14356979_2041853_8949568';
alimama_type='g';
alimama_tks={};
alimama_tks.style_i=2;
alimama_tks.lg_i=1;
alimama_tks.w_i=572;
alimama_tks.h_i=69;
alimama_tks.btn_i=1;
alimama_tks.txt_s='';
alimama_tks.hot_i=1;
alimama_tks.hc_c='#0065FF';
alimama_tks.cid_i=0;
alimama_tks.t_i=1
</script><br />
<script type='text/javascript' src='http://a.alimama.cn/inf.js'></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2010/08/c-sharp-get-pc-cpu-memory-class/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>如何使用GreaseMonkey给页面添加超链接</title>
		<link>http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/</link>
		<comments>http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 10:00:35 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/</guid>
		<description><![CDATA[GreaseMonkey是个很强大的软件，无论是在Firefox还是Chrome上的表现，都无疑是出众的。之前写过一篇关于GreaseMonkey的文章，但是一直时间不多，没有继续研究下去。 这次打算做一个某知名网站的辅助工具（平时还是firefox用得多，chrome是偶尔用下，不过理论上Firefox和Chrome都是兼容的），所以就把GreaseMonkey又上手了一下。 比如我们要在某一页面添加一个借口，比如说：显示楼主。通过对页面结构的观察（我是用的是Firebug，总之自己习惯的工具就好），发现可以在一个id名为“thread_nav_lef”的Div上添加一个链接。这个Div的结构大致如下： 1 2 3 4 5 6 7 8 9 10 &#60;div id=&#34;thread_nav_left&#34;&#62; &#60;ul&#62; &#160; &#60;li&#62;&#60;a onclick=&#34;Post.reply(&#38;#39;0&#38;#39;);&#34; href=&#34;#sub&#34;&#62;快速回复&#60;/a&#62;&#60;/li&#62; &#160; &#60;li&#62;&#60;a title=&#34;切换到经典版&#34; onclick=&#34;Page.changeVersion(2);return false;&#34; href=&#34;#&#34;&#62;切换到经典版&#60;/a&#62;&#60;/li&#62; &#160; &#60;/ul&#62; &#160; &#60;/div&#62; 这样可以这样写： 1 2 3 4 5 6 7 8 9 &#8230; <a href="http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>是个很强大的软件，无论是在<a href="http://www.kernel2heart.com/labels/firefox/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Firefox">Firefox</a>还是Chrome上的表现，都无疑是出众的。之前写过<a href="http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/" target="_blank">一篇关于GreaseMonkey的文章</a>，但是一直时间不多，没有继续研究下去。</p>
<p>这次打算做一个某知名网站的辅助工具（平时还是<a href="http://www.kernel2heart.com/labels/firefox/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Firefox">firefox</a>用得多，chrome是偶尔用下，不过理论上<a href="http://www.kernel2heart.com/labels/firefox/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Firefox">Firefox</a>和Chrome都是兼容的），所以就把<a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>又上手了一下。</p>
<p> <span id="more-430"></span>
<p>比如我们要在某一页面添加一个借口，比如说：显示楼主。通过对页面结构的观察（我是用的是Firebug，总之自己习惯的工具就好），发现可以在一个id名为“thread_nav_lef”的Div上添加一个链接。这个Div的结构大致如下：</p>
<blockquote>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;thread_nav_left&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
&nbsp;
                 <span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a onclick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Post.reply(&amp;#39;0&amp;#39;);&quot;</span> href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#sub&quot;</span><span style="color: #339933;">&gt;</span>快速回复<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
&nbsp;
                 <span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a title<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;切换到经典版&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Page.changeVersion(2);return false;&quot;</span> href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">&gt;</span>切换到经典版<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
&nbsp;
            <span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
&nbsp;
        <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

</blockquote>
<p>这样可以这样写：</p>
<blockquote>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> init <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #003366; font-weight: bold;">var</span> showButton <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'thread_nav_left'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//为什么第二个是2？因为2比较美观，第一个格式有点乱…. </span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> flli <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> fllink <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
        fllink.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'javascript:void(0);'</span><span style="color: #339933;">;</span> 
&nbsp;
        fllink.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'只看楼主'</span><span style="color: #339933;">;</span> 
&nbsp;
        flli.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>fllink<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
        fllink.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span> filter<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Filter是个函数，当点击时会执行Filter函数 </span>
&nbsp;
        showButton.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>flli<span style="color: #339933;">,</span> showButton.<span style="color: #660066;">nextSibling</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</blockquote>
<p>nextSibling是一个插入到指定节点之后的方法，如果插入指定节点之前，可以选择去掉nextSibling。</p>
<p>效果大致如下：快速回复   只看楼主  切换到经典版</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2010/06/how-to-add-links-to-web-by-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Win7下Android無法找到AVD的解決辦法</title>
		<link>http://www.kernel2heart.com/2010/01/win7-android-install-avd/</link>
		<comments>http://www.kernel2heart.com/2010/01/win7-android-install-avd/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 11:28:09 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Android SDK]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2010/01/win7-android-install-avd/</guid>
		<description><![CDATA[典型的表現是：可以正常安裝AVD，創建虛擬設備，但是調試時出現如下錯誤： Automatic Target Mode: Preferred AVD &#8216;avd1.5&#8242; is not available. Launching new emulator. Launching a new emulator with Virtual Device &#8216;avd1.5&#8242; emulator: ERROR: unknown virtual device name: &#8216;avd1.5&#8242; emulator: could not find virtual device named &#8216;avd1.5&#8242; 最后发现在Android Virtual Devices Manager中创建avd，创建后avd的存放路径是“D:\.android”，因为我的XP系统默认文件的路径都修改过所以“C: &#8230; <a href="http://www.kernel2heart.com/2010/01/win7-android-install-avd/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>典型的表現是：可以正常安裝AVD，創建虛擬設備，但是調試時出現如下錯誤：</p>
<blockquote><p>Automatic Target Mode: Preferred AVD &#8216;avd1.5&#8242; is not available. Launching new emulator.</p>
<p>Launching a new emulator with Virtual Device &#8216;avd1.5&#8242;</p>
<p>emulator: ERROR: unknown virtual device name: &#8216;avd1.5&#8242;</p>
<p>emulator: could not find virtual device named &#8216;avd1.5&#8242;</p>
</blockquote>
<p>最后发现在<a href="http://www.kernel2heart.com/labels/android/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Android">Android</a> Virtual Devices Manager中创建avd，创建后avd的存放路径是“D:\.<a href="http://www.kernel2heart.com/labels/android/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Android">android</a>”，因为我的XP系统默认文件的路径都修改过所以“C: \Documents and Settings\Administrator”改成了“D:”，既然Eclipse提示它找不到avd，是不是跟这个有关系呢，我试了试将 “.<a href="http://www.kernel2heart.com/labels/android/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Android">android</a>”这个文件放到“C:\Documents and Settings\Administrator”下，最后可以正常运行了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2010/01/win7-android-install-avd/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>構建iPhone開發平臺</title>
		<link>http://www.kernel2heart.com/2010/01/%e6%a7%8b%e5%bb%baiphone%e9%96%8b%e7%99%bc%e5%b9%b3%e8%87%ba/</link>
		<comments>http://www.kernel2heart.com/2010/01/%e6%a7%8b%e5%bb%baiphone%e9%96%8b%e7%99%bc%e5%b9%b3%e8%87%ba/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 11:13:04 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2010/01/%e6%a7%8b%e5%bb%baiphone%e9%96%8b%e7%99%bc%e5%b9%b3%e8%87%ba/</guid>
		<description><![CDATA[算是作為我學習iPhone開發的一個基本開篇，第一個文章當然是環境的搭建了。大致的環境，相信你在看很多相關參考書的時候都應噶提到了。首先最好有一台MAC機，這個不一定代表你一定要有Macbook什麽的，但是建議你有一台安裝有OS X snow leopard系統的電腦（比如我現在使用的就是OSX for PC）。當然10.5的系統也是可以的，但是SDK的版本明顯要低一些的。不過如果你打算真正打算做商務開發，這個是無所謂的。 除了一台安裝了OSX10.5系統以上的電腦，還需要有一個Apple developer ID。這個有一個值得注意的是，千萬不要使用自己的iTunes帳戶註冊Developer帳戶，因為這樣很容易導致帳戶的審核變慢。我的兩個iTunes帳戶就是過了一個月了仍舊在審核當中，不過換了一個沒有註冊過的gmail郵箱，第二天就可以下載工具了。 Developer帳戶的作用很大，通過這個帳戶，你可以輕鬆下載iPhone開發工具Xcode with iPhone SDK和一些甚至關於Object-C的書籍，這些都是免費的，不過是英文的。如果你想在app store發佈你的應用，還需要一個價值$99的授權，不過我作為個人開發者，也不打算出售軟件了。 其他的就是關於xcode的安裝了，這個沒有什麽難度的，相對Win下安裝來說省事了很多。下載的編程軟體是一個dmg影像，雙擊就可以加載，然後選擇第二個安裝選項安裝，安裝正常之後可以在搜索中查找xcode就可以打開Xcode了。 編寫一個軟體更是簡單啦，相信用過Visual Studio什麽的童鞋應該很快就可以上手了，選擇創建一個iPhone程序，有很多，可以以後研究一下使用。我了的第一個iPhone應用程式：HelloWord（萬能程式啊，iPhone可以零代碼實現的，只是拖放了幾個控件。），等書來了之後可以繼續研究一下。]]></description>
			<content:encoded><![CDATA[<p>算是作為我學習<a href="http://www.kernel2heart.com/labels/iphone/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iPhone">iPhone</a>開發的一個基本開篇，第一個文章當然是環境的搭建了。大致的環境，相信你在看很多相關參考書的時候都應噶提到了。首先最好有一台MAC機，這個不一定代表你一定要有Macbook什麽的，但是建議你有一台安裝有OS X snow leopard系統的電腦（比如我現在使用的就是OSX for PC）。當然10.5的系統也是可以的，但是SDK的版本明顯要低一些的。不過如果你打算真正打算做商務開發，這個是無所謂的。</p>
<p> <span id="more-339"></span>
<p>除了一台安裝了OSX10.5系統以上的電腦，還需要有一個Apple developer ID。這個有一個值得注意的是，<strong><font color="#ff0000">千萬不要使用自己的iTunes帳戶註冊Developer帳戶</font></strong>，因為這樣很容易導致帳戶的審核變慢。我的兩個iTunes帳戶就是過了一個月了仍舊在審核當中，不過換了一個沒有註冊過的gmail郵箱，第二天就可以下載工具了。</p>
<p>Developer帳戶的作用很大，通過這個帳戶，你可以輕鬆下載<a href="http://www.kernel2heart.com/labels/iphone/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iPhone">iPhone</a>開發工具Xcode with <a href="http://www.kernel2heart.com/labels/iphone/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iPhone">iPhone</a> SDK和一些甚至關於Object-C的書籍，這些都是免費的，不過是英文的。如果你想在app store發佈你的應用，還需要一個價值$99的授權，不過我作為個人開發者，也不打算出售軟件了。</p>
<p>其他的就是關於xcode的安裝了，這個沒有什麽難度的，相對Win下安裝來說省事了很多。下載的編程軟體是一個dmg影像，雙擊就可以加載，然後選擇第二個安裝選項安裝，安裝正常之後可以在搜索中查找xcode就可以打開Xcode了。</p>
<p>編寫一個軟體更是簡單啦，相信用過Visual Studio什麽的童鞋應該很快就可以上手了，選擇創建一個<a href="http://www.kernel2heart.com/labels/iphone/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iPhone">iPhone</a>程序，有很多，可以以後研究一下使用。我了的第一個<a href="http://www.kernel2heart.com/labels/iphone/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iPhone">iPhone</a>應用程式：HelloWord（萬能程式啊，<a href="http://www.kernel2heart.com/labels/iphone/" class="st_tag internal_tag" rel="tag" title="Posts tagged with iPhone">iPhone</a>可以零代碼實現的，只是拖放了幾個控件。），等書來了之後可以繼續研究一下。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2010/01/%e6%a7%8b%e5%bb%baiphone%e9%96%8b%e7%99%bc%e5%b9%b3%e8%87%ba/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GreaseMonkey的应用真是强大</title>
		<link>http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/</link>
		<comments>http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 10:34:28 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/</guid>
		<description><![CDATA[今天无聊，想去下一个漫画来看，本来嘛，想着FX这么强大，一定有相关的扩展了，搜索了一番，失望而归。如果你晓得什么在看图的时候可以自动下载指定网址序列下图片的插件，也欢迎指教！ 好吧，事实上我打算写的东西也不在这个里面，仅仅只是一些简单的GM应用而已。 首先推荐一本入门教程，非常不错，像我这样的脚本白痴都可以看的懂的：《深入浅出Greasemonkey》。在里面也有很多很简单，但是却非常实用的例子，为快速上手GreaseMonkey脚本编写提供了非常方便的指南。 在参阅该教程几页之后，我也可以写一个清爽页面的脚本啦： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // ==UserScript== // @name 百度贴吧侧边栏广告去除器 // @namespace http://www.kernel2heart.com // @description 去除百度贴吧侧边栏广告，免广告功能请配合Adblock Plua使用 // @include http://tieba.baidu.com/* // @author 灰机要考研 // &#8230; <a href="http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>今天无聊，想去下一个漫画来看，本来嘛，想着FX这么强大，一定有相关的扩展了，搜索了一番，失望而归。如果你晓得什么<strong><font color="#ff0000">在看图的时候可以自动下载指定网址序列下图片的插件</font></strong>，也欢迎指教！</p>
<p>   <span id="more-261"></span>
<p>好吧，事实上我打算写的东西也不在这个里面，仅仅只是一些简单的GM应用而已。</p>
<p>首先推荐一本入门教程，非常不错，像我这样的脚本白痴都可以看的懂的：《<a href="http://www.firefox.net.cn/dig/" target="_blank">深入浅出Greasemonkey</a>》。在里面也有很多很简单，但是却非常实用的例子，为快速上手<a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>脚本编写提供了非常方便的指南。</p>
<p>在参阅该教程几页之后，我也可以写一个清爽页面的脚本啦：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// ==UserScript==</span>
<span style="color: #006600; font-style: italic;">// @name           百度贴吧侧边栏广告去除器</span>
<span style="color: #006600; font-style: italic;">// @namespace      http://www.kernel2heart.com</span>
<span style="color: #006600; font-style: italic;">// @description    去除百度贴吧侧边栏广告，免广告功能请配合Adblock Plua使用</span>
<span style="color: #006600; font-style: italic;">// @include        http://tieba.baidu.com/*</span>
<span style="color: #006600; font-style: italic;">// @author         灰机要考研</span>
<span style="color: #006600; font-style: italic;">// @version        0.01</span>
<span style="color: #006600; font-style: italic;">/* @reason
* 支持去除普通百度贴吧侧边栏广告
* 横幅flash和图片广告请使用Adblock plus去除
@end*/</span>
<span style="color: #006600; font-style: italic;">// ==/UserScript==</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> adSidebar <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rightAd'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>adSidebar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    adSidebar.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>adSidebar<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>如果比较感兴趣如何实现这些功能的，可以参见《<a href="http://www.firefox.net.cn/dig/" target="_blank">深入浅出Greasemonkey</a>》。GM的功能在处理网页时实在是太强大了，通过<a href="http://www.kernel2heart.com/labels/greasemonkey/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GreaseMonkey">GreaseMonkey</a>就可以轻松操纵网页的任意内容了，不过可惜的是，就我的使用经验来说，好像GM需要等待页面载入完成之后才会执行脚本，这样的话，比如载入去广告脚本的时候，广告还是会一闪而过的，算是一个缺点吧。</p>
<p>我是一个JS苦手，其实在去除其他广告时也有其他措施的，例如一个Div广告具有class=sponsoredlink属性，且唯一，可以这样获得：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">thisDiv <span style="color: #339933;">=</span> document.<span style="color: #660066;">evaluate</span><span style="color: #009900;">&#40;</span>
    <span style="color: #3366CC;">&quot;//div[@class='sponsoredlink']&quot;</span><span style="color: #339933;">,</span>
    document<span style="color: #339933;">,</span>
    <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
    XPathResult.<span style="color: #660066;">UNORDERED_NODE_SNAPSHOT_TYPE</span><span style="color: #339933;">,</span>
    <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>如果属性不唯一的话，会返回元素组，如果RemoveChild的时候，会对所有元素进行操作。</p>
<p>有其他问题，欢迎一起交流，GM脚本的编写我才刚刚开始看，如果你有兴趣，我们可以一起学习。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/10/powerful-plugin-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>[ZT]五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT)</title>
		<link>http://www.kernel2heart.com/2009/10/five-open-source-licenses-comparison/</link>
		<comments>http://www.kernel2heart.com/2009/10/five-open-source-licenses-comparison/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 12:14:41 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[八卦资讯]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[开源项目]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/10/zt%e4%ba%94%e7%a7%8d%e5%bc%80%e6%ba%90%e5%8d%8f%e8%ae%ae%e7%9a%84%e6%af%94%e8%be%83bsdapachegpllgplmit/</guid>
		<description><![CDATA[最近发了几个开源的东西在Google Code，但是对几种常见授权协议的授权宽度却不甚了了。虽然自己采用了Apache Licence 2.0协议授权，不过这个也仅仅只是了解一些基本的信息。顺手转一个awflasher的文章，对理解几个开源授权协议比较有帮助。 转载自：http://www.awflasher.com/blog/archives/939 当Adobe、Microsoft、Sun等一系列巨头开始表现出对”开源”的青睐时，”开源”的时代即将到来！ 最初来自：sinoprise.com/read.php?tid-662-page-e-fpage-1.html（遗憾的是这个链接已经打不开了），我基本未改动，只是进行了一些排版和整理。 参考文献：http://www.fsf.org/licensing/licenses/现今存在的开源协议很多，而经过Open Source Initiative组织通过批准的开源协议目前有58种（http://www.opensource.org/licenses/alphabetical）。我们在常见的开源协议如BSD, GPL, LGPL,MIT等都是OSI批准的协议。如果要开源自己的代码，最好也是选择这些被批准的开源协议。 这里我们来看四种最常用的开源协议及它们的适用范围，供那些准备开源或者使用开源产品的开发人员/厂家参考。 BSD开源协议（original BSD license、、） BSD开源协议是一个给于使用者很大自由的协议。基本上使用者可以”为所欲为”,可以自由的使用，修改源代码，也可以将修改后的代码作为开源或者专有软件再发布。 但”为所欲为”的前提当你发布使用了BSD协议的代码，或则以BSD协议代码为基础做二次开发自己的产品时，需要满足三个条件： 如果再发布的产品中包含源代码，则在源代码中必须带有原来代码中的BSD协议。 如果再发布的只是二进制类库/软件，则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。 不可以用开源代码的作者/机构名字和原来产品的名字做市场推广。 BSD 代码鼓励代码共享，但需要尊重代码作者的著作权。BSD由于允许使用者修改和重新发布代码，也允许使用或在BSD代码上开发商业软件发布和销售，因此是对商业集成很友好的协议。而很多的公司企业在选用开源产品的时候都首选BSD协议，因为可以完全控制这些第三方的代码，在必要的时候可以修改或者二次开发。 Apache Licence 2.0（Apache License, Version 2.0、Apache License, Version 1.1、Apache License, Version 1.0） Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似，同样鼓励代码共享和尊重原作者的著作权，同样允许代码修改，再发布（作为开源或商业软件）。需要满足的条件也和BSD类似： 需要给代码的用户一份Apache Licence 如果你修改了代码，需要再被修改的文件中说明。 &#8230; <a href="http://www.kernel2heart.com/2009/10/five-open-source-licenses-comparison/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>最近发了几个开源的东西在<a href="http://code.google.com" target="_blank">Google Code</a>，但是对几种常见授权协议的授权宽度却不甚了了。虽然自己采用了Apache Licence 2.0协议授权，不过这个也仅仅只是了解一些基本的信息。顺手转一个awflasher的文章，对理解几个开源授权协议比较有帮助。</p>
<p>转载自：<a href="http://www.awflasher.com/blog/archives/939" target="_blank">http://www.awflasher.com/blog/archives/939</a></p>
<p><span id="more-234"></span></p>
<blockquote><p>当Adobe、Microsoft、Sun等一系列巨头开始表现出对”开源”的青睐时，”开源”的时代即将到来！</p>
<p>最初来自：sinoprise.com/read.php?tid-662-page-e-fpage-1.html<strong>（遗憾的是这个链接已经打不开了）</strong>，我基本未改动，只是进行了一些排版和整理。</p>
<p>参考文献：<a href="http://www.fsf.org/licensing/licenses/">http://www.fsf.org/licensing/licenses/</a>现今存在的开源协议很多，而经过Open Source Initiative组织通过批准的开源协议目前有58种（<a href="http://www.opensource.org/licenses/alphabetical">http://www.opensource.org/licenses/alphabetical</a>）。我们在常见的开源协议如BSD, GPL, LGPL,MIT等都是OSI批准的协议。如果要开源自己的代码，最好也是选择这些被批准的开源协议。</p>
<p>这里我们来看四种最常用的开源协议及它们的适用范围，供那些准备开源或者使用开源产品的开发人员/厂家参考。</p>
<p><strong>BSD开源协议（</strong><a href="http://www.fsf.org/licensing/licenses/index_html#OriginalBSD">original BSD license</a><strong>、</strong><a name="FreeBSD"></a><strong>、</strong><a name="OriginalBSD"></a><strong>）</strong></p>
<p>BSD开源协议是一个给于使用者很大自由的协议。基本上使用者可以”为所欲为”,可以自由的使用，修改源代码，也可以将修改后的代码作为开源或者专有软件再发布。</p>
<p>但”为所欲为”的前提当你发布使用了BSD协议的代码，或则以BSD协议代码为基础做二次开发自己的产品时，需要满足三个条件：</p>
<ol>
<li>如果再发布的产品中包含源代码，则在源代码中必须带有原来代码中的BSD协议。</li>
<li>如果再发布的只是二进制类库/软件，则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。</li>
<li>不可以用开源代码的作者/机构名字和原来产品的名字做市场推广。</li>
</ol>
<p>BSD 代码鼓励代码共享，但需要尊重代码作者的著作权。BSD由于允许使用者修改和重新发布代码，也允许使用或在BSD代码上开发商业软件发布和销售，因此是对商业集成很友好的协议。而很多的公司企业在选用开源产品的时候都首选BSD协议，因为可以完全控制这些第三方的代码，在必要的时候可以修改或者二次开发。</p>
<p><strong>Apache Licence 2.0（</strong><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>、<a href="http://www.apache.org/LICENSE-1.1">Apache License, Version 1.1</a>、<a href="http://www.apache.org/LICENSE-1.0">Apache License, Version 1.0</a><strong>）</strong></p>
<p>Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似，同样鼓励代码共享和尊重原作者的著作权，同样允许代码修改，再发布（作为开源或商业软件）。需要满足的条件也和BSD类似：</p>
<ol>
<li>需要给代码的用户一份Apache Licence</li>
<li>如果你修改了代码，需要再被修改的文件中说明。</li>
<li>在延伸的代码中（修改和有源代码衍生的代码中）需要带有原来代码中的协议，商标，专利声明和其他原来作者规定需要包含的说明。</li>
<li>如果再发布的产品中包含一个Notice文件，则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可，但不可以表现为对Apache Licence构成更改。</li>
</ol>
<p>Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。</p>
<p><strong>GPL（</strong><a name="GNUGPL"></a><strong>）</strong></p>
<p>我们很熟悉的Linux就是采用了GPL。GPL协议和BSD, Apache Licence等鼓励代码重用的许可很不一样。GPL的出发点是代码的开源/免费使用和引用/修改/衍生代码的开源/免费使用，但不允许修改后和衍生的代码做为闭源的商业软件发布和销售。这也就是为什么我们能用免费的各种linux，包括商业公司的linux和linux上各种各样的由个人，组织，以及商业软件公司开发的免费软件了。</p>
<p>GPL协议的主要内容是只要在一个软件中使用(”使用”指类库引用，修改后的代码或者衍生代码)GPL 协议的产品，则该软件产品必须也采用GPL协议，既必须也是开源和免费。<strong>这就是所谓的”传染性”</strong>。GPL协议的产品作为一个单独的产品使用没有任何问题，还可以享受免费的优势。</p>
<p>由于GPL严格要求使用了GPL类库的软件产品必须使用GPL协议，对于使用GPL协议的开源代码，商业软件或者对代码有保密要求的部门就不适合集成/采用作为类库和二次开发的基础。</p>
<p>其它细节如再发布的时候需要伴随GPL协议等和BSD/Apache等类似。</p>
<p><strong>LGPL（</strong><a name="LGPL"></a><strong>）</strong></p>
<p>LGPL是GPL的一个为主要为类库使用设计的开源协议。和GPL要求任何使用/修改/衍生之GPL类库的的软件必须采用GPL协议不同。LGPL允许商业软件通过类库引用(link)方式使用LGPL类库而不需要开源商业软件的代码。这使得采用LGPL协议的开源代码可以被商业软件作为类库引用并发布和销售。</p>
<p>但是如果修改LGPL协议的代码或者衍生，则所有修改的代码，涉及修改部分的额外代码和衍生的代码都必须采用LGPL协议。因此LGPL协议的开源代码很适合作为第三方类库被商业软件引用，但不适合希望以LGPL协议代码为基础，通过修改和衍生的方式做二次开发的商业软件采用。</p>
<p>GPL/LGPL都保障原作者的知识产权，避免有人利用开源代码复制并开发类似的产品</p>
<p><strong>MIT（<a href="http://www.opensource.org/licenses/mit-license.php">MIT</a>）</strong></p>
<p>MIT是和BSD一样宽范的许可协议,作者只想保留版权,而无任何其他了限制.也就是说,你必须在你的发行版里包含原许可协议的声明,无论你是以二进制发布的还是以源代码发布的.</p></blockquote>
<p>我个人觉得Apache Licence 2.0、GPL是比较适合的开源协议，一般的话就采用这两种授权协议作为授权协议。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/10/five-open-source-licenses-comparison/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>密码保护：新的GAE代理软件酝酿中</title>
		<link>http://www.kernel2heart.com/2009/10/new-gae-proxy/</link>
		<comments>http://www.kernel2heart.com/2009/10/new-gae-proxy/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 09:05:16 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[心路历程]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[开源项目]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/10/new-gae-proxy/</guid>
		<description><![CDATA[无法提供摘要。这是一篇受保护的文章。]]></description>
			<content:encoded><![CDATA[<form action="http://www.kernel2heart.com/wp-pass.php" method="post">
<p>这是一篇受密码保护的文章。您需要提供访问密码：</p>
<p><label for="pwbox-229">密码：<br />
<input name="post_password" id="pwbox-229" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="提交" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/10/new-gae-proxy/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>C#中實現窗體的淡入淡出</title>
		<link>http://www.kernel2heart.com/2009/09/csharp-winform-effect/</link>
		<comments>http://www.kernel2heart.com/2009/09/csharp-winform-effect/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 09:42:11 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[技术交流]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/09/csharp-winform-effect/</guid>
		<description><![CDATA[之前一直在想如何在C#中實現窗體的淡入淡出效果。但是看到網上很多教程說的是利用計時器或者線程功能實現淡入淡出效果。代碼看起來有點小長。沒辦法呀，我這個人是比較懶的嘛。繼續查了查，還有一種利用一個很有問題的API實現的淡入淡出，效果也很一般。回過頭去看看MFC程序，想到了AnimateWindow函數。 The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade. 1 2 3 4 5 BOOL AnimateWindow&#40; HWND hwnd, DWORD dwTime, &#8230; <a href="http://www.kernel2heart.com/2009/09/csharp-winform-effect/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>之前一直在想如何在C#中實現窗體的淡入淡出效果。但是看到網上很多教程說的是利用計時器或者線程功能實現淡入淡出效果。代碼看起來有點小長。沒辦法呀，我這個人是比較懶的嘛。繼續查了查，還有一種利用一個很有問題的API實現的淡入淡出，效果也很一般。回過頭去看看MFC程序，想到了AnimateWindow函數。 </p>
<p> <span id="more-219"></span>
</p>
<blockquote><p>The <strong>AnimateWindow</strong> function enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;">BOOL AnimateWindow<span style="color: #008000;">&#40;</span>
	HWND hwnd,
	DWORD dwTime,
	DWORD dwFlags
	<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></td></tr></table></div>

</blockquote>
<p>其實查閱一下MSDN就知道了，我們這裡使用這個主要是設定一下時間和Flags就可以了。具體的參數可以參見<a href="http://msdn.microsoft.com/zh-cn/developercenters/ms632669(en-us,VS.85).aspx">MSDN</a>。</p>
<p>什麽？在C#沒有定義這些Flags？沒關係，我們手工定義一下就可以了。像我就自己寫了一個類：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> FormEffects
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_HOR_POSITIVE <span style="color: #008000;">=</span> 0x00000001<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_HOR_NEGATIVE <span style="color: #008000;">=</span> 0x00000002<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_VER_POSITIVE <span style="color: #008000;">=</span> 0x00000004<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_VER_NEGATIVE <span style="color: #008000;">=</span> 0x00000008<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_CENTER <span style="color: #008000;">=</span> 0x00000010<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_HIDE <span style="color: #008000;">=</span> 0x00010000<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_ACTIVATE <span style="color: #008000;">=</span> 0x00020000<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_SLIDE <span style="color: #008000;">=</span> 0x00040000<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">const</span> Int32 AW_BLEND <span style="color: #008000;">=</span> 0x00080000<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#91;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Runtime</span><span style="color: #008000;">.</span><span style="color: #0000FF;">InteropServices</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">DllImport</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;user32.dll&quot;</span>, CharSet <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Runtime</span><span style="color: #008000;">.</span><span style="color: #0000FF;">InteropServices</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">CharSet</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Auto</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> <span style="color: #6666cc; font-weight: bold;">bool</span> AnimateWindow<span style="color: #008000;">&#40;</span>
        IntPtr hwnd,   <span style="color: #008080; font-style: italic;">//   handle   to   window    </span>
        <span style="color: #6666cc; font-weight: bold;">int</span> dwTime,   <span style="color: #008080; font-style: italic;">//   duration   of   animation    </span>
        <span style="color: #6666cc; font-weight: bold;">int</span> dwFlags   <span style="color: #008080; font-style: italic;">//   animation   type    </span>
        <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>因為寫的代碼問題，根本不用使用什麽using。如果你想簡化一下也簡單：using System.Runtime.InteropServices即可。唔，我的工作是VAX代勞的，所以無所謂啦。</p>
<p>使用的時候這樣就可以了：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">	<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> WelcomeForm_Load<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AnimateWindow</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Handle</span>, <span style="color: #FF0000;">500</span>, FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_BLEND</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> WelcomeForm_FormClosing<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, FormClosingEventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AnimateWindow</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Handle</span>, <span style="color: #FF0000;">500</span>, FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_HOR_NEGATIVE</span> <span style="color: #008000;">|</span> FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_HIDE</span> <span style="color: #008000;">|</span> FormEffects<span style="color: #008000;">.</span><span style="color: #0000FF;">AW_BLEND</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>其實C#這種高級語言，很多時候如果調用API的話，參見VC的代碼都成啊。= =|||</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/09/csharp-winform-effect/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>新的相册下载工具酝酿中</title>
		<link>http://www.kernel2heart.com/2009/08/new-album-download-tool/</link>
		<comments>http://www.kernel2heart.com/2009/08/new-album-download-tool/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 14:38:09 +0000</pubDate>
		<dc:creator>janxin</dc:creator>
				<category><![CDATA[心路历程]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[相册下载]]></category>

		<guid isPermaLink="false">http://www.kernel2heart.com/2009/08/%e6%96%b0%e7%9a%84%e7%9b%b8%e5%86%8c%e4%b8%8b%e8%bd%bd%e5%b7%a5%e5%85%b7%e9%85%9d%e9%85%bf%e4%b8%ad/</guid>
		<description><![CDATA[更换电脑源码丢失，项目终止！ 其实最初我对这个方向觊觎了好久，不过T娘一直更新的AlbumCon比较勤快，框架也更完善一些。不过最近T娘不打算开发新的框架支持了，我就顺便出来抢一下市场吧。(好邪恶… &#62;. &#60;) 程序名：待定 支持相册：暂时只有xkoo和百度空间 语言&#38;平台：C#  .net2.0 目前这两个相册的下载器也是完成状态了，下面就是整合成一个完整的程序了。下载功能上支持的是程序自带多线程下载和迅雷调用下载。至于快车嘛…暂时没有什么打算。至于代理服务器什么的，暂时不会添加这个功能啦，反正迅雷可以加代理的嘛。其他的很多细节都是直接抄袭了AlbumCon的功能，毕竟那个功能更加全面一些，也更加人性化的。=___,= 其他的一些功能上，支持导出.lst列表文件，支持在线浏览模式，其他的好像也没什么了…有的话，希望你可以提出来。其实AlbumCon是支持百度空间的图片下载的…… 明年这个东西顺便就作毕业设计了。=___,=]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">更换电脑源码丢失，项目终止！</span></p>
<p><span style="text-decoration: line-through;">其实最初我对这个方向觊觎了好久，不过</span><a href="http://www.tortinita.org" target="_blank"><span style="text-decoration: line-through;">T娘</span></a><span style="text-decoration: line-through;">一直更新的</span><a href="http://sitelog.tortinita.org/2006/10/albumcon.html" target="_blank"><span style="text-decoration: line-through;">AlbumCon</span></a><span style="text-decoration: line-through;">比较勤快，框架也更完善一些。不过最近T娘不打算开发新的框架支持了，我就顺便出来抢一下市场吧。(好邪恶… &gt;. &lt;)</span></p>
<p><span id="more-117"></span></p>
<blockquote><p><span style="text-decoration: line-through;">程序名：待定</span></p>
<p><span style="text-decoration: line-through;">支持相册：暂时只有xkoo和百度空间</span></p>
<p><span style="text-decoration: line-through;">语言&amp;平台：C#  .net2.0</span></p></blockquote>
<p><span style="text-decoration: line-through;">目前这两个相册的下载器也是完成状态了，下面就是整合成一个完整的程序了。下载功能上支持的是程序自带多线程下载和迅雷调用下载。至于快车嘛…暂时没有什么打算。至于代理服务器什么的，暂时不会添加这个功能啦，反正迅雷可以加代理的嘛。其他的很多细节都是直接抄袭了AlbumCon的功能，毕竟那个功能更加全面一些，也更加人性化的。=___,=</span></p>
<p><span style="text-decoration: line-through;">其他的一些功能上，支持导出.lst列表文件，支持在线浏览模式，其他的好像也没什么了…有的话，希望你可以提出来。其实AlbumCon是支持百度空间的图片下载的……</span></p>
<p><span style="text-decoration: line-through;">明年这个东西顺便就作毕业设计了。=___,=</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel2heart.com/2009/08/new-album-download-tool/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

