<?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>Becomin&#039; Charles &#187; programming</title>
	<atom:link href="http://sexywp.com/tags/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://sexywp.com</link>
	<description>Building another myself~~</description>
	<lastBuildDate>Fri, 27 Jan 2012 16:00:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MVC最佳实践</title>
		<link>http://sexywp.com/mvc-best-practice.htm</link>
		<comments>http://sexywp.com/mvc-best-practice.htm#comments</comments>
		<pubDate>Mon, 07 Mar 2011 09:44:39 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Yii]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=414</guid>
		<description><![CDATA[前一段日子，写了一篇《MVC就是一个选择题》，重点描述了我对MVC模式的迷惑。随着我对这个模式应用时间的深入，渐渐感到得心应手，这个模式早在30多年前就已经发明了，确实经受了时间的考验，可以说是千锤百炼。但是，实践过程中，我也发现，更多的时候照猫画虎还是有很多弊端的，想要真正做好MVC的选择题，必须在项目中不断犯错误，不断修正，才能逐渐走上正轨。我参加的项目主要运用了Yii框架，是目前比较流行的一个Web开发框架。随着前不久，1.1.6版本的发布，我发现Yii框架的文档中，多了一篇MVC最佳实践的文章。我想，这个文章对于初学者来说，应该具备相当的指导性，而且指导相当具体。如果也有跟我相同的迷茫，应该好好钻研一下这篇文章，并且身体力行去验证之，这里给出链接。我在这篇文章中，就是概括简述一下那篇文档的内容。

<span class="readmore"><a href="http://sexywp.com/mvc-best-practice.htm" title="MVC最佳实践">Keep Reading --- 1394 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC就是个选择题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC就是个选择题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Dedian 5的PHP包缺少readline支持" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>前一段日子，写了一篇《<a href="http://sexywp.com/mvc-chose-where-to-put-your-code.htm">MVC就是一个选择题</a>》，重点描述了我对MVC模式的迷惑。随着我对这个模式应用时间的深入，渐渐感到得心应手，这个模式早在30多年前就已经发明了，确实经受了时间的考验，可以说是千锤百炼。但是，实践过程中，我也发现，更多的时候照猫画虎还是有很多弊端的，想要真正做好MVC的选择题，必须在项目中不断犯错误，不断修正，才能逐渐走上正轨。我参加的项目主要运用了Yii框架，是目前比较流行的一个Web开发框架。随着前不久，1.1.6版本的发布，我发现Yii框架的文档中，多了一篇MVC最佳实践的文章。我想，这个文章对于初学者来说，应该具备相当的指导性，而且指导相当具体。如果也有跟我相同的迷茫，应该好好钻研一下这篇文章，并且身体力行去验证之，<a href="http://www.yiiframework.com/doc/guide/1.1/en/basics.best-practices">这里给出链接</a>。我在这篇文章中，就是概括简述一下那篇文档的内容。<span id="more-414"></span></p>
<p>MVC的核心理念是代码的重用和关注点的分离（Separation of concern 我个人对这个理解就是将数据和表现进行分离）。如何正确遵循MVC的原理来编写代码是有一些基本指导原则可以遵循的。为了便于理解后面将要叙述的指导原则，我们这里认为一个典型的Web应用由以下几个子应用（部分）组成：</p>
<ul>
<li>前端——网站界面，面向普通用户</li>
<li>后台——一部分有管理权限的用户用于维护Web应用的正常运转</li>
<li>控制台——在终端中执行的命令，或者是定时任务如cronjob，用于日常运维</li>
<li>API——用于第三方合作，或者二次开发</li>
</ul>
<h3>Model</h3>
<p>模型用于表示底层数据结构，经常在整个应用的不同部分共享，有些模型在前后台、API中都会用到，所以一个模型应该遵循的指导原则有：</p>
<ul>
<li>包含属性用于描述特定的数据</li>
<li>应该包含业务逻辑，以确保数据能够满足表现的需要</li>
<li>应该包含数据操作的代码，比如数据存储、检索</li>
<li>不应该使用$_GET $_POST这样的只有在前端才会出现的数组，在控制台和API用到时候，可能就无法复用了</li>
<li>不应该出现HTML代码，负责表现的代码应该放到view文件中</li>
</ul>
<p>在上述指导原则下，可能会写出非常庞大的Model类（过多数据操作，业务逻辑代码包含其中）。这种情况下，建议进一步抽象，提炼出一个基类，包含最通用的功能，然后前端、后端和API在用到时候，将各个子应用才相关的逻辑放到基类继承出来的子类里面。</p>
<h3>View</h3>
<p>视图主要就用于前端表现的代码。</p>
<ul>
<li>包含HTML，以及所有负责表现的代码，可以出现PHP，但是只用于遍历数据、格式化数据</li>
<li>不应该包含DB请求</li>
<li>不应该出现引用$_GET $_POST这类数组的代码，这应该是Controller的工作。View只是专注于表现，布局等和页面呈现有关的业务，用户的请求数据应该由Controller和Model负责处理</li>
<li>如果必要，可以访问Model和Controller的属性，不过这是为了满足表现的需要</li>
</ul>
<p>可以使用诸如布局、部分视图、HTML Helper类、Widget等框架特性来最大程度重用View的代码。</p>
<h3>Controller</h3>
<p>控制器是将模型、视图和其他组件组装在一起形成一个应用的粘合剂。控制器直接负责处理终端用户的请求。</p>
<ul>
<li>可以访问$_GET $_POST这样的用户请求数组</li>
<li>创建模型，并决定一个模型对象的生命周期</li>
<li>不应该出现SQL语句，数据库请求应该放到Model中</li>
<li>不应该出现HTML代码，而应该将其放入到View中</li>
</ul>
<p>在一个设计良好的MVC应用中，控制器是非常轻量级的，经常只有几十行代码的样子；而Model总是非常复杂而且庞大，包含了所有的用于表现的数据及其操作方法。这是因为由数据结构和业务逻辑组成的模型对每个应用来说，都是独特的，需要大量的定制化工作来满足应用的需求；控制器的逻辑经常遵循一个特定的套路，在各个应用中都差不多，因此可以被框架底层代码极大程度地简化（也就是说不是控制器代码少，而是Web开发框架已经都抽象出来并且都帮你做好了，这也就是框架的价值和能够实现快速开发的原因）。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC就是个选择题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC就是个选择题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Dedian 5的PHP包缺少readline支持" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/development" title="development" rel="tag">development</a>, <a href="http://sexywp.com/tags/mvc" title="MVC" rel="tag">MVC</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/mvc-best-practice.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>在Hibernate里配置Proxool连接池</title>
		<link>http://sexywp.com/configure-connection-pool-with-hibernate.htm</link>
		<comments>http://sexywp.com/configure-connection-pool-with-hibernate.htm#comments</comments>
		<pubDate>Tue, 14 Jul 2009 07:22:37 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://sexywp.com/configure-connection-pool-with-hibernate.htm</guid>
		<description><![CDATA[在网上搜出了很多给Hibernate配置连接池的文章，不过基本上都是同一篇文章，介绍了3种连接池的配置方法，我先试验了c3p0，感觉不出有什么快的，只是觉得在并发测试中，减少了出错的概率。那篇帖子最底下，说道社区普遍认为c3p0不够优秀，大家更倾向使用proxool，于是乎，我决定也试试，当然，我自己完全是没任何经验的，纯粹是为了试试。

去proxool下载了最新版本，0.9.1（我用的Hibernate是3.2.5版本，实际上0.9.1配置好后，跑步起来，最后还是用了0.8.3，后面会说的），按照网上普遍能搜到的帖子里的那个方法配置。

<span class="readmore"><a href="http://sexywp.com/configure-connection-pool-with-hibernate.htm" title="在Hibernate里配置Proxool连接池">Keep Reading --- 913 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Java的开源XML工具包dom4j" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/01/10587680.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Java的开源XML工具包dom4j</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何让Java程序定时运行" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-java-task-scheduled-excecute.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/23/9225479.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何让Java程序定时运行</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title=".NET Windows Forms窗体中的事件顺序" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="不要使用PeekChar()判断EOF" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title=".net中如何只允许运行一个程序实例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>在网上搜出了很多给Hibernate配置连接池的文章，不过基本上都是同一篇文章，介绍了3种连接池的配置方法，我先试验了c3p0，感觉不出有什么快的，只是觉得在并发测试中，减少了出错的概率。那篇帖子最底下，说道社区普遍认为c3p0不够优秀，大家更倾向使用proxool，于是乎，我决定也试试，当然，我自己完全是没任何经验的，纯粹是为了试试。</p>
<p>去proxool下载了最新版本，0.9.1（我用的Hibernate是3.2.5版本，实际上0.9.1配置好后，跑步起来，最后还是用了0.8.3，后面会说的），按照网上普遍能搜到的帖子里的那个方法配置。</p>
<p> <span id="more-352"></span>
<p>在hibernate.cfg.xml中加入:</p>
<pre><span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">&quot;hibernate.proxool.pool_alias&quot;</span><span style="color: #0000ff">&gt;</span>pool1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">property</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">&quot;hibernate.proxool.xml&quot;</span><span style="color: #0000ff">&gt;</span>proxoolconf.xml<span style="color: #0000ff">&lt;/</span><span style="color: #800000">property</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">&quot;hibernate.connection.provider_class&quot;</span><span style="color: #0000ff">&gt;</span>org.hibernate.connection.ProxoolConnectionProvider<span style="color: #0000ff">&lt;/</span><span style="color: #800000">property</span><span style="color: #0000ff">&gt;</span></pre>
<p>然后，再在classpath下面放一个proxoolconf.xml的配置文件，里面的内容为：</p>
<pre><span style="color: #0000ff">&lt;?</span>xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;<span style="color: #0000ff">?&gt;</span>
<span style="color: #008000">&lt;!-- the proxool configuration can be embedded within your own application's.
Anything outside the &quot;proxool&quot; tag is ignored. --&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">something</span>-<span style="color: #ff0000">else</span>-<span style="color: #ff0000">entirely</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">proxool</span><span style="color: #0000ff">&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">alias</span><span style="color: #0000ff">&gt;</span>pool1<span style="color: #0000ff">&lt;/</span><span style="color: #800000">alias</span><span style="color: #0000ff">&gt;</span>
<span style="color: #008000">&lt;!--proxool只能管理由自己产生的连接--&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">driver</span>-<span style="color: #ff0000">url</span><span style="color: #0000ff">&gt;</span>jdbc:mysql://localhost:3306/struts?useUnicode=true&amp;characterEncoding=GBK<span style="color: #0000ff">&lt;/</span><span style="color: #800000">driver</span>-url<span style="color: #0000ff">&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">driver</span>-<span style="color: #ff0000">class</span><span style="color: #0000ff">&gt;</span>org.gjt.mm.mysql.Driver<span style="color: #0000ff">&lt;/</span><span style="color: #800000">driver</span>-class<span style="color: #0000ff">&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">driver</span>-<span style="color: #ff0000">properties</span><span style="color: #0000ff">&gt;</span>
            <span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">&quot;user&quot;</span> <span style="color: #ff0000">value</span>=<span style="color: #0000ff">&quot;root&quot;</span><span style="color: #0000ff">/&gt;</span>
            <span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">&quot;password&quot;</span> <span style="color: #ff0000">value</span>=<span style="color: #0000ff">&quot;8888&quot;</span><span style="color: #0000ff">/&gt;</span>
        <span style="color: #0000ff">&lt;/</span><span style="color: #800000">driver</span>-properties<span style="color: #0000ff">&gt;</span>
<span style="color: #008000">&lt;!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁--&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">house</span>-<span style="color: #ff0000">keeping</span>-<span style="color: #ff0000">sleep</span>-<span style="color: #ff0000">time</span><span style="color: #0000ff">&gt;</span>90000<span style="color: #0000ff">&lt;/</span><span style="color: #800000">house</span>-keeping-sleep-time<span style="color: #0000ff">&gt;</span>
<span style="color: #008000">&lt;!-- 指因未有空闲连接可以分配而在队列中等候的最大请求数,超过这个请求数的用户连接就不会被接受--&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">maximum</span>-<span style="color: #ff0000">new</span>-<span style="color: #ff0000">connections</span><span style="color: #0000ff">&gt;</span>20<span style="color: #0000ff">&lt;/</span><span style="color: #800000">maximum</span>-new-connections<span style="color: #0000ff">&gt;</span>
<span style="color: #008000">&lt;!-- 最少保持的空闲连接数--&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">prototype</span>-<span style="color: #ff0000">count</span><span style="color: #0000ff">&gt;</span>5<span style="color: #0000ff">&lt;/</span><span style="color: #800000">prototype</span>-count<span style="color: #0000ff">&gt;</span>
<span style="color: #008000">&lt;!-- 允许最大连接数,超过了这个连接，再有请求时，就排在队列中等候，最大的等待请求数由maximum-new-connections决定--&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">maximum</span>-<span style="color: #ff0000">connection</span>-<span style="color: #ff0000">count</span><span style="color: #0000ff">&gt;</span>100<span style="color: #0000ff">&lt;/</span><span style="color: #800000">maximum</span>-connection-count<span style="color: #0000ff">&gt;</span>
<span style="color: #008000">&lt;!-- 最小连接数--&gt;</span>
        <span style="color: #0000ff">&lt;</span><span style="color: #800000">minimum</span>-<span style="color: #ff0000">connection</span>-<span style="color: #ff0000">count</span><span style="color: #0000ff">&gt;</span>10<span style="color: #0000ff">&lt;/</span><span style="color: #800000">minimum</span>-connection-count<span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">proxool</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">something</span>-else-entirely<span style="color: #0000ff">&gt;</span> </pre>
<p>如果人品好，到这里应该就没有别的事情要做了，就是把proxool-0.9.1.jar放到你的classpath中就OK了，可惜事情偏偏不会那么顺利。</p>
<p>这样子搞，会出现一个错误：</p>
<p>org.hibernate.HibernateException: Proxool Provider unable to load JAXP configurator file: proxool.xml<br />
  <br />org.logicalcobwebs.proxool.ProxoolException: Parsing failed.</p>
<p>于互联网上疯狂搜索，找了很多的说法，过滤了无数信息，终于发现一个哥们儿说的招儿有效：</p>
<p><strong><span style="color:#ff0000">将proxoolconf.xml里面的中文删除即可。</span></strong>汗死！~~~</p>
<p>以为到这里消停了吧，一启动服务器，又出错了：</p>
<p><a href="http://sexywp.com/tags/java" class="st_tag internal_tag" rel="tag" title="标签 java 下的日志">java</a>.lang.ClassNotFoundException: org.logicalcobwebs.cglib.proxy.Callback</p>
<p>然后我在proxool的代码里找了半天，竟然没有这个类，到网上搜索依赖的jar包，发现这个类在proxool-0.8.3.jar中才包含，于是乎只好再换过去。</p>
<p>看来，最新的东西是不能用的啊……另外，我以一个实例说明了，使用Java开发项目是多么的麻烦，选用Hibernate作为持久层，你还要考虑配备什么连接池，然后连接池有好多种，每种的性能，使用方法不一样，选定一种后，你还面临着版本兼容问题。这么小一个地方，就出了这么多麻烦，网上甚至看到一个哥们儿，写着，调试了5天了，还没有找到出错原因……唉……</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Java的开源XML工具包dom4j" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/01/10587680.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Java的开源XML工具包dom4j</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何让Java程序定时运行" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-java-task-scheduled-excecute.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/23/9225479.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何让Java程序定时运行</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title=".NET Windows Forms窗体中的事件顺序" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="不要使用PeekChar()判断EOF" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title=".net中如何只允许运行一个程序实例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fconfigure-connection-pool-with-hibernate.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/java" title="java" rel="tag">java</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/configure-connection-pool-with-hibernate.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.net中的自动文档生成工具</title>
		<link>http://sexywp.com/doc-generate-tool-in-dotnet.htm</link>
		<comments>http://sexywp.com/doc-generate-tool-in-dotnet.htm#comments</comments>
		<pubDate>Tue, 06 May 2008 09:02:14 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/?p=81</guid>
		<description><![CDATA[由于项目的原因，我需要使用C#编程，以前使用JAVA的时候，就觉得javadoc是非常方便的功能，C#里面也添加了对xml格式的注释的支持，我想当然的觉得Visul Studio里面也会带有类似javadoc那样的工具简简单单就可以生成不差于javadoc的文档。 

 实际上，我大错特错了。我用的是VS2005，里面根本就没有找到类似的选项，最多只能生成一个xml格式的注释提取文件，但是大家都知道，xml虽然是文档，但是not for humen beings。通过搜索，我知道了早在.net 2003的时期，VS是支持这个功能的，但是从2005开始，这个功能就被取消掉了。    一般网上搜索到的文章都会推荐NDoc1.3，这个着实误导了我一会儿，因为这个叫NDoc的开源项目早在2005年就已经停止开发了。其支持的.net framework版本只达到1.1。关于介绍这个NDoc的使用的文章，大家可以看一篇英文的文档如下： 

<span class="readmore"><a href="http://sexywp.com/doc-generate-tool-in-dotnet.htm" title=".net中的自动文档生成工具">Keep Reading --- 1465 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>由于项目的原因，我需要使用C#编程，以前使用JAVA的时候，就觉得javadoc是非常方便的功能，C#里面也添加了对xml格式的注释的支持，我想当然的觉得Visul Studio里面也会带有类似javadoc那样的工具简简单单就可以生成不差于javadoc的文档。 </p>
<p> 实际上，我大错特错了。我用的是VS2005，里面根本就没有找到类似的选项，最多只能生成一个xml格式的注释提取文件，但是大家都知道，xml虽然是文档，但是not for humen beings。通过搜索，我知道了早在.net 2003的时期，VS是支持这个功能的，但是从2005开始，这个功能就被取消掉了。 <br /> <span id="more-81"></span> <br /> 一般网上搜索到的文章都会推荐NDoc1.3，这个着实误导了我一会儿，因为这个叫NDoc的开源项目早在2005年就已经停止开发了。其支持的.net framework版本只达到1.1。关于介绍这个NDoc的使用的文章，大家可以看一篇英文的文档如下： </p>
<p> <a href="http://www.codeproject.com/KB/XML/csharpcodedocumentation.aspx">http://www.codeproject.com/KB/XML/csharpcodedocumentation.aspx</a> </p>
<p> 上述文档从C#中的xml格式的注释开始，到NDoc的使用，都给出了非常详尽的说明。但是，现在真的还有人用.net 1.1的话，看到这里就可以直接去留言了，呵呵。我现在正在使用的是.net 2.0，我相信还有很多人跟我用同样的版本。刚才提到的NDoc最终版本为1.3，不支持.net 2.0，那么下面这篇文档介绍了如何让NDoc 1.3支持.net 2.0，一共给出了三种方法。 </p>
<p> <a href="http://forums.asp.net/t/997774.aspx">http://forums.asp.net/t/997774.aspx</a> </p>
<p> 不过，我都没有实验成功，一个是通过改配置文件的方法，上面的帖子里面可以下载的。还有一个是通过重新用VS2005编译NDoc1.3的源码的方法，这个方法在转换项目的时候有一个链接库找不到，是Html Help Workshop的一个链接库，我的系统里面没有，所以我这个方法也没有成功。 </p>
<p> 再后来，我找到了微软官方发布的工具，叫做Sandcastle（沙堡？），这个工具是微软官方推出的专门用来生成文档的工具，不过很遗憾是命令行工具，当然我不是一个命令行狂热者，否则我不会这么失望。下面的链接给出了这个工具的博客，可能你会找不到下载链接，呵呵:-)。 </p>
<p> <a href="http://blogs.msdn.com/sandcastle/">http://blogs.msdn.com/sandcastle/</a> </p>
<p> 上面的那个官方的，王道的工具，真的很难用，我装上了，完全用不了，因为要好几个步骤，好多命令，所以，骂我白痴吧。但是有个好心的老外，为其开发了一个界面，叫做SandcastleGUI，就是很简单的界面，在下面的页面里，大家可以看到这个工具的介绍。 </p>
<p> <a href="http://www.inchl.nl/SandcastleGUI/">http://www.inchl.nl/SandcastleGUI/</a> </p>
<p> <a href="http://www.codeproject.com/KB/cs/SandcastleBuilder.aspx">http://www.codeproject.com/KB/cs/SandcastleBuilder.aspx</a> </p>
<p> 经过试用，我发现，这个东西似乎没有什么作用，就是基本上什么也没有产生出来，所以，真的让我很失望，但是很多人说这个挺好用，第二个链接是另一个GUI的Sandcastle，界面模仿得已经和NDoc很像了，但是我用了以后，发现我程序里面引用了一个第三方插件，造成这个东西异常了，最终也没有能够产生出我要的文档。看来微软的这个工具还真的像沙塔一样不可靠呢。 </p>
<p> 最后，我知道了一个叫做NDoc2005的开源项目，在NDoc的基础上建立起来的，可以兼容.net 2.0。看来，我的希望来了。 </p>
<p> <a href="http://sourceforge.net/projects/ndoc05">http://sourceforge.net/projects/ndoc05</a> </p>
<p> 上面的网址可以获取NDoc 2005版本，但是我提醒想要偷懒的兄弟们，一定要下载源代码包，因为如果你只下载安装包的话，你会发现有个叫做Documenter的东西一直找不到，你什么文档都得不到的，只有那个src包里面才有这个文件夹。我就是把这个文件夹拷贝到了C:\Document and Settings\下面，才能正常使用的。这个工具如同NDoc1.3，可以生成msdn，xml，javadoc，msdn2003（beta）等各种格式的文档。非常强大。而且，如果程序里面引用了第三方插件的话，也可以成功跨过去，编译第一次会失败，第二次就会成功（不知道为什么）。 </p>
<p> 本来，故事到这里就结束了。但是，如果你像我一样，非常土的用中文写注释的话，那么故事还没有完，有可能你会碰到这个情况。当你编译msdn格式的文档的时候，你把LangID选成2052的时候，虽然能够支持中文，但是英文空格都以"？"来显示，而你把LangID选成1033的时候，虽然英文正常，但是所有汉字都是"？"，怎么样，够恶心吧，不能非得二选一吧，我甚至尝试着自己编译NDoc2005的源代码，解决问题失败。 </p>
<p> 终于，皇天不负有心人，我找到了这个。NDoc2007，实际上那篇文章是非常简单的，就给了个链接和一句话。见下面的链接。 </p>
<p> <a href="http://blog.vckbase.com/bastet/archive/2007/07/11/27300.html">http://blog.vckbase.com/bastet/archive/2007/07/11/27300.html</a> </p>
<p> 如果那个链接已经失效了，我还备份了一份。<a href="http://download.csdn.net/source/898171">点这里</a>。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/diy" title="DIY" rel="tag">DIY</a>, <a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/doc-generate-tool-in-dotnet.htm/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>让自定义控件产生自定义事件</title>
		<link>http://sexywp.com/custom-event-in-custom-control.htm</link>
		<comments>http://sexywp.com/custom-event-in-custom-control.htm#comments</comments>
		<pubDate>Tue, 06 May 2008 08:58:07 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/?p=79</guid>
		<description><![CDATA[首先在控件中放置一个System.EventHandler，然后在应该产生事件的地方直接向EventHandler传递参数即可。 

 这个东西，我还是按照自己的理解来描述一下。就是等于说在你的对象里面放一个函数指针，这个指针指向某个函数，你还不知道，当对象被创建了，处理事件的那个函数也在程序的其他某个地方被创建了，并且赋值给了这个函数指针的时候，通过这个函数指针，你就可以调用那个时间处理函数了，看起来，就好像发生了事件一样。 

 所以，事实上你在创建这个函数指针的时候，并不知道这个指针是否肯定要被赋值，也有可能永远不会被赋值。所以，每次调用的时候，应该判断是否已经被赋值。 

<span class="readmore"><a href="http://sexywp.com/custom-event-in-custom-control.htm" title="让自定义控件产生自定义事件">Keep Reading --- 595 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows组件中的Timer计时精确度有限</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>首先在控件中放置一个System.EventHandler，然后在应该产生事件的地方直接向EventHandler传递参数即可。 </p>
<p> 这个东西，我还是按照自己的理解来描述一下。就是等于说在你的对象里面放一个函数指针，这个指针指向某个函数，你还不知道，当对象被创建了，处理事件的那个函数也在程序的其他某个地方被创建了，并且赋值给了这个函数指针的时候，通过这个函数指针，你就可以调用那个时间处理函数了，看起来，就好像发生了事件一样。 </p>
<p> 所以，事实上你在创建这个函数指针的时候，并不知道这个指针是否肯定要被赋值，也有可能永远不会被赋值。所以，每次调用的时候，应该判断是否已经被赋值。 </p>
<p> 这就让我想起了以前我在天津的时候，那种住宅楼都有一条专门走垃圾的管道，想让你们家支持扔垃圾这个事件，就要把垃圾管道通道家里，但是你并不知道管道的那一头是不是连接着垃圾箱，或者垃圾箱还没有建好，所以，你必须在扔垃圾前确认一下，当你发现楼下的垃圾箱完好的时候，你在家里，当你需要扔垃圾的时候，你只要打开管道的门，把垃圾袋放进管道里面，就O.K.了，楼下的垃圾箱就会收到一袋垃圾，然后会有专人处理垃圾箱的。 </p>
<p> 你在扔垃圾前也可以不去确认，那么结果就很糟糕，你知道的，可能当你走到楼下的时候，一转弯，发现一大堆很臭的垃圾，而那恰恰是你自己扔的。嘿嘿…… <br /> 
<div class="hl-surround"><div class="hl-main"><span style="color: Gray;">&lt;</span><span style="color: Blue;">br</span><span style="color: Gray;"> /&gt;&nbsp; &nbsp; &nbsp;</span><span style="color: Green;">public</span><span style="color: Gray;"> </span><span style="color: Green;">class</span><span style="color: Gray;"> </span><span style="color: Blue;">ListWithChangedEvent</span><span style="color: Gray;"> : </span><span style="color: Blue;">System</span><span style="color: Gray;">.</span><span style="color: Blue;">Collections</span><span style="color: Gray;">.</span><span style="color: Blue;">ArrayList</span><span style="color: Gray;"> &lt;</span><span style="color: Blue;">br</span><span style="color: Gray;"> /&gt;&nbsp; &nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"> &lt;</span><span style="color: Blue;">br</span><span style="color: Gray;"> /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;"> 垃圾管道通进家了 &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;public event System.EventHandler Changed; &lt;br /&gt;&nbsp; &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 该扔垃圾的时候调用这个 &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;protected virtual void OnChanged(System.EventArgs e) &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (Changed != null) //确认一下另一头是不是有个垃圾箱 &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Changed(this, e); &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &lt;br /&gt;&nbsp; &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 瞧，现在该扔了，所以，只要扔就可以了 &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;public override int Add(object value) &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int i = base.Add(value); &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OnChanged(System.EventArgs.Empty); &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return i; &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &lt;br /&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//以下省略 &lt;br /&gt;</span><span style="color: #ffa500;"></span></div></div>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows组件中的Timer计时精确度有限</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/diy" title="DIY" rel="tag">DIY</a>, <a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/custom-event-in-custom-control.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Label标签怎么使用？</title>
		<link>http://sexywp.com/a-problem-with-label.htm</link>
		<comments>http://sexywp.com/a-problem-with-label.htm#comments</comments>
		<pubDate>Sat, 26 Apr 2008 08:50:41 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/?p=76</guid>
		<description><![CDATA[我在写一个类似电视墙一样的软件，就是视频监控管理软件。 

 在每一个小电视的顶上，我需要显示一条消息，告诉用户当前的状态，比如"no video""recording"等等。我使用了Label控件。结果出现的效果真的让我觉得很"震撼"。当我一屏展示36个画面的时候，首先每个"小电视"是一个个顺序出来的，在应该显示消息的那个位置，显示的是一块黑方块，然后等所有的"小电视"呈现完毕了，那些label才逐一出现在那些黑方块上。 

 也许是我的编程的水准太低下了，我用的1.8G双核，2G内存，都是这么糟糕的效果，放到客户机器上，真的是给我一种要"毁灭"的感觉。不禁恨自己的水平太臭了，但是我总要学的啊，原谅我一次吧。 

<span class="readmore"><a href="http://sexywp.com/a-problem-with-label.htm" title="Label标签怎么使用？">Keep Reading --- 538 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>我在写一个类似电视墙一样的软件，就是视频监控管理软件。 </p>
<p> 在每一个小电视的顶上，我需要显示一条消息，告诉用户当前的状态，比如"no video""recording"等等。我使用了Label控件。结果出现的效果真的让我觉得很"震撼"。当我一屏展示36个画面的时候，首先每个"小电视"是一个个顺序出来的，在应该显示消息的那个位置，显示的是一块黑方块，然后等所有的"小电视"呈现完毕了，那些label才逐一出现在那些黑方块上。 </p>
<p> 也许是我的编程的水准太低下了，我用的1.8G双核，2G内存，都是这么糟糕的效果，放到客户机器上，真的是给我一种要"毁灭"的感觉。不禁恨自己的水平太臭了，但是我总要学的啊，原谅我一次吧。 </p>
<p> 我后来想了另一个办法，就是把我要显示的消息都截屏成了图片，然后用一个panel来载入图片的办法显示消息。这样子，虽然"小电视"还是一个个出现，但至少一个"小电视"是完整的，不会像使用label的时候的那个烂样子。 </p>
<p> 唉，我真的为自己感到"很抱歉"了。想来我是误会了Label的正确用法了，别的地方我也有做得不好的地方。我现在对程序的效率感到很头痛，不知道这些控件在屏幕上的出现是不是也可以使用双缓冲？希望有牛人看到的话给我点指点。 </p>
<p> 最后发个牢骚，现在市面上的技术书籍都太浮躁了，都是教怎么"ABC"的，没有教"DEF"的，让我觉得非常恶心，想找一本讲C# Windows Form编程的书，根本就没有好的，中文的没有，英文的也没有，唉……</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/a-problem-with-label.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows组件中的Timer计时精确度有限</title>
		<link>http://sexywp.com/the-timer-is-not-accurate.htm</link>
		<comments>http://sexywp.com/the-timer-is-not-accurate.htm#comments</comments>
		<pubDate>Tue, 08 Apr 2008 12:49:46 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/?p=48</guid>
		<description><![CDATA[真是无比惭愧啊，过了这么久，连这么基础的知识都不知道，特意记录在此。

今天，实验室要求我编写一个小程序，操纵一个摄像头按照指定的时间间隔拍摄照片。真的是小Case啦。两个多小时，我做完了。晚上，我兴致勃勃的开始了测试。

按照需求，我测了一下1秒中内等时间间隔拍摄10张图片。在反复不断测试中，我突然惊讶的发现了一个问题——我拍摄下来的图片，不是间隔100毫秒的，而是间隔109毫秒。

<span class="readmore"><a href="http://sexywp.com/the-timer-is-not-accurate.htm" title="Windows组件中的Timer计时精确度有限">Keep Reading --- 862 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>真是无比惭愧啊，过了这么久，连这么基础的知识都不知道，特意记录在此。</p>
<p>今天，实验室要求我编写一个小程序，操纵一个摄像头按照指定的时间间隔拍摄照片。真的是小Case啦。两个多小时，我做完了。晚上，我兴致勃勃的开始了测试。</p>
<p>按照需求，我测了一下1秒中内等时间间隔拍摄10张图片。在反复不断测试中，我突然惊讶的发现了一个问题——我拍摄下来的图片，不是间隔100毫秒的，而是间隔109毫秒。</p>
<p>开始，我以为这是因为我的中断处理程序的执行时间造成的，于是，我给时间间隔做了个修正，即如果设置时间间隔为100的话，在程序内部，就按照90毫秒来触发。发现这种情况下，时间间隔变成了93或94毫秒。</p>
<p>终于还是把这个问题问出了口，对面的小哥立刻告诉我，Timer使用的时间中断，Windows中每隔1/18秒触发一个时钟中断，所以，Timer的定时精度只能达到55毫秒。晕死，这么简单的事情，我竟然不知道，一看msdn，还真是这么回事。</p>
<p>按照msdn的指引，选用了所谓的更加精确的服务器计时器，System.Timers.Timer，重新测试，发现结果没有变。晕死，怎么会这样呢？仔细看文档，对比.net framework中拥有的三种定时器。Win32定时器，服务器定时器，线程定时器。Win32定时器是单线程定时器，精度55毫秒；服务器定时器是多线程定时器，其精度<strong>可能</strong>比Win32定时器精确得多（注意只是可能）；线程计时器专门用于那种消息不在线程上发送的解决方案，没有提到其精度。原来如此啊。</p>
<p>对于最终的结果，我有如下的结论：<br />
1、我用任何定时方法，都无法达到指定的精度，其原因可能与码流本身有关，因为我调用的是第三方非开源的控件提供的ImageCaptur方法，该方法截取图片的时间间隔可能受到帧率的影响，而我除了使用这个非开源控件，不能用其他办法操纵摄像头。<br />
2、虽然说Win32定时器(System.Windows.Forms.Timer)的精度只有55毫秒，但是实际使用中，发现产生的最终结果和System.Timers.Timer相同，即，不是93或94毫秒，就是109毫秒。由于我对msdn更加信任一点，所以这个结果就更加使我确信，实际拍摄的时间间隔受到视频流本身的帧率的影响。<br />
3、实际上，可以更加进一步地调查定时不精确的原因，并且寻求解决办法（最终结论可能还是没有解决办法），但是由于这个选择的性价比实在太低，不值得尝试，所以，到此为止。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/computer" title="computer" rel="tag">computer</a>, <a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a>, <a href="http://sexywp.com/tags/science" title="science" rel="tag">science</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/the-timer-is-not-accurate.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>.net中如何只允许运行一个程序实例</title>
		<link>http://sexywp.com/run-only-one-instance.htm</link>
		<comments>http://sexywp.com/run-only-one-instance.htm#comments</comments>
		<pubDate>Sat, 29 Mar 2008 00:15:03 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/run-only-one-instance.htm</guid>
		<description><![CDATA[如何使一个Windows应用程序只运行一个实例，看如下代码：



using System;

<span class="readmore"><a href="http://sexywp.com/run-only-one-instance.htm" title=".net中如何只允许运行一个程序实例">Keep Reading --- 49 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>如何使一个Windows应用程序只运行一个实例，看如下代码：</p>
<pre name="code" class="c-sharp:nogutter">
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Diagnostics;

namespace MyMonitor
{
    static class Program
    {
        ///
<summary>
        /// 应用程序的主入口点。
        /// </summary>

        [STAThread]
        static void Main()
        {
            Process[] ps = Process.GetProcessesByName(Process
.GetCurrentProcess().ProcessName);
            if (ps.Length <= 1)
            {
                Application.EnableVisualStyles();
                Application
.SetCompatibleTextRenderingDefault(false);
                Application.Run(new EMonitor());
            }
            else
            {
                MessageBox.Show("不能打开多于一个程序实例！");
            }
        }
    }
}
</pre>
<p>原理上来说，没有什么难的，只是不知道而已。</p>
<p>后来，又查到了一个方法，看下面的代码：</p>
<pre name="code" class="c-sharp:nogutter">
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;

namespace MyMonitor
{
    static class Program
    {
        ///
<summary>
        /// 应用程序的主入口点。
        /// </summary>

        [STAThread]
        static void Main()
        {
            bool bCreatedNew;
            //"EMonitor" 是我的程序的主窗体的名称，但是这个名称是可以随便
            //叫的，只是给互斥体取个名字而已
            Mutex m = new Mutex(false, "EMonitor", out bCreatedNew);
            if (bCreatedNew)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new EMonitor());
            }
            else
            {
                MessageBox.Show("不能打开多于一个程序实例！");
            }
        }
    }
}
</pre>
<p>可以看到，第二段代码采用Mutex提供的互斥功能。</p>
<p>后来在网上又找，原来有人多这个问题做过详细的研究：</p>
<p>http://blog.csdn.net/zhzuo/archive/2006/06/30/857405.aspx</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/run-only-one-instance.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>关于在.net下使用OCX控件的问题</title>
		<link>http://sexywp.com/how-to-use-ocx.htm</link>
		<comments>http://sexywp.com/how-to-use-ocx.htm#comments</comments>
		<pubDate>Fri, 28 Mar 2008 00:22:14 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/how-to-use-ocx.htm</guid>
		<description><![CDATA[我在.net框架下面编程，但是要使用ocx控件。不过，这个领域我真的很白痴啊，很多东西搞不定，不知道怎么回事。

首先是一些术语不明白，什么COM啊，COM+啊，GDI啊，GDI+啊，都是些什么啊？有谁推荐一本书，一次性讲得透彻点的那种。

还有就是我要在程序中使用ocx控件，我不知道怎么初始化一个ocx控件，所以，我一般是先拖到窗体上，抄窗体设计器自动生成的代码。结果，这个办法并不是每次都有效，真是很不爽啊。

<span class="readmore"><a href="http://sexywp.com/how-to-use-ocx.htm" title="关于在.net下使用OCX控件的问题">Keep Reading --- 347 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>我在.net框架下面编程，但是要使用ocx控件。不过，这个领域我真的很白痴啊，很多东西搞不定，不知道怎么回事。</p>
<p>首先是一些术语不明白，什么COM啊，COM+啊，GDI啊，GDI+啊，都是些什么啊？有谁推荐一本书，一次性讲得透彻点的那种。</p>
<p>还有就是我要在程序中使用ocx控件，我不知道怎么初始化一个ocx控件，所以，我一般是先拖到窗体上，抄窗体设计器自动生成的代码。结果，这个办法并不是每次都有效，真是很不爽啊。</p>
<p>比如，我如果直接自己用代码创建控件，抄袭窗体设计器的代码还没有问题，但是如果我要把ocx控件自己包装一下，有些代码就失灵了。比如如下的代码：</p>
<div class="hl-surround"><div class="hl-main"><span style="color: Blue;">System</span><span style="color: Gray;">.</span><span style="color: Blue;">ComponentModel</span><span style="color: Gray;">.</span><span style="color: Blue;">ComponentResourceManager</span><span style="color: Gray;"> </span><span style="color: Blue;">resources</span><span style="color: Gray;"> = </span><span style="color: Green;">new</span><span style="color: Gray;"> </span><span style="color: Blue;">System</span><span style="color: Gray;">.</span><span style="color: Blue;">ComponentModel</span><span style="color: Gray;">.</span><span style="color: Blue;">ComponentResourceManager</span><span style="color: Olive;">(</span><span style="color: Blue;">typeof</span><span style="color: Olive;">(</span><span style="color: Blue;">Form1</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;<br /></span><span style="color: Blue;">amc</span><span style="color: Gray;">.</span><span style="color: Blue;">OcxState</span><span style="color: Gray;"> = </span><span style="color: Olive;">(</span><span style="color: Olive;">(</span><span style="color: Blue;">System</span><span style="color: Gray;">.</span><span style="color: Blue;">Windows</span><span style="color: Gray;">.</span><span style="color: Blue;">Forms</span><span style="color: Gray;">.</span><span style="color: Blue;">AxHost</span><span style="color: Gray;">.</span><span style="color: Blue;">State</span><span style="color: Olive;">)</span><span style="color: Olive;">(</span><span style="color: Blue;">resources</span><span style="color: Gray;">.</span><span style="color: Blue;">GetObject</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">amc</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;">+</span><span style="color: Blue;">id</span><span style="color: Gray;">.</span><span style="color: Blue;">ToString</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">+</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">.OcxState</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></div></div>
<p>说实在的，我真的不知道这些代码有什么作用，我在窗体里面用ocx的时候，可以这么写，但是后来，我想用一个panel把ocx给包装个一层，我发现，这两行代码加上就没法运行了，也不知道怎么改，真头疼啊。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">不要使用PeekChar()判断EOF</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/how-to-use-ocx.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>不要使用PeekChar()判断EOF</title>
		<link>http://sexywp.com/donot-use-peekchar-detect-eof.htm</link>
		<comments>http://sexywp.com/donot-use-peekchar-detect-eof.htm#comments</comments>
		<pubDate>Wed, 26 Mar 2008 00:47:37 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/donot-use-peekchar-detect-eof.htm</guid>
		<description><![CDATA[这两天使用.net framework编程，其中有个任务是将一个二进制文件格式转换成mpeg4码流的媒体文件。其中需要使用System.IO.BinaryReader类，按照MSDN和我自己使用的SDK的范例，我使用了类似下面的代码。

using(FileStream inputFile = new FileStream(&#34;name.bin&#34;,FileMode.Open))using(BinaryReader br = new BinaryReader(inputFile)){&#160;&#160; &#160;while(br.PeekChar() != -1)&#160; &#160;///&#60;----崩溃&#160;&#160; &#160;{&#160;&#160; &#160; &#160;////......&#160;&#160; &#160;}}

<span class="readmore"><a href="http://sexywp.com/donot-use-peekchar-detect-eof.htm" title="不要使用PeekChar()判断EOF">Keep Reading --- 83 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p style="text-indent:2em">这两天使用.net framework编程，其中有个任务是将一个二进制文件格式转换成mpeg4码流的媒体文件。其中需要使用System.IO.BinaryReader类，按照MSDN和我自己使用的SDK的范例，我使用了类似下面的代码。</p>
<div class="hl-surround"><div class="hl-main"><span style="color: Green;">using</span><span style="color: Olive;">(</span><span style="color: Blue;">FileStream</span><span style="color: Gray;"> </span><span style="color: Blue;">inputFile</span><span style="color: Gray;"> = </span><span style="color: Green;">new</span><span style="color: Gray;"> </span><span style="color: Blue;">FileStream</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">name.bin</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;">,</span><span style="color: Blue;">FileMode</span><span style="color: Gray;">.</span><span style="color: Blue;">Open</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;"><br /></span><span style="color: Green;">using</span><span style="color: Olive;">(</span><span style="color: Blue;">BinaryReader</span><span style="color: Gray;"> </span><span style="color: Blue;">br</span><span style="color: Gray;"> = </span><span style="color: Green;">new</span><span style="color: Gray;"> </span><span style="color: Blue;">BinaryReader</span><span style="color: Olive;">(</span><span style="color: Blue;">inputFile</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;"><br /></span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">while</span><span style="color: Olive;">(</span><span style="color: Blue;">br</span><span style="color: Gray;">.</span><span style="color: Blue;">PeekChar</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;"> != -</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span><span style="color: Gray;">&nbsp; &nbsp;</span><span style="color: #ffa500;">///&lt;----崩溃</span><span style="color: #ffa500;"></span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Olive;">{</span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp; &nbsp;</span><span style="color: #ffa500;">////......</span><span style="color: #ffa500;"></span><span style="color: Gray;"><br />&nbsp;&nbsp; &nbsp;</span><span style="color: Olive;">}</span><span style="color: Gray;"><br /></span><span style="color: Olive;">}</span></div></div>
<p style="text-indent:2em">以上代码总是会在调用个PeekChar()的时候发生崩溃，错误信息为：输出字符缓冲区太小，无法包含解码后的字符，编码“Unicode (UTF-8)”的操作回退“System.Text.DecoderReplacementFallback”。 搞不清楚怎么回事，后来上网反复查，发现这个竟然是一个.net framework的bug。</p>
<p style="text-indent:2em">其中涉及到UTF编码格式的一些知识，我也不太明白，不过有一点是可以确定，官方推荐不要使用PeekChar()来判断EOF。这真是让我很晕啊，怎么那么多官方文档和SDK里面都用错误的例子啊，被误导了，耽误了不少时间呢。</p>
<p style="text-indent:2em">推荐使用的判断EOF的方法是：</p>
<div class="hl-surround"><div class="hl-main"><span style="color: Blue;">br</span><span style="color: Gray;">.</span><span style="color: Blue;">BaseStream</span><span style="color: Gray;">.</span><span style="color: Blue;">Position</span><span style="color: Gray;"> &lt; </span><span style="color: Blue;">br</span><span style="color: Gray;">.</span><span style="color: Blue;">BaseStream</span><span style="color: Gray;">.</span><span style="color: Blue;">Length</span></div></div>
<p>参考文献：</p>
<p>http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1939995&#038;SiteID=1</p>
<p>http://www.codeplex.com/SvnBridge/WorkItem/View.aspx?WorkItemId=9077</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fa-problem-with-label.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Label标签怎么使用？</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm&from=http%3A%2F%2Fsexywp.com%2Fdonot-use-peekchar-detect-eof.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.NET Windows Forms窗体中的事件顺序</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/donot-use-peekchar-detect-eof.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET Windows Forms窗体中的事件顺序</title>
		<link>http://sexywp.com/the-events-sequence-of-the-windows-form.htm</link>
		<comments>http://sexywp.com/the-events-sequence-of-the-windows-form.htm#comments</comments>
		<pubDate>Fri, 21 Mar 2008 00:45:32 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[dotNet]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.charlestang.cn/the-events-sequence-of-the-windows-form.htm</guid>
		<description><![CDATA[最近，正好在学习C#编程，现在正在写一个小程序。

果真，我对.NET是一点概念都没有的，对Windows编程的概念也是趋近于零。一路走来，异常艰辛啊~~

网上东翻西找总算找到了Windows Forms启动和关闭时候引发的事件的顺序了。赶快记在这里。不禁感叹MSDN的强大和不方便。几乎你要的任何资料这里都有，但是查找起来非常不便。最可恶的是，IE7打开中文版的MSDN竟然引发浏览器崩溃，靠！~~

<span class="readmore"><a href="http://sexywp.com/the-events-sequence-of-the-windows-form.htm" title=".NET Windows Forms窗体中的事件顺序">Keep Reading --- 274 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows组件中的Timer计时精确度有限</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>最近，正好在学习C#编程，现在正在写一个小程序。</p>
<p>果真，我对.NET是一点概念都没有的，对Windows编程的概念也是趋近于零。一路走来，异常艰辛啊~~</p>
<p>网上东翻西找总算找到了Windows Forms启动和关闭时候引发的事件的顺序了。赶快记在这里。不禁感叹MSDN的强大和不方便。几乎你要的任何资料这里都有，但是查找起来非常不便。最可恶的是，IE7打开中文版的MSDN竟然引发浏览器崩溃，靠！~~</p>
<p>Form 和 Control 类公开了一组与应用程序启动和关闭相关联的事件。当 Windows 窗体应用程序启动时，主窗体的启动事件按以下顺序引发：<br />
<span id="more-24"></span><br />
<code>
<ol>
<li>Control.HandleCreated</li>
<li>Control.BindingContextChanged</li>
<li>Form.Load</li>
<li>Control.VisibleChanged</li>
<li>Form.Activated</li>
<li>Form.Shown</li>
</ol>
<p></code><br />
当应用程序关闭时，主窗体的关闭事件按以下顺序引发：<br />
<code>
<ol>
<li>Form.Closing</li>
<li>Form.FormClosing</li>
<li>Form.Closed</li>
<li>Form.FormClosed</li>
<li>Form.Deactivate</li>
</ol>
<p></code><br />
Application 类的 ApplicationExit 事件在主窗体的关闭事件之后引发。</p>
<p>原文地址：http://msdn2.microsoft.com/zh-cn/library/86faxx0d.aspx</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fdoc-generate-tool-in-dotnet.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中的自动文档生成工具</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-ocx.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于在.net下使用OCX控件的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Frun-only-one-instance.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">.net中如何只允许运行一个程序实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fthe-timer-is-not-accurate.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows组件中的Timer计时精确度有限</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fsexywp.com%2Fcustom-event-in-custom-control.htm&from=http%3A%2F%2Fsexywp.com%2Fthe-events-sequence-of-the-windows-form.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">让自定义控件产生自定义事件</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/dotnet" title="dotNet" rel="tag">dotNet</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/the-events-sequence-of-the-windows-form.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

